CONTENTS | PREV | NEXT
12C. builtin float functions
----------------------------

Some trans-math functions are present, more will probably follow.

	x:=Fsin(y)    x:=Fcos(y)    x:=Ftan(y)

usual sin() etc. functions. they work with radians.
New in v3.3 are Fatan() Fasin() Facos() Fsincos()
Fsinh() Fcosh() and Ftanh() which work analogously to
the functions above. Ftieee() and Ffieee() convert FFP
floats to and from ieee floats (as used by E).

	x:=Fabs(y)

compute absolute value of y

	x:=Ffloor(y)    x:=Fceil(y)

compute lowest and highest whole-number float value near y

	x:=Fexp(y)    x:=Flog(y)    Flog10(y)    x:=Fpow(y,z)    Fsqrt(y)

compute e^y, ln(y), log base 10, z^y and square root of y, respectively.

	x,n:=RealVal(s)

parses string "s" to produce float value x. will skip leading spaces and tabs.
n is the number of characters parsed from the start of the string, or 0
if it couldn't be parsed as a float value. "x" will then be 0.0.
accepts negative numbers (and number without a ".", even).
example:

RealVal(' 3.14 ')    results in    3.14, 5
RealVal('blabla')    results in    0.0, 0

	s:=RealF(s,x,n)

Format a float value x to the estring s, with n positions after the ".".
max for "n" is 8, even less if you have lots of digits leading the ".".
an "n" of 0 will denote no fraction. The string is returned as result,
so it can be reused in a WriteF() for example:

WriteF('float = \s\n',RealF(s,3.14159),4)    results in    'float = 3.1416\n'

RealF() tries hard to make sensible roundings for a certain "n", as
the example shows. negative numbers are also handled properly.

RealF(s,-3.14159,0)    results in    '-3'