RosettaCodeData/Task/Trigonometric-functions/NetRexx/trigonometric-functions.netrexx
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

35 lines
2.3 KiB
Text

/* NetRexx */
options replace format comments java crossref symbols nobinary utf8
numeric digits 30
parse 'Radians Degrees angle' RADIANS DEGREES ANGLE .;
parse 'sine cosine tangent arcsine arccosine arctangent' SINE COSINE TANGENT ARCSINE ARCCOSINE ARCTANGENT .
trigVals = ''
trigVals[RADIANS, ANGLE ] = (Rexx Math.PI) / 4 -- Pi/4 == 45 degrees
trigVals[DEGREES, ANGLE ] = 45.0
trigVals[RADIANS, SINE ] = (Rexx Math.sin(trigVals[RADIANS, ANGLE]))
trigVals[DEGREES, SINE ] = (Rexx Math.sin(Math.toRadians(trigVals[DEGREES, ANGLE])))
trigVals[RADIANS, COSINE ] = (Rexx Math.cos(trigVals[RADIANS, ANGLE]))
trigVals[DEGREES, COSINE ] = (Rexx Math.cos(Math.toRadians(trigVals[DEGREES, ANGLE])))
trigVals[RADIANS, TANGENT ] = (Rexx Math.tan(trigVals[RADIANS, ANGLE]))
trigVals[DEGREES, TANGENT ] = (Rexx Math.tan(Math.toRadians(trigVals[DEGREES, ANGLE])))
trigVals[RADIANS, ARCSINE ] = (Rexx Math.asin(trigVals[RADIANS, SINE]))
trigVals[DEGREES, ARCSINE ] = (Rexx Math.toDegrees(Math.acos(trigVals[DEGREES, SINE])))
trigVals[RADIANS, ARCCOSINE ] = (Rexx Math.acos(trigVals[RADIANS, COSINE]))
trigVals[DEGREES, ARCCOSINE ] = (Rexx Math.toDegrees(Math.acos(trigVals[DEGREES, COSINE])))
trigVals[RADIANS, ARCTANGENT] = (Rexx Math.atan(trigVals[RADIANS, TANGENT]))
trigVals[DEGREES, ARCTANGENT] = (Rexx Math.toDegrees(Math.atan(trigVals[DEGREES, TANGENT])))
say ' '.right(12)'|' RADIANS.right(17) '|' DEGREES.right(17) '|'
say ANGLE.right(12)'|' trigVals[RADIANS, ANGLE ].format(4, 12) '|' trigVals[DEGREES, ANGLE ].format(4, 12) '|'
say SINE.right(12)'|' trigVals[RADIANS, SINE ].format(4, 12) '|' trigVals[DEGREES, SINE ].format(4, 12) '|'
say COSINE.right(12)'|' trigVals[RADIANS, COSINE ].format(4, 12) '|' trigVals[DEGREES, COSINE ].format(4, 12) '|'
say TANGENT.right(12)'|' trigVals[RADIANS, TANGENT ].format(4, 12) '|' trigVals[DEGREES, TANGENT ].format(4, 12) '|'
say ARCSINE.right(12)'|' trigVals[RADIANS, ARCSINE ].format(4, 12) '|' trigVals[DEGREES, ARCSINE ].format(4, 12) '|'
say ARCCOSINE.right(12)'|' trigVals[RADIANS, ARCCOSINE ].format(4, 12) '|' trigVals[DEGREES, ARCCOSINE ].format(4, 12) '|'
say ARCTANGENT.right(12)'|' trigVals[RADIANS, ARCTANGENT].format(4, 12) '|' trigVals[DEGREES, ARCTANGENT].format(4, 12) '|'
say
return