User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Decimal numbers

  1. #1
    No Products Registered

    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Decimal numbers

    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?

  2. #2
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    Everything but coordinates/angles can be float/integers as far as I know. Multiply by 1.0 to make it a float.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    But be careful where you multiply with 1.0. Wrong postion results still into integers. Best is to make some tests.

  4. #4
    No Products Registered

    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    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 :/

  5. #5
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    Results in 1.0 here ...

  6. #6
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    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.

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    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.

  8. #8
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Francois's Avatar
    Join Date
    Jul 2006
    Location
    Montpellier, France
    Posts
    6,920
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Re: Decimal numbers

    Sphax, MMF2 uses double and not float.

  9. #9
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    Actions, Expressions and Conditions uses Float parameters...

  10. #10
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Decimal numbers

    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.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. BUG (Beta 257.17) Decimal numbers not calculating correctly
    By mobichan in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 29th April 2013, 01:02 PM
  2. Decimal numbers in Alterable Values?
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 1st January 2012, 04:05 PM
  3. I have a problem with decimal numbers
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 9th February 2009, 11:35 PM
  4. question about decimal numbers
    By Attus in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 16th October 2008, 07:43 AM
  5. Storing Decimal Numbers as Alterable Values
    By Raphael in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 21st September 2006, 01:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •