TWiki> ISG Web>ISGScripts>Testing>BitterSuite>BitterSuiteScheme>SchemeRationalNumbers (2010-11-12, TerryVaskor) EditAttach

It is **very** important to be careful about specifying non-integer numbers in Scheme.
In the teaching language, most people get used to representing rational numbers in “decimal notation”;
that is, in a fashion such that `1.1`

and `11/10`

both refer to exactly the same number.

In the module language, this is not the case.
Any number specified in “decimal notation” will be interpreted as an inexact
number (floating point), which is no longer an exact representation of the value and is
subject to a host of problems that come from truncation. This means that `1.1`

and `11/10`

are no longer the same, and will not be compared as such if passed to `equal?`

;
the first is an inexact number, but the second is an exactly specified rational.

This means that great care must be taken not to specify any “decimal notation”
as a general rule
(for example, in any `options.ss`

files or in any BitterSuiteScheme modules)
unless an inexact number is actually desired.
It is almost always the case that any non-integer numbers should be expressed in a rational fashion.

I believe this issue should be fixed now because of a change to the settings of the Scheme reader. Somebody please confirm if this is the case and adjust this page accordingly...

-- TerryVaskor - 12 Nov 2010

Edit | Attach | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions

Topic revision: r2 - 2010-11-12 - TerryVaskor

Copyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Ideas, requests, problems regarding TWiki? Send feedback

Ideas, requests, problems regarding TWiki? Send feedback