On Fri, Mar 23, 2012 at 04:37:06PM -0300, Jeronimo Pellegrini wrote: > 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
With numbers trunk: #;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 trunk: #;7> (- 1+0.1i 2+0.1i) -1.0 #;8> (exact? (- 1+0.1i 2+0.1i)) #f > Well, that's supposed to be exactly the same thing, > so why is it exact? Is this an optimization? It's a bug. There are many, many bugs in the current release of the numbers egg. I'm working hard on a new release, which should be done soonish. In the meanwhile, could you please use numbers trunk? It would be very helpful to actually have users testing it before I make yet another broken release :) Quoting from another mail I posted to chicken-hackers yesterday: "I know these fixes have been a long time coming, and I'm sorry that it's taking so long, however I hope to tag a new "numbers" release soonish. There have been many many bugs fixed in this new version, and it will include (*limited*) support for extended number syntax in _compiled_ code. Along with this, it will include a types database to support scrutiny/specialization so that at least for flonum operations things will be as fast as core Chicken, and it will help to find bugs in code much easier when compiling. Thanks to Felix for pushing me to support this and developing the initial types database! I will make a release once I've convinced myself that the numbers database is complete and correct. This will probably involve extending the test suite some more (as I've been doing the past two weeks)." You can get the trunk version of numbers like this: $ svn co --username anonymous --password '' \ https://code.call-cc.org/svn/chicken-eggs/release/4/numbers/trunk numbers $ cd numbers $ chicken-install I'm truly sorry for the inconvenience! Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users