Completed degree, radian, gradian builtin conversions

Updated CHANGES.

Updated help/unexpected.

Added help files for d2g(), d2r(), g2d(), g2r(), r2d(), r2g().

Added regression test code for the same functions.

Fixed a few minor typos.
This commit is contained in:
Landon Curt Noll
2021-09-07 13:28:03 -07:00
parent 554cd97145
commit ca5a81122a
10 changed files with 490 additions and 31 deletions

View File

@@ -228,7 +228,7 @@ Unexpected
1<<8/2
evalues to 128, not 16, because <<8 is performed before the /2.
evaluates to 128, not 16, because <<8 is performed before the /2.
&A[0] and A are different things in calc
@@ -529,6 +529,34 @@ Unexpected
; help fclose
trig functions use only radians
===============================
Some might be surprised to discover that all of the trigonometric in calc:
sin, cos, tan, sec, csc, cot
asin, acos, atan, asec, acsc, acot
work in only radians.
Calc as builtin functions to convert between degrees, radians and gradians:
d2r(deg) - given degrees returns radians
g2r(grad) - given gradians returns radians
r2d(rad) - given radians returns degrees
g2d(grad) - given gradians returns degrees
r2g(rad) - given radians returns gradians
d2g(deg) - given degrees returns gradians
For example, if you want to take the sin of 30 degrees, convert
the 30 degrees into radians and pass the result to sin():
; print sin(d2r(30))
0.5
## Copyright (C) 1999-2007,2014,2017,2021 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under