Hmm.. which variables (counters, alterable values, coordinates, etc) are set to be used as integers and which aren't? And how many decimal places does MMF count?
Hmm.. which variables (counters, alterable values, coordinates, etc) are set to be used as integers and which aren't? And how many decimal places does MMF count?
Everything but coordinates/angles can be float/integers as far as I know. Multiply by 1.0 to make it a float.
But be careful where you multiply with 1.0. Wrong postion results still into integers. Best is to make some tests.
Argh, that's a lot of tests :P. But I'll try..
Hmm.. how many decimal places does MMF count to? I think I did 100*0.01 and got 1, but I think I did 10000*0.0001 and it resulted in 0, even though it's the same thing :/
Results in 1.0 here ...







The coordinates of an active object are integers (it will not change before the next major release of MMF2, like MMF3 or MMF2.5).
The angle of an active object is a float (in b248+ only currently) but it is an integer in the last non beta version (b247).
The counters, alterable values and global values can handle int or floats.
MMF2 can handle as much decimals as a DOUBLE can since it works with doubles (no floats). If you want to have more preciseness than doubles, you should use an extension which can handle more by returning the results as strings.
To be sure you want to calculate in floats, you should be sure that your operands are in float. If they are not, you can transform them in floats by multiplying them by "1.0". Be warn that this transformation must happen before an operation is made. To know this, you should understand how MMF2 handles the priorities of the operators.
I think, MMF2 attributes a priority for both operators (this is not like traditional mathematics) to speed up the calculations.
This is the operators classified by priorities:
- () : parentheses
- / : divide
- * : multiply
- mod : modulo (%)
- + : add
- - : subtract
I'm not sure for the priorities of +/- operators but I'm sure for "()", "/" and "*".
For an example:
1.0*5/2 : return 2
(1.0*5)/2 : return 2.5
5*1.0/2 : return 2.5 (the fastest one and my favorite)
Now, you know all what you should know with mathematics in MMF2. If you understand all these rules, you'll earn a lot of time.
EDIT: correction: MMF2 uses doubles for its internal calculations.

Surely it's subtract then add?
Otherwise 1+2-3+4 would group as (1+2)-(3+4)
EDIT:
Poking around the MMF internals like I do sometimes, it seems MMF 2 uses double-precision floating point for expression evaluation and alterable values (probably globals too), but only sends single-precision floats to extensions.



Sphax, MMF2 uses double and not float.
Actions, Expressions and Conditions uses Float parameters...







Oups, sorry Francois.
Maybe MMF2, uses double for its internal calculations and extensions are forced to use floats?
I've corrected my post above
Can you confirm or not my post about the priorities for the operators? I think this information is important.![]()