Real constants and functions: Difference between revisions

Content added Content deleted
No edit summary
Line 506: Line 506:


</pre>
</pre>

=={{header|ERRE}}==
<lang ERRE>PROGRAM R_C_F

FUNCTION CEILING(X)
CEILING=INT(X)-(X-INT(X)>0)
END FUNCTION

FUNCTION FLOOR(X)
FLOOR=INT(X)
END FUNCTION

BEGIN
PRINT(EXP(1)) ! e not available
PRINT(π) ! pi is available or ....
PRINT(4*ATN(1)) ! .... equal to

X=12.345
Y=1.23

PRINT(SQR(X),X^0.5) ! square root
PRINT(LOG(X)) ! natural logarithm base e
PRINT(LOG(X)/LOG(10)) ! base 10 logarithm
PRINT(LOG(X)/LOG(Y)) ! arbitrary base logarithm (y>0)
PRINT(EXP(X)) ! exponential
PRINT(ABS(X)) ! absolute value
PRINT(FLOOR(X)) ! floor
PRINT(CEILING(X)) ! ceiling
PRINT(X^Y) ! power
END PROGRAM</lang>
{{out}}
<pre> 2.718282
3.141592653589793
3.141593
3.513545 3.513545
2.513251
1.091491
12.14048
229808.1
12.345
12
13
22.00564</pre>


=={{header|F Sharp|F#}}==
=={{header|F Sharp|F#}}==