Basic Micro Studio Syntax Manual
Basic Micro Studio Syntax Manual
Basic Micro Studio Syntax Manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Floating Point Math<br />
TOINT<br />
TOFLOAT<br />
Structure - Math<br />
M<strong>Basic</strong> includes fl oating point math functions. These functions can be processor intensive. The time it<br />
takes will vary based on the processor used. The AtomPro40m is the fastest since it has built in 32 bit<br />
math hardware and runs at 20 Mhz. This should be considered any time making a decision in creating<br />
programs with fl oating point math functions.<br />
Floating Point Operators<br />
Operator Description<br />
TOINT Convert a Floating Point value to a Integer<br />
TOFLOAT Convert an Integer value to a Floating Point<br />
FSQRT Floating Point Square Root(<strong>Basic</strong>ATOMPro Only)<br />
FSIN Floating Point Sine (<strong>Basic</strong>ATOMPro Only)<br />
FCOS Floating Point Cosine (<strong>Basic</strong>ATOMPro Only)<br />
FTAN Floating Point Tangent (<strong>Basic</strong>ATOMPro Only)<br />
FASIN Floating Point ArcSine (<strong>Basic</strong>ATOMPro Only)<br />
FACOS Floating Point ArcCosine (<strong>Basic</strong>ATOMPro Only)<br />
FATAN Floating Point Arc Tangent (<strong>Basic</strong>ATOMPro Only)<br />
FSINH Floating Point Hyperbolic Sine (<strong>Basic</strong>ATOMPro Only)<br />
FCOSH Floating Point Hyperbolic Cosine (<strong>Basic</strong>ATOMPro Only)<br />
FTANH Floating Point Hyperbolic Tangent (<strong>Basic</strong>ATOMPro Only)<br />
FATANH Floating Point Hyperbolic ArcTangent (<strong>Basic</strong>ATOMPro Only)<br />
FLN Floating Point Natural Log (<strong>Basic</strong>ATOMPro Only)<br />
FEXP Floating Point Exponent (<strong>Basic</strong>ATOMPro Only)<br />
The TOINT operator explicitly converts a fl oating point value into an integer value. The decimal point<br />
of the fl oating point number is truncated.<br />
myfl oat var fl oat<br />
myint var long<br />
myfl oat = 10.0 ;myfl oat now equals 10.0<br />
myfl oat = myfl oat * 123.123 ;myfl oat now equals 1231.23<br />
myint = TOINT myfl oat ;myint now equals 1231<br />
serout s_out,i9600,[“result = “,sdec myint,13]<br />
The TOFLOAT operator explicitly converts an integer value into a fl oating point value.<br />
myint var long<br />
myfl oat var fl oat<br />
myint = 10<br />
myfl oat = TOFLOAT myint / 100.0 ;myfl oat now equals 0.1<br />
serout s_out,i9600,[“result = “,real myfl oat,13]<br />
63