On Feb 6, 9:00 am, Julien Puydt <julien.pu...@laposte.net> wrote: > ...
> 0.0 is a range of numbers, and zero is in that range, and I think they > shouldn't be considered equal. That is your opinion. People have other opinions. Some programming languages implement 0.0 numerically equal to (integer) 0. For example, ANSI standard common lisp. Ordinarily, object equality would work only for items of the same type, though inheritance and such muddies the water. I think that numerical analysts' most useful view is that the floating point number 0.0 is a representation of the exact number zero, and no other number or range. The view that floats are ranges leads to a host of really bad designs. Like, can you construct an interval as a pair of floats? Uh, no, because the upper and lower bounds are themselves floats, which are themselves intervals... > > I know most compilers/interpreters in most languages will tell > otherwise, but it is a lie, That is your opinion, and not commonly shared by persons skilled in the art. > and some languages *do* refuse such > comparisons, so the idea isn't unhelpful ; it's a design choice that > others made. I am not aware of any programming languages that refuse to test for equality of floating-point numbers. It is a useful operation in some cases, e.g. did an iterative refinement leave a floating-point number unchanged? Time to exit the loop. > > Even if the ARM eglibc has precision issues, the fact that sage makes > float computations then tests with an equality is still wrong (worse, > it's converting them to strings then testing that for equality!) I expect that Sage (and Sage testing) does a large number of things wrong. There is a large literature on testing of numerical software, and I daresay that none of it suggests converting numbers to strings to test for equality. >: that > makes those tests portable essentially to x86_64/linux, x86_64/mosx, > x86_64/win32... > > > I suggest you become better informed on the topic. > > I'm conscious of the difference between an exact computation > and a numerical computation, which I think is a pretty good start, even > if I admit (again) it isn't perfect. You may be mistaken in your understanding. > > > In order to keep this note from being complete snark, > > I chose my nickname years ago in reference to "The hunting of the > snark", by Lewis Carroll (see [1]); and since I'm not a native english > speaker, I wasn't (back then) even aware of the word/meaning you just > used. Now I do know it, and I find you choice of words quite petty. Quite petty? How kind of you. In referring to my own comments as snark, I was characterizing them as sarcastic/abusive. > > > let me suggest > > you (and others concerned about these matters look at this) > >http://www.cims.nyu.edu/~dbindel/class/cs279/dsb-bib.pdf > > It is a nice list of references ; if you could have a look at [2], I > think you would see that the problem isn't as simple as you think it > is. The first two paragraphs will be enough. I am well aware of the distinction between the precision of a double- float and a double-float-extended. That does not alter the fact that 0.0 in double or double-extended is numerically equal to 0. For a dissertation on the problems caused by the interaction of language designers, compilers and arithmetic systems that either allow or forbid double- extended and its affect on programming language implementation, see http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf If the tests are performed all on the same machine with the same arithmetic, it would make sense to check various identities such as sin^2+cos^2==1, or gamma(5.0)==24.0 rather than reading in a text string. > > Still, I'm glad you think the problem is trivial/doesn't exist : that > means you'll be able to provide a nice patch real soon. > > Looking forward for your fix, thanks for your suggestions, I wasn't offering a patch. The problem is a PICNIC. == Problem in Chair not in Computer. RJF > > Snark on #sagemath > > [1]http://en.wikipedia.org/wiki/The_Hunting_of_the_Snark > [2]http://www.network-theory.co.uk/docs/gccintro/gccintro_70.html -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org