RosettaCodeData/Task/Real-constants-and-functions/Liberty-BASIC/real-constants-and-functions.basic
2023-07-01 13:44:08 -04:00

32 lines
789 B
Text

print exp( 1) ' e not available
print 4 *atn( 1) ' pi not available
x =12.345: y =1.23
print sqr( x), x^0.5 ' square root- NB the unusual name
print log( x) ' natural logarithm base e
print log( x) /2.303 ' base 10 logarithm
print log( x) /log( y) ' arbitrary base logarithm
print exp( x) ' exponential
print abs( x) ' absolute value
print floor( x) ' floor
print ceiling( x) ' ceiling
print x^y ' power
end
function floor( x)
if x >0 then
floor =int( x)
else
if x <>int( x) then floor =int( x) -1 else floor =int( x)
end if
end function
function ceiling( x)
if x <0 then
ceiling =int( x)
else
ceiling =int( x) +1
end if
end function