Trigonometric functions: Difference between revisions
Content added Content deleted
No edit summary |
(add E example) |
||
Line 237: | Line 237: | ||
} |
} |
||
</lang> |
</lang> |
||
=={{header|E}}== |
|||
{{trans|ALGOL 68}} |
|||
<lang e>def pi := (-1.0).acos() |
|||
def radians := pi / 4.0 |
|||
def degrees := 45.0 |
|||
def d2r := (pi/180).multiply |
|||
def r2d := (180/pi).multiply |
|||
println(`$\ |
|||
${radians.sin()} ${d2r(degrees).sin()} |
|||
${radians.cos()} ${d2r(degrees).cos()} |
|||
${radians.tan()} ${d2r(degrees).tan()} |
|||
${def asin := radians.sin().asin()} ${r2d(asin)} |
|||
${def acos := radians.cos().acos()} ${r2d(acos)} |
|||
${def atan := radians.tan().atan()} ${r2d(atan)} |
|||
`)</lang> |
|||
Output: |
|||
0.7071067811865475 0.7071067811865475 |
|||
0.7071067811865476 0.7071067811865476 |
|||
0.9999999999999999 0.9999999999999999 |
|||
0.7853981633974482 44.99999999999999 |
|||
0.7853981633974483 45.0 |
|||
0.7853981633974483 45.0 |
|||
=={{header|Forth}}== |
=={{header|Forth}}== |