[squeak-dev] The Inbox: Kernel-dtl.639.mcz
David T. Lewis
lewis at mail.msen.com
Sat Oct 15 13:43:48 UTC 2011
On Sat, Oct 15, 2011 at 01:35:26PM +0000, commits at source.squeak.org wrote:
> A new version of Kernel was added to project The Inbox:
> http://source.squeak.org/inbox/Kernel-dtl.639.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-dtl.639
> Author: dtl
> Time: 15 October 2011, 9:35:19.698 am
> UUID: b1253797-d31f-419d-99e5-3d274a1ea82f
> Ancestors: Kernel-nice.638
>
> As reported on Pharo list <http://code.google.com/p/pharo/issues/detail?id=4909>
> number parser does not attempt to interpret fractions.
>
> Fraction readFromString: '1/2' ==> 1
> '1/2' asNumber ==> 1
>
> Change parsers to look for $/ (no space) after first numeric input,
> and if present read additional input as fraction. No attempt is made
> to ensure integer valued numerator and denominator, instead just
> permit conversion to float.
>
> See #testFraction tests for expected behavior
>
> With this change:
>
> Number readFrom: '1/2' ==> (1/2)
> Number readFrom: '1 / 2' ==> 1
> Number readFrom: '2/1.6' ==> 1.25
> Number readFrom: '1.6/2' ==> 0.8
> Number readFrom: '1.6/3.2' ==> 0.5
> Number readFrom: '1.6e3/3.2e2' ==> 5.0
> Number readFrom: '13/10/2011' ==> (13/10) "a date is not a number"
I am not at all sure that this change is a good thing to do, but I put
it in the inbox for review.
Dave
More information about the Squeak-dev
mailing list
|