Results 1 to 7 of 7

Thread: [RESOLVED] Double variables

  1. #1

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Resolved [RESOLVED] Double variables

    Hi people.

    I might have to do some more debugging on my code but... based on some tests, I'm having strange behabiours with "doubles".

    I thought that this might be a general known "issue" and someone would bring up the main causes of that.

    My problem is that if I do simple calculations, I end up with a trailing decimal at the 10th position of so.

    Exemple: 27.8 - 27.7 will sometimes equal "0.100000000001"

    I cound fix my problem my doing round(var,3), but this is just "patching", I don't like it quite much

    any idea?

    Thanks
    Chris

  2. #2

  3. #3

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Re: Double variables

    I see. I usually need 3-4 decimals, not more. I'll have to check how many decimals "currency" allows.

    Than you're suggesting to use currency, whatever the data I'm dealing with? In my case, it's not currency but quantities, I believe it makes no difference.

    Thank you.
    Chris

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Double variables

    Quote Originally Posted by Krass
    I see. I usually need 3-4 decimals, not more. I'll have to check how many decimals "currency" allows.

    Than you're suggesting to use currency, whatever the data I'm dealing with? In my case, it's not currency but quantities, I believe it makes no difference.

    Thank you.
    I actually updated my post while you were posting to say that you can use up to 4 decimal places, and it doesn't matter if it's not actual currency.

  5. #5

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Re: Double variables

    Well that might solve quite a few problems on my side. Thanks for your quick input.
    Chris

  6. #6

  7. #7

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Re: [RESOLVED] Double variables

    Yes I've been told this a couple of times. The thing is I don't care much about spams getting to THAT hotmail. And I like it when people pops in my live messenger for some coding chat.
    Chris

Posting Permissions

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



Click Here to Expand Forum to Full Width