User Tag List

Results 1 to 3 of 3

Thread: Storing floats in an array?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,297
    Mentioned
    27 Post(s)
    Tagged
    0 Thread(s)

    Storing floats in an array?

    Is it possible to store floating points in an array? I am trying to store prices (ie 0.99, 1.99, 5.99, etc) and they always seem to round down.

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately not, arrays can only store integer values. All you need to do is multiply your value by 100 before you insert it into the array, and divide it by 100.0 when you retrieve it. Or, alternatively, you can use a text array. Then all you do is convert the float value to a string before you insert it, and could convert it back when you retrieve it.

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,297
    Mentioned
    27 Post(s)
    Tagged
    0 Thread(s)
    Thanks Chris. I'll give that a go.

Similar Threads

  1. storing objects in array
    By westray in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 20th May 2012, 08:14 PM
  2. floats in MMF2
    By Watermelon786 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 29th August 2010, 03:38 AM
  3. rSDK and floats
    By bufferOverflow in forum Extension Development
    Replies: 10
    Last Post: 1st May 2008, 03:59 PM
  4. Global Value and Floats bug
    By xerus in forum File Archive
    Replies: 10
    Last Post: 3rd February 2008, 11:59 AM
  5. Storing Decimals in an Array
    By Jellyhead365 in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 27th June 2007, 04:08 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
  •