Re: Floating point issue in sbcl 1.0.10?
- From: wrf3@xxxxxxxxxxxxxxx (Bob Felts)
- Date: Tue, 30 Oct 2007 22:24:10 -0400
<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.
.
- References:
- Floating point issue in sbcl 1.0.10?
- From: steven . w . levine
- Re: Floating point issue in sbcl 1.0.10?
- From: Rainer Joswig
- Re: Floating point issue in sbcl 1.0.10?
- From: steven . w . levine
- Floating point issue in sbcl 1.0.10?
- Prev by Date: Re: Learning Lisp in Linux?
- Next by Date: Re: Floating point issue in sbcl 1.0.10?
- Previous by thread: Re: Floating point issue in sbcl 1.0.10?
- Next by thread: Re: Floating point issue in sbcl 1.0.10?
- Index(es):
Relevant Pages
|
|