User Tag List

Results 1 to 6 of 6

Thread: [BUG / Problem ]Float-value

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export ModuleUnicode Add-on
    Pharanygitis's Avatar
    Join Date
    Aug 2006
    Location
    Germany
    Posts
    1,037
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [BUG / Problem ]Float-value

    Hi,
    i have a litte problem/bug. MMF2 apparently adds the wrong float-value to a flash-exported game.
    that happens occasionally....

    Example :
    i'm add 0.05 to my counter
    MMF2 add 0.0499999 to my counter :-/

    See the Examplefile (Flash & MFA)
    Attached files Attached files

  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: [BUG / Problem ]Float-value

    This isn't a bug, it's just not preventable from what I know. Floats will always be imprecise. I suggest using large numbers, and for displaying them just divide by a number to get the float.
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Multimedia Fusion 2 Developer

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

    Re: [BUG / Problem ]Float-value

    Floating point numbers can represent any fraction with a power-of-two denominator within their range. Any other fraction turns out inaccurate, including a lot of numbers which look perfectly sensible to us, like your 0.05. It's exactly the same as trying to represent 1/3 in a fixed number of decimal digits. e.g. trying to represent 1/3 with 8 decimal places, the closest you can get is 0.33333333, which is still 1/300000000 out.

    Just a general limitation of computers I'm afraid.

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    chrilley's Avatar
    Join Date
    Jul 2006
    Posts
    1,013
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)

    Re: [BUG / Problem ]Float-value

    Digging up the thread.

    I am having this exact issue in my Flash game but I don't quite get why I don't have this issue in the MMF2 version?

    If floats are so imprecise then why can the .EXE stand-alone handle adding 0.1 to a value? Only the Flash exported version has this issue.

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleFirefly 3D ModuleInstall Creator Pro
    twister's Avatar
    Join Date
    Jan 2007
    Location
    Pacific Northwest USA
    Posts
    376
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: [BUG / Problem ]Float-value

    I Just read through the Flash help file last night and this is what the mmf2 help file had.

    Help / Contents
    Multimedia Fusion Developer Help
    --Contents
    ---Distributing your application
    ----SWF files for Adobe...
    -----SWF / EXE differences

    - Floating point calculations are less precise than in Windows applications : usually a counter after a floating point calculation shows a lot of digits after the dot. To solve that problem, you should force the number of digits displayed after the dot in the counter object properties in the frame editor.
    - Due to internal encoding of floating point numbers, comparison between floating point numbers may never be true. For example "Counter = 1.23" may not be true as the counter might be at 1.229999999. The solution here is to make a greater/smalled comparison with two conditions. Example "Counter>1.28" and "Counter<1.31". Note: this is true with the Windows runtime too! However calculations are more precise in the Windows runtime, so this problem may occur less often.

    Apparently the flash exporter has a limitation for only 2 decimals points.

    hope this helps.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    chrilley's Avatar
    Join Date
    Jul 2006
    Posts
    1,013
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)

    Re: [BUG / Problem ]Float-value

    It certainly did, thanks twister!

    Now gentlemen if you excuse me I got to convert some of global values to counters.

Similar Threads

  1. Velocity value as Float?
    By danjo in forum Fusion 2.5
    Replies: 2
    Last Post: 26th October 2013, 08:15 AM
  2. Problem with Float Point, please help
    By Carlos182 in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 16th September 2009, 08:06 PM
  3. Return a Float
    By Jaffob in forum Extension Development
    Replies: 3
    Last Post: 3rd April 2009, 11:05 PM
  4. Global Value Float Bug
    By xerus in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 31st January 2008, 08:43 AM
  5. Float expression?
    By z33z in forum Extension Development
    Replies: 3
    Last Post: 6th March 2007, 07:48 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
  •