>LOL...Jim?
>
>Something about floating point math, blah blah.

Hey... don't look at me!  ;^)

It has something to do with an inability for certain numbers to be exactly 
represented in binary.  I don't believe the number 12.95 can actually be 
converted as it is to binary.

You can see this in Windows Calculator (swith to the "Scientific" view).  Type 
in "12.95" then hit "bin" (to convert to binary).  You get "1100".  Now hit 
"Dec" (to convert back to decimal) you get "12"!  Binary can't deal with 
fractions.

So floating point math attempts to get around this problem by moving the point 
around, doing the math without decimals and then trying to get the point back 
where it belongs.

It's all voodoo - but it's very, very fast.  Integer math ("real" math) is very 
hard for most computers to do - it sends their binaries panties into a twist.

By the way - concerning possible browser inconsistency - here's a nice little 
function I found someplace (I didn't write it but can't remember who did):

if (!Number.toFixed){
  Number.toFixed = function (x) {
    var temp = this;
    temp=Math.ceil(temp*Math.pow(10,x))/Math.pow(10,x);
    return temp;
  }
}

Essentailly if the "toFixed()" doesn't exist in the version of JavaScript 
you're using this adds it.

I wonder if this would work in ActionScript...

Jim Davis

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:5:160170
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to