[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread rod higgins
If you use the java class and methods that handle these types of numbers I don't see the problem?? #a#-#b#+#c# = #d# It seems CF is using some sort of toString() value during the calculation at some stage?? hth

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Steve Onnis
Do you get the same issue with punch cards? Maybe that's an option:P What is it your trying to do in the first place? Or were you just having an "I wonder what would happen if..." moment? Steve _ From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Robin Hill

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Robin Hilliard
On 20/02/2007, at 3:27 PM, Gareth Edwards wrote: > Sorry to complain about it, Don't worry, you were somewhat provoked over the course of the thread (I would recommend the more frequent posters on cfaussie buy a copy of "Parent Effectiveness Training" by Dr. Thomas R. Gordon ISBN 0609806939

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Andrew Scott
Restrict the decimal paces and force a round off! Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
What do you think would be the best way to work around the problem? Cheers Gareth. skateboard.com.au wrote: Our teacher gave us the low down on this issue in the first week of my C unit. You probably dont hear about it too much in CF land as its so losely typed. cheers Drew Peacock

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread skateboard.com.au
Our teacher gave us the low down on this issue in the first week of my C unit. You probably dont hear about it too much in CF land as its so losely typed. cheers Drew Peacock -Original Message- From: Gareth Edwards <[EMAIL PROTECTED]> To: cfaussie@googlegroups.com Date: Tue, 20 Feb

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Barry Beattie
to part answer that, what were you doing to bring this matter to your attention? On 2/20/07, Gareth Edwards <[EMAIL PROTECTED]> wrote: > > Sorry to complain about it, it just seems strange, I won't complain > anymore. Does it do the same thing in Actionscript? (don't have time to > check right

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
Sorry to complain about it, it just seems strange, I won't complain anymore. Does it do the same thing in Actionscript? (don't have time to check right now) What do you think is the best way to handle this in coldfusion? Also, I'm curious, how many people on this list are aware of this issue

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Robin Hilliard
Actually check out the last example in the "Addition" section of this article: http://en.wikipedia.org/wiki/Floating_point This is what we are seeing subtracting two similar numbers - the result of the subtraction winds up with a lot of leading 0s - then the exponent is adjusted to

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Andrew Scott
Gareth, Again you have been politely told it has nothing to do with Coldfusion, if you are aware how Coldfusion works under the hood, then accept that it is a know problem not a bug then deal with it and move on. Complaining about CF is not going to change the fact that Java has the issue a

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Robin Hilliard
It's easier to see the pattern without the random stuff and the extra additions and subtractions, note val() etc have nothing to do with it: #a# - #c# = #d# 1019 - 1019.1 = -0.1 1020 - 1020.1 = -0.1 1021 - 1021.1 = -0.1 1022 - 1022.1 = -0.1 1023 - 1023.1 = -0.1 1024 - 1024.

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
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

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Andrew Scott
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

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
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

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Ryan Sabir
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:[EMAIL PROTECTED] On Behalf

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
I think your missing the point Andrew... Coldfusion is not strongly typed, so one would assume that a simple calculation between a integer and a decimal would come back correctly. Cheers Gareth Andrew Scott wrote: Gareth,   You have been politely told that this is not a b

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Andrew Scott
Gareth, You have been politely told that this is not a bug, and it does occur on every know programming language that I have ever used. Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 From: cfaussie@googlegroups.com

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
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.00015 of every floating point number. Every now and then he w

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Ryan Sabir
Doesn't really matter why... Maybe there's a gremlin that lives in the last 0.00015 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 bothe

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
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.09985 0.09985 0.1 0.09985 0.1 0.1 0.09985 0.1 0.09985 0.09985 0.09

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Ryan Sabir
Just remembered I had a 6.1 server lying around. And yes it did the same thing: 0.1 0.1 0.1 0.09985 0.09985 0.1 0.09985 0.1 0.1 0.09985 0.1 0.09985 0.09985 0.09985 0.1 0.1 0.1 0.1 0.09985 0.1 There's lots of references to this com

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Brett Payne-Rhodes
AFAIK this has always been an issue. I usually deal with it by using integers where possible, as in store and calculate prices in cents not dollars - don't have much call for anything more complicated than that. B) Gareth Edwards wrote: > What about 7.01 or 7.00? or 6.1 or 6? CF5 is not a fai

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
What about 7.01 or 7.00? or 6.1 or 6? CF5 is not a fair comparison. Cheers Gareth. Ryan Sabir wrote: I just tried it on an old CF5 server and it did the same thing.   It's nothing to do with data typing. The underlying calculation to work out what X * 0.1 is, will always have

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Ryan Sabir
I just tried it on an old CF5 server and it did the same thing. It's nothing to do with data typing. The underlying calculation to work out what X * 0.1 is, will always have some degree of rounding error due to the way those numbers are stored in memory. From: cfaussie@googlegroups.com

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
It hasn't been a problem previously, why would it be a problem now? CFML is not a strong typed language and there for should evaluate situations like this correctly. Cheers Gareth. Ryan Sabir wrote: They looks like pretty standard floating point rounding errors. You get them in any progr

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Ryan Sabir
They looks like pretty standard floating point rounding errors. You get them in any programming language where you deal with fractions. The trick is to expect that this will happen and plan your application around it. > -Original Message- > From: cfaussie@googlegroups.com > [mailto:

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
Just an update... the new code below does the same thing.                         #a#-#b#+#c# = #d# Barry Beattie wrote: not having a working CF server handy at the moment to test, I'm just curious you're not getting grief with treating strings as numbers, are you? perhaps a

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
If it were a string, and it was having troubles the end result should be consistent. Check this out. 9314-18628+9314.1 = 0.1 4730-9460+4730.1 = 0.1 9913-19826+9913.1 = 0.1 3913-7826+3913.1 = 0.0 6770-13540+6770.1 = 0.1 3000-6000+3000.1 = 0.0 Cheers Gareth. Barry

[cfaussie] Re: Strange calculation behavior on CF 7.02

2007-02-19 Thread Barry Beattie
not having a working CF server handy at the moment to test, I'm just curious you're not getting grief with treating strings as numbers, are you? perhaps a val( "#ListFirst(Trim(a),".")#.00" ) is needed? just a quick thought b On 2/20/07, Gareth Edwards <[EMAIL PROTECTED]> wrote: > > If you are

[cfaussie] Strange calculation behavior on CF 7.02

2007-02-19 Thread Gareth Edwards
If you are running coldfusion 7.02, or maybe 7.01 or 7.0? (don't know) Run this script below, and tell me if you get the same results for each line. The way I see it, d should equal 0.1 on every row. But this isn't the case. Is this a bug introduced by Coldfusion 7.02?