[plt-scheme] fractions and decimals

From: Paul Schlie (schlie at attbi.com)
Date: Sun Jan 19 23:59:15 EST 2003

Or if preferred: (although "[]"s may be confused with scheme's syntax)

1/3    == 0.[3]
1/30   == 0.0[3]
1/300  == 0.00[3]
1/700  == 0.00[142857]

123_456_789/700 == 176_366.84[1_428_57]

(and "_" seem easier to type, and somewhat visually cleaner)

on 1/19/03 11:41 PM, Paul Schlie wrote:
>
> How about using "_" to denote the range of repeating digits in
> lieu of the previously suggested "..", like possibly the following:
> 
> 0.0000_142857_ (which is closer to the notion of an over-bar)
> 
> Actually it would be nice to generally allow "_" to denote the visual
> separation of digits; where if the number is terminated with a "_",
> then the digits between the most previous "." or "_" are repeated; and
> other occurrences of "_" are simply ignored, or inserted if desired
> as on output format preference at every N digits of significance.
> (where 3 for decimal, 4 for hex/binary, etc. may make sense, as
> numbers with many digits of significance are hard to read and write.)
> 
> 1/3    == 0.3_
> 1/30   == 0.0_3_
> 1/300  == 0.00_3_
> 1/700  == 0.00_142857_
> 
> With "_" used as a visual separator with a terminating repeat:
> 
> 123_456_789/700 == 176_366.84_142857_
> 
> (actually kind of like this better than the earlier suggested baby ellipse)
> 
> -paul-
> 
> on 1/19/03 9:38 PM, Robert Bruce Findler wrote:
>> 
>> I must say (not being the one to implement it :) that I really like the
>> idea of useing ... to indicate the overbar in DrScheme, but how do you
>> notate those rationals whose expansion includes multiple repeated
>> digits, like 1/70000:
>> 
>> 0.0000142857
>>   ^^^^        nonrepeating
>>       ^^^^^^  repeating
>> 
>> Robby
>> 
>> At Sun, 19 Jan 2003 21:00:23 -0500, Paul Schlie wrote:
>>>   For list-related administrative tasks:
>>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>> 
>>> Wonder if broadly adopting the convention that decimals terminated with a
>>> zero (0), would be interpreted as an inexact number, otherwise considered
>>> exact; would help unify the two worlds; (little fancier would be to
>>> interpret ".." as an exact repeating input pattern, although not sure how
>>> to reliably convert it into an exact fractional internal representation.
>>> 
>>> 1      == 1      ; exact
>>> 1.0    == 1.0    ; inexact
>>> 
>>> 0.125  == 1/8    ; exact
>>> 0.1250 == 0.1250 ; inexact
>>> 
>>> 0.3..  == 1/3    ; exact
>>> 0.33   == 33/100 ; exact
>>> 0.3330 == 0.3330 ; inexact
>>> 
>>> Such if decimal outputs are specified as being preferred:
>>> 
>>> 1/8    => 0.125  ; exact to the specified decimal precision.
>>> 0.125  => 0.125  ; exact to the specified decimal precision.
>>> 0.1250 => 0.1250 ; inexact to the specified decimal precision.
>>> 
>>> 1/3    => 0.3..  ; exact to the specified decimal precision.
>>> 0.33   => 0.33   ; exact to the specified decimal precision.
>>> 0.3330 => 0.3330 ; inexact to the specified decimal precision.
>>> 
>>> Or if fractional output were specified as being preferred:
>>> 
>>> 1/8    => 1/8    ; exact to the specified decimal precision.
>>> 0.125  => 1/8    ; exact to the specified decimal precision.
>>> 0.1250 => 0.1250 ; inexact to the specified decimal precision.
>>> 
>>> 1/3    => 1/3    ; exact to the specified decimal precision.
>>> 0.3..  => 1/3    ; exact to the specified decimal precision.
>>> 0.33   => 33/100 ; exact to the specified decimal precision.
>>> 0.3330 => 0.3330 ; inexact to the specified decimal precision.
>>> 
>>> (where ".." would be replaced with an over-bar within DrScheme, but
>>>  copied to the clipboard as "..", to enable a successive pastes)
>>> 
>>> Which overall seems reasonably nice and simple,
>>> 
>>> -paul-
>> 



Posted on the users mailing list.