'http://www.rosettacode.org/wiki/Real_constants_and_functions
'Constants and functions to handle doubles
include "$/inc/console.inc"
% e=exp(1) ' Euler's number e
double n1,ne,n2,n3,n4,n5,n6,n6a,n7,n7a,n8,n9,n10,n11,n12
string e1,ee,e2,e3,e4,e5,e6,e6a,e7,e7a,e8,e9,e10,e11,e12
' square root
n1=2 : e1="2"
' natural logarithm
ne=2 : ee="2"
' log2
n2=256 : e2="256"
' log10
n3=5 : e3="5"
' logn
n4=4096 : e4="4096"
' logn base
n5=16 : e5="16"
' power, value
n6=9 : e6="9"
' power, exponent
n6a=4 : e6a="4"
' root
n7a=4 : e7a="4"
n7=6561 : e7="6561"
' exp value for e
n8=log10(10) : e8="log10(10)"
' pow e, value for exponent
n9=log(5) : e9="log(5)"
' pow 10, value for exponent
n10=log10(5) : e10="log10(5)"
' abs, floor, ceil
n11=-1.2 : e11="-1.2"
' round, trunc, frac
n12=-1.8 : e12="-1.8"
-----------------------------------
SetConsoleTitle "Constants and functions dealing with doubles"
printl "e -> %e=exp(1) = " tab e
printl "pi -> pi = " tab tab pi
printl
printl "square root of " e1 " -> sqrt("e1") = " tab tab sqrt(n1)
printl
printl "natural logarithm of e -> log(e) = " tab tab log(e)
printl "natural logarithm of "ee" -> log("ee") = " tab tab log(ne)
printl "base 2 logarithm of " e2 " -> log2("e2") = " tab tab log2(n2)
printl "base 10 logarithm of " e3 " -> log10("e3") = " tab tab log10(n3)
printl "base "e5" logarithm of " e4 " -> logn("e4","e5") = " tab logn(n4,n5)
printl
printl "" e6 " to the power of " e6a " -> pow("e6","e6a") = " tab tab pow(n6,n6a)
printl "" e6 " to the power of " e6a " -> " e6"^"e6a " = " tab tab tab n6^n6a
printl " " e7a ". root of " e7 " -> pow("e7",1/"e7a") = " tab tab pow(n7,1/n7a)
printl
printl "e to the power of " e8 " -> exp("e8") = " tab exp(n8) " -- expon. value of " n8
printl "e to the power of "e9" -> pow(e,"e9") = " tab tab str(pow(e,n9),5) " -- pow(e, "str(n9,5)")"
printl "10 to the power of "e10" -> pow(10,"e10") = " tab str(pow(10,n10),5) " -- pow(10, "str(n10,5)")"
printl
printl "absolute value of " e11 " -> abs("e11") = " tab tab tab abs(n11)
printl "floor of " e11 " -> floor("e11") = " tab tab tab floor(n11)
printl "floor of " (-val(e11)) " -> floor("(-val(e11))") = " tab tab tab floor(-n11)
printl "ceiling of " e11 " -> ceil("e11") = " tab tab tab ceil(n11)
printl "ceiling of " (-val(e11)) " -> ceil("(-val(e11))") = " tab tab tab ceil(-n11)
printl "rounded of " e12 " -> round("e12") = " tab tab tab round(n12)
printl "rounded of " (-val(e12)) " -> round("(-val(e12))") = " tab tab tab round(-n12)
printl "truncate of " e12 " -> trunc("e12") = " tab tab tab trunc(n12)
printl "truncate of " (-val(e12)) " -> trunc("(-val(e12))") = " tab tab tab trunc(-n12)
printl "fraction of " e12 " -> frac("e12") = " tab tab tab frac(n12)
printl "fraction of " (-val(e12)) " -> frac("(-val(e12))") = " tab tab tab frac(-n12)
printl
printl "Enter ..." : waitkey