Older Version Newer Version

StPendl StPendl Oct 17, 2010 - "Liberty BASIC syntax coloring used"

=Integer Arithmetic= 
//[[user:CarlGundel]]//
[[toc]]
----
==Integer== 
Liberty BASIC defaults to integer arithmetic unless you do something that produces a floating point result. For example:

[[code format="lb"]]
a = 3 + 4 'integer calculation
for x = 1 to 10 'integer calculation
[[code]]

==Floating Point==
Or floating point:

[[code format="lb"]]
a = 0.3 + 0.4 'floating point
[[code]]

==Convert Float to Integer==
If a floating point result has a zero fractional part (this doesn't happen too often), then LB will convert it to an integer number on assignment. This is dependent on the math processor, and probably other variables.

[[code format="lb"]]
a = 0.3 + 0.7 'may become an integer on assignment
[[code]]

-Carl