RosettaCodeData/Task/Real-constants-and-functions/S-BASIC/real-constants-and-function...

29 lines
643 B
Plaintext

print "Square root of 2.7 ="; sqr(2.7)
print "Natural log of 2.7 ="; log(2.7)
print "Exp() of 2.7 ="; exp(2.7)
print "Absolute value of -2.7 ="; abs(-2.7)
print "Floor of 2.7 ="; int(2.7)
print "Floor of -2.7 ="; int(-2.7)
print "2.7 to the 3rd power ="; 2.7 ^ 3 rem or 2.7 ** 3
comment
e, pi, and ceiling() are not built-in, but are
easily implemented
end
function e = real
end = exp(1.0)
function pi = real
end = atn(1.0) * 4.0
function ceil(x = real) = real
end = int(x) + 1
print "e ="; e
print "pi ="; pi
print "ceiling of 2.7 = "; ceil(2.7)
print "ceiling of -2.7 = "; ceil(-2.7)
end