Harald Loeffler | 12 Nov 10:36 1993
Picon
Picon

(unknown)

Attachment: application/octet-stream, 103 bytes
Harald Loeffler | 25 Nov 09:18 1993
Picon
Picon

Possible bug ?

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

kelsey | 25 Nov 16:05 1993
Picon

Possible bug ?


   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
  >

Scheme 48 will eventually include floating point numbers.

                                     -Richard Kelsey


Gmane