IntOp and IntFmt... a little push, please
Ok...
If I use this:
IntOp $0 5 / 2
MessageBox MB_OK "$0"
$0 returns 2 :igor: ...when it suppose to be 2.5
How can I do this? I know must be with IntFmt, but how?
Thanks
Archive: IntOp and IntFmt... a little push, please
IntOp and IntFmt... a little push, please
Ok...
If I use this:
IntOp $0 5 / 2
MessageBox MB_OK "$0"
The "Int" in IntOp and IntFmt stands for "Integer". Integers are also known as "whole numbers" (e.g. 1, 2, 3, 4, and so on).
The INTEGER result of dividing 5 by 2 is in fact 2 (with a "remainder" of 1).
The number "2.5" is NOT an integer number, it is not a "whole number".
You can use the MODULUS operator to tell if there is any remainder left over after the INTEGER division:
IntOp $1 5 % 2 will set $1 to 1
IntOp $1 4 % 2 will set $1 to 0
One solution to your problem would be to check the MODULUS and if it is not zero you will know that the answer from the division is not the "exact" answer.