seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

error in log #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run:

(import (rnrs))

(define R make-rectangular)
(define (B m e) (* m (expt 2 e)))

(write (log (expt 2 1024)))
(newline)

(write (R (B #x162E42FEFA39F -39) 0.))
(newline)
(newline)

What is the expected output? What do you see instead?
It should print the same value twice (approx), the one given at
http://www.wolframalpha.com/input/?i=log(2+^+1024).  It prints different
values.

What version of the product are you using? On what operating system?
Mosh R6RS scheme interpreter, version 0.2.5 (revision master 
mosh-0.2.5-4-g7e4bbd8dirty). i686-pc-linux-gnu.

Original issue reported on code.google.com by mrc....@gmail.com on 31 May 2010 at 7:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi.

Fixed on my local.

The following results is what you expected?

  (log (expt 2 1024)) => 709.782712893384

  (R (B #x162E42FEFA39F -39) 0.) => 390207173010335/549755813888+0.0i

  (inexact 390207173010335/549755813888) => 709.7827128933841

On the other hand Ypsilon returns follows.

  (R (B #x162E42FEFA39F -39) 0.) => 709.7827128933841+0.0i

The result of make-rectangular should be inexact?, when one argument is inexact 
and 
the 
other is exact.
I've searched R6RS, but not sure about the result.

Cheers.

Original comment by hige...@gmail.com on 31 May 2010 at 7:49

GoogleCodeExporter commented 9 years ago
>The following results is what you expected?
>
>  (log (expt 2 1024)) => 709.782712893384
>
>  (R (B #x162E42FEFA39F -39) 0.) => 390207173010335/549755813888+0.0i
>
>  (inexact 390207173010335/549755813888) => 709.7827128933841

Yes.

> The result of make-rectangular should be inexact?,
> when one argument is inexact and the  other is exact.

I have no clear idea either.  However keeping exactness when possible looks 
fine.

Original comment by mrc....@gmail.com on 31 May 2010 at 8:36

GoogleCodeExporter commented 9 years ago
Thanks commited.

http://github.com/higepon/mosh/commit/b4751c8da3e13029ff5a51152043695824f685f7

Original comment by hige...@gmail.com on 31 May 2010 at 12:32