[Gambas-user] Arithmetic general question
BB
adamnt42 at gmail.com
Tue Jan 24 05:53:54 CET 2023
I am having a "senior" day.
Var1 and Var2 are defined as Variants. Say Var1 is an integer value 1300
and Var2 is a float value 1285.44 I want to get the difference between
the two _as an integer_. (Var2 can be bigger or smaller than Var1)
If I just use Var1 - Var2, I get (printed as an integer) 14, but is
that arithmetically correct? Similarly, if Var2 is 1318.55 I get -18
Should I be converting or rounding the values before doing the
subtraction? I just can't get my head around this. Just looking for a
fresh mind to look at it.
tia
bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230124/5010ab5a/attachment-0001.htm>
More information about the User
mailing list