chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Why doesnot "(+ 1/2 1/3)" equal to 5/6 ?


From: Kon Lovett
Subject: Re: [Chicken-users] Why doesnot "(+ 1/2 1/3)" equal to 5/6 ?
Date: Wed, 7 Nov 2012 16:25:33 -0800

On Nov 7, 2012, at 4:17 PM, ".alyn.post." <address@hidden> wrote:

> On Wed, Nov 07, 2012 at 11:57:33PM -0000, z_axis wrote:
>> 
>>> (+ (+ 1/2 1/3)
>> 
>> Warning: cannot represent exact fraction - coerced to flonum: "1/2"
>> Warning: cannot represent exact fraction - coerced to flonum: "1/3"
>> 0.8333333333333331/2 1/3)
>> 
>> 
>> In racket, it is 5/6. And as i know it is 5/6 for any lisp implementation.

Oh, LISP is a much larger family. ;-)

>> 
>> 
>> Sincerely!
>> 
> 
> I suspect in Racket your above code is a syntax error.  ;-)
> 
> More seriously, try this:
> 
>  (use numbers)
>  (+ (+ 1/2 1/3))
> 
> That gives you the answer you expect.

But only if the numbers egg is installed:

        chicken-install -test numbers

Chicken does not support the full numeric tower by default. An extension must 
be used.

> 
> -Alan
> -- 
> .i ma'a lo bradi cu penmi gi'e du
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]