12 Nov 1993 10:36
25 Nov 1993 09:18
Possible bug ?
Harald Loeffler <loefflhd <at> trick.informatik.uni-stuttgart.de>
1993-11-25 08:18:56 GMT
1993-11-25 08:18:56 GMT
Hello guys ! I have a question about how to get a number of the typ "real" All my procedures give me figures like : 345534654365436/3245324663346 Is this normal ? I don't think so, because in other scheme-implementations I can fix this problem by multiplikating the number with 1.0. I hope you can help me. Thanks Harald Loeffler
25 Nov 1993 16:05
Possible bug ?
<kelsey <at> research.nj.nec.com>
1993-11-25 15:05:46 GMT
1993-11-25 15:05:46 GMT
From: Harald Loeffler <loefflhd <at> trick.informatik.uni-stuttgart.de>
Date: Thu, 25 Nov 93 09:18:56 +0100
I have a question about how to get a number of the typ "real"
All my procedures give me figures like : 345534654365436/3245324663346
Is this normal ? I don't think so, because in other scheme-implementations
I can fix this problem by multiplikating the number with 1.0.
The current version of Scheme 48 does not have floating point numbers.
Real numbers are represented as inexact rational numbers:
> 23/10
23/10
> #i23/10
2.3
>
You can make numbers look more as you might expect:
> (define precision 10000000)
> (define (print-as-float x)
(display (exact->inexact (/ (quotient (* precision (numerator x))
(denominator x))
precision))))
> (begin (print-as-float 345534654365436/3245324663346) (newline))
106.4715214
>
(Continue reading)
RSS Feed