Real constants and functions: Difference between revisions

Added FreeBASIC
(Restoring visibility of server-side Pi image - lost in under-tested cosmetic edits of 18:44, 10 July 2016)
(Added FreeBASIC)
Line 695:
 
The 4 need not be named as 4.0, or 4D0, as 4 the integer will be converted by the compiler to double precision, because it is to meet a known double precision value in simple multiplication and so will be promoted. Hopefully, at compile time.
 
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
 
#Include "crt/math.bi"
 
Print M_E '' constant "e" from C runtime library
Print M_PI '' constant "pi" from C runtime library
Print Sqr(2) '' square root function built into FB
Print Log(M_E) '' log to base "e" built into FB
Print log10(10) '' log to base 10 from C runtime library
Print Exp(1) '' exponential function built into FB
Print Abs(-1) '' absolute value function (integers or floats) built into FB
Print Int(-2.5) '' floor function built into FB
Print ceil(-2.5) '' ceiling function from C runtime library
Print 2.5 ^ 3.5 '' exponentiation operator built into FB
Sleep </lang>
 
{{out}}
<pre>
2.718281828459045
3.141592653589793
1.414213562373095
1
1
2.718281828459045
1
-3
-2
24.70529422006547
</pre>
 
=={{header|Frink}}==
9,486

edits