unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Complex, exact numbers
@ 2010-09-26 22:00 Mike Gran
  2010-09-27 20:27 ` Andy Wingo
  2010-09-27 21:02 ` Neil Jerram
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Gran @ 2010-09-26 22:00 UTC (permalink / raw)
  To: guile-devel

Hi all-

Should a number be able to be both complex and exact?

The R6RS isn't helpful in answering this question.  It says
"A number object is exact if it is the value of an exact 
numerical literal or was derived from exact number objects
using only exact operations.  Exact number objects correspond
to mathematical numbers in the obvious way."

$ meta/guile -c "(write 0+i) (newline)"
> 0.0+1.0i

$ meta/guile -c "(write #e0+i) (newline)"
> ERROR: In procedure inexact->exact:
> ERROR: Wrong type argument in position 1: 0.0+1.0i

Thanks,

Mike




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Complex, exact numbers
  2010-09-26 22:00 Complex, exact numbers Mike Gran
@ 2010-09-27 20:27 ` Andy Wingo
  2010-09-27 20:47   ` Mike Gran
  2010-09-27 21:02 ` Neil Jerram
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2010-09-27 20:27 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-devel

On Mon 27 Sep 2010 00:00, Mike Gran <spk121@yahoo.com> writes:

> Should a number be able to be both complex and exact?

It can be in theory. However in Guile complex numbers are always
inexact.

Do you need exact complex numbers? It's probably possible to
implement, but I don't know of any use for them.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Complex, exact numbers
  2010-09-27 20:27 ` Andy Wingo
@ 2010-09-27 20:47   ` Mike Gran
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Gran @ 2010-09-27 20:47 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel



> From: Andy Wingo <wingo@pobox.com>
> On Mon 27 Sep 2010 00:00, Mike Gran <spk121@yahoo.com> writes:
> 
> > Should a number be able to be both complex and exact?
> 
> It can be in theory. However in Guile complex numbers are always
> inexact.
> 
> Do you need exact complex numbers? It's probably possible to
> implement, but I don't know of any use for them.
> 

I don't need them.  I was just curious.

I updated a script I had to try to exercise all possible
number, character, identifier and string branches in a R6RS parser.
I used it to examine the parsing differences between Guile-1.8.x,
Guile-1.9.x, and MzScheme, which was rather amusing.  The exact,
complex number is partially implemented by MzScheme.

Thanks,

Mike



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Complex, exact numbers
  2010-09-26 22:00 Complex, exact numbers Mike Gran
  2010-09-27 20:27 ` Andy Wingo
@ 2010-09-27 21:02 ` Neil Jerram
  1 sibling, 0 replies; 4+ messages in thread
From: Neil Jerram @ 2010-09-27 21:02 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-devel

Mike Gran <spk121@yahoo.com> writes:

> Hi all-
>
> Should a number be able to be both complex and exact?

Mathematically, I'd say yes.

To argue against, you'd have to argue that i is (for some reason)
inexact, and I can't see any reason for that.

      Neil



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-27 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26 22:00 Complex, exact numbers Mike Gran
2010-09-27 20:27 ` Andy Wingo
2010-09-27 20:47   ` Mike Gran
2010-09-27 21:02 ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).