What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Is my math (a bit) out here?

[?] Is my math (a bit) out here?
Author: Message:
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: [?] Is my math (a bit) out here?
http://en.wikipedia.org/wiki/Floating_point

This is because whatever programming language and data type you use treats your numbers as IEEE floats.  Floats are not exact by their nature; the linked article should explain why not.  If you are going to use floats you should remember to code your program logic to never do exact comparisons -- only "greater than" or "less than". 

If this is not acceptable, there are a few options.  Your programming language may offer a built-in BCD (binary coded decimal) type or there may be a suitable free or commercial class available.  If you are doing fixed point math, such as dealing with money, you can simply use integer types and represent the values using the smallest base unit (e.g. 115 cents instead of $1.15).

This post was edited on 02-26-2008 at 12:10 PM by Adeptus.
02-26-2008 12:10 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[?] Is my math (a bit) out here? - by Spunky on 02-26-2008 at 11:30 AM
RE: [?] Is my math (a bit) out here? - by Jesus on 02-26-2008 at 11:59 AM
RE: [?] Is my math (a bit) out here? - by Spunky on 02-26-2008 at 12:04 PM
RE: [?] Is my math (a bit) out here? - by Adeptus on 02-26-2008 at 12:10 PM
RE: [?] Is my math (a bit) out here? - by Spunky on 02-26-2008 at 12:27 PM
RE: [?] Is my math (a bit) out here? - by Patchou on 02-26-2008 at 10:23 PM
RE: [?] Is my math (a bit) out here? - by Spunky on 02-26-2008 at 11:02 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On