Log in

View Full Version : decimals removed after multiplying/deviding?


Rob105
28th October 2023, 17:35
If say i do 1000/3 AviSynth+ outputs 333 not 333.3 how to i get decimals to stay, it seems like its auto rounding?

If i do something like (1000/3)*3 i get 999 instead of 1000

Boulder
28th October 2023, 18:10
You need to use a decimal point somewhere so Avisynth understands that you want a float. Like "1000./3".

StainlessS
28th October 2023, 19:33
Same as Boulder said.

Result of arithmetic operators +,-,*,/ concerning two Int variables (or constants) will have type Int result.
Where at least one of the operands is of type Float, then result will be of type Float (any type int operand converted to Float prior to operation).

If say i do 1000/3 AviSynth+ outputs 333 not 333.3
With Integer math, is sortof like,


1000/3 = 333, Remainder 1.


Or

1000 / 3 = 333
1000 % 3 = 1


EDIT: So
1000.0/3.0 = 333.3 etc
1000.0/3 = 333.3 etc
1000/3.0 = 333.3 etc
1000./3. = 333.3 etc
1000./3 = 333.3 etc
1000/3. = 333.3 etc
But
1000/3 = 333