|
From: Timothy J H. <tjh...@br...> - 2005-10-21 14:51:20
|
On Oct 20, 2005, at 5:28 AM, gk...@su... wrote:
> =EF=BB=BF(inexact->exact 7.4323)
> $1 =3D 7
>
> Is this correct?
In JScheme we have not implemented rational numbers so the only exact=20
numbers we have are integers.
Thus, this is the best we can do for the inexact->exact procedure.
If you want rationals you can import the SISC number system by putting=20=
the sisc.jar file in the classpath
and using
(load "using/siscnum.scm")
It would be a good idea to extend siscnum.scm to provide the correct=20
definition for inexact->exact and
exact->inexact, but we haven't done that yet.... Indeed we get the=20
following behavior
>
> [Timothy-Hickeys-Computer:clip/clip/smath] tim% java -cp=20
> jscheme.jar:sisc.jar jscheme.REPL
> JScheme 7.1 (8/3/04 10:50 PM) http://jscheme.sourceforge.net
> > (load "using/siscnum.scm")
> #t
> > (q "1/5")
> 1/5
> > (* (q "3/14") (q "7/81"))
> 1/54
> > (inexact->exact 1.1)
> 1
> > (exact->inexact (q "1/3"))
>
> (exact->inexact (q "1/3" ))
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> SchemeException: expected object of type real number, but got: , "1/3"
> > (.getClass (q "1/5"))
> class sisc.data.Quantity
> >
Best,
---Tim---
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,=20
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Jscheme-user mailing list
> Jsc...@li...
> https://lists.sourceforge.net/lists/listinfo/jscheme-user
|