[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] From inexact to exact using the "-" procedure?
From: |
Jeronimo Pellegrini |
Subject: |
[Chicken-users] From inexact to exact using the "-" procedure? |
Date: |
Fri, 23 Mar 2012 16:37:06 -0300 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hello,
I'm not sure if this is a bug or a feature:
#;1> (use numbers)
#;2> (define y (* 0.1 1+1i))
#;3> (define a (+ 1 y))
#;4> (define b (+ 2 y))
#;5> (- a b)
1.0
#;6> (exact? (- a b))
#f
That's what I expected... The imaginary part vanished,
but it's like doing (- 0.1 0.1) -- it's not exact!
Now...
#;7> (- 1+0.1i 2+0.1i)
-1
#;8> (exact? (- 1+0.1i 2+0.1i))
#t
Well, that's supposed to be exactly the same thing,
so why is it exact? Is this an optimization?
Thanks,
J.
- [Chicken-users] From inexact to exact using the "-" procedure?,
Jeronimo Pellegrini <=