Re: Floating point issue in sbcl 1.0.10?



<steven.w.levine@xxxxxxxxx> wrote:

What would you expect as a result? Think about it.

Well, I would expect 1229.99, wouldn't you?

Not really.

This is the result every other language I've used would return. (I just
checked several to confirm -- C, Fortran, perl, R, APL).

int main (int argc, const char * argv[])
{
float n1 = 1234.56;
float n2 = 4.57;

printf("%f\n", n1 - n2);
return 0;
}

prints: 1229.990112

Even my free piece-of-junk solar calculator can get the "correct" answer.

What precision floating-point does it use? Might it be using BCD?

If this is a floating point nuance as you claim, and is the expected
answer, then perhaps I need to reevalulate learning lisp -- it may not be
suitable for my needs.

The problem doesn't appear to be with Lisp.
.



Relevant Pages