Indicating you know how Coldfusion works really proves nothing, I'm quite aware of how it all works. I'm just annoyed that Coldfusion doesn't deal with this situation better than it does.

Once again, _javascript_, although not strictly typed, is a typed language. If I could type in Coldfusion I would.

Also, Coldfusion should get this one right, but it doesn't <cfdump var="#1024.00-1024.10#"> returns -0.0999999999999

Cheers
Gareth.

Andrew Scott wrote:

Gareth,

 

I think you are missing the point, whether coldfusion is a typed language or not. The underlying technology of CF has a problem with what your asking.

 

Now just a fresher in how CF works for you, Coldfusion will always try to treat everything as a numerical value first if this throws an exception it is then treated as a string. Now because CF has that, that doesn’t mean that I see variable=1024-1024.1 and treat the example as you are asking why. Because of the problem that Ryan has stated to you, and it doesn’t matter what language you are in, it will be the same problem. If I write that in JS I should expect the same thing as your asking, but I know that there is a chance of that floating point rearing its ugly head.

 

And that Gareth is a fact of life as a program. Deal with it or move on,

 



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

 

From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Gareth Edwards
Sent: Tuesday, 20 February 2007 2:14 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Strange calculation behavior on CF 7.02

 

Who's missing my point? One shouldn't have to worry about typing in Coldfusion. If in an evaluation a decimal is found amongst integers, it should still calculate correctly. Whether it does this by making the other values decimals, I don't care, but Coldfusion is a plain English language, and it not typed, there for if one reads <cfdump var="#1024-1024.1#"> as -0.1 I think that is what coldfusion should return.

Cheers
Gareth.

Ryan Sabir wrote:

Here's a technote from Sun, regarding Java.. the underlying subsystem of ColdFusion:

 

http://java.sun.com/developer/JDCTechTips/2001/tt0807.html

 

I wouldn't expect this to be in the CF documentation. It's not Adobe's problem.


From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Gareth Edwards
Sent: Tuesday, 20 February 2007 1:42 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Strange calculation behavior on CF 7.02

Now.... you show me in the Coldfusion Documentation where this is outlined as a known issue?

Cheers
Gareth.

Ryan Sabir wrote:

 

Doesn't really matter why... Maybe there's a gremlin that lives in the last 0.0000000000015 of every floating point number. Every now and then he will wake up and mess up your number, and sometime's he'll stay asleep. Write your code expecting he might pop round for a visit, and he won't bother you.

 

If you really want to find out why, then you'll need to do some pretty hard core maths to work out how fractions are represented in binary. I prefer to leave that to the geeks who work at Intel and AMD while I get on with my work.


 


From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Gareth Edwards
Sent: Tuesday, 20 February 2007 1:11 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Strange calculation behavior on CF 7.02

So why the mixed result?

Cheers
Gareth.

Ryan Sabir wrote:

Just remembered I had a 6.1 server lying around. And yes it did the same thing:

 

0.1
0.1
0.1
0.0999999999985
0.0999999999985
0.1
0.0999999999985
0.1
0.1
0.0999999999985
0.1
0.0999999999985
0.0999999999985
0.0999999999985
0.1
0.1
0.1

 






 





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to