User Tag List

Results 1 to 3 of 3

Thread: rounding decimal problem

  1. #1
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rounding decimal problem

    I have had this issue before where some math results in a rounded number when say, added to counter.

    My latest is with angles.
    360/7 = 51.42857142857143
    But set a counter to the angle of object = 51
    My fix is:
    360/(value( "obj_angl" )+0.0)) = 51.428

    On previous occasions I have had to experiment where the 0.0 goes -- but eventually I have found the spot.

    I can easily imagine there is something I am missing and would be delighted to know what it is.

  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Jan 2007
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: rounding decimal problem

    By default, MMF will think you are working with integers. That means whole numbers which are all rounded down. By adding 0.0 or multiplying with 1.0 (or any number of type double), MMF will know what you mean and will turn the values into doubles.

    Here are some scenarios:
    1/2=0 -> 0 is an integer, it was rounded down from 0.5
    1/2.0=0.5 -> you divided by a double, so the outcome will also be a double
    1/2*1.0=0 -> divided by an integer first, so the first outcome is 0, when you multiply it with 1.0, it's already to late
    1/(2*1.0)=0.5 -> the 2 was turned into a double first, and then the division starts, so the outcome is 0.5

  3. #3
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: rounding decimal problem

    Thanks for the speedy reply Hernan.

    Wow is that ever... the way it is.
    Part of me says "hey clickteam!" but then, having programmed in a few scenarios for a few years, I allow that workaround-is-reality.

    Knowing is freedom - ignorance a pain.

    pain free - for the time being

Similar Threads

  1. Rounding a decimal number?
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 28th May 2012, 11:48 AM
  2. 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
  3. Rounding to decimal point.
    By BrandonC in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 10th June 2008, 02:42 PM
  4. Decimal/rounding problem.
    By The_Alee in forum File Archive
    Replies: 8
    Last Post: 18th November 2007, 09:44 PM
  5. Rounding problem for slider bar
    By RageO in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 31st May 2007, 05:54 PM

Posting Permissions

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