Post Reply 
Gradian toolbox
01-08-2016, 09:36 AM
Post: #1
Gradian toolbox
Hi to everybody!
I created a small program that provides conversion from radians or degrees to gradian and viceversa. There are also the three basic trigonometric functions and their inverse functions that work directly in gradians.
I hope it is useful to someone. If there are errors and bugs report it!

Code:

// Gradian Toolbox
// January 2016
// HAngle = 1 -> degrees mode
// HAngle = 0 -> radian mode
// Exact function removes approximation error
// Approx function convert decimal value to fraction whenever possible

// Converting to grads
EXPORT TO_GRAD(n)
BEGIN
IF HAngle == 1 THEN 
RETURN 10*n/9;
ELSE 
RETURN 200*n/π;
END;
END;

// Convert from grads
EXPORT FROM_GRAD(n)
BEGIN
IF HAngle == 1 THEN 
RETURN 9*n/10; 
ELSE 
RETURN n*π/200;
END;
END;

// Grads cosine
EXPORT COS_G(n)
BEGIN
RETURN COS(FROM_GRAD(n));
END;

// Grads sine
EXPORT SIN_G(n)
BEGIN
RETURN SIN(FROM_GRAD(n));
END;

// Grads tangent
EXPORT TAN_G(n)
BEGIN
RETURN TAN(FROM_GRAD(n));
END;

// Grads arccosine
EXPORT ACOS_G(n)
BEGIN
IF HAngle == 1 THEN 
RETURN approx(exact(10*ACOS(n)/9));
ELSE 
RETURN approx(exact(200*ACOS(n)/π));
END;
END;

// Grads arcsine
EXPORT ASIN_G(n)
BEGIN
IF HAngle == 1 THEN 
RETURN approx(exact(10*ASIN(n)/9));
ELSE 
RETURN approx(exact(200*ASIN(n)/π));
END;
END;

// Grads arctangent
EXPORT ATAN_G(n)
BEGIN
IF HAngle == 1 THEN 
RETURN approx(exact(10*ATAN(n)/9));
ELSE 
RETURN approx(exact(200*ATAN(n)/π));
END;
END;
Find all posts by this user
Quote this message in a reply
01-08-2016, 06:41 PM
Post: #2
RE: Gradian toolbox
thank you! very useful. Gradian should be an option in the Prime, like degree and radiants!

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-09-2016, 09:52 PM
Post: #3
RE: Gradian toolbox
(01-08-2016 06:41 PM)salvomic Wrote:  thank you! very useful.

Useful for what? I am not questioning you, I just have no idea who still uses GRADS and for what purpose? I believe Surveying used them, but I've heard that has not been true for many years.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
01-09-2016, 10:06 PM
Post: #4
RE: Gradian toolbox
(01-09-2016 09:52 PM)rprosperi Wrote:  Useful for what? I am not questioning you, I just have no idea who still uses GRADS and for what purpose? I believe Surveying used them, but I've heard that has not been true for many years.

military people use (used?) gradian in their operations...
I can still see gradian examples in old Italian Mathematics's books.
Sure you have already seen here: https://en.wikipedia.org/wiki/Gradian for some ideas.
However I mean: it's useful to have in the Prime also Gradian (not only Degree and Radians): better many than few Smile

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-10-2016, 01:47 AM
Post: #5
RE: Gradian toolbox
Thanks a Lot Big Grin !!! IT IS VERY USEFUL Big Grin !!!
Find all posts by this user
Quote this message in a reply
02-21-2016, 04:29 PM
Post: #6
RE: Gradian toolbox
Just downloaded it - thank you.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)