unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* real-part frac
@ 2003-11-21 20:56 Kevin Ryde
  2003-11-30  1:30 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2003-11-21 20:56 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

Is there a reason for real-part to return a flonum when given a
fraction?  Eg. (real-part 1/2) => 0.5.

With exact fractions I might have expected to get back the fraction
unchanged, the same way an exact integer is returned unchanged.


[-- Attachment #2: numbers.c.real-frac.diff --]
[-- Type: text/plain, Size: 388 bytes --]

--- numbers.c.~1.215.~	1970-01-01 10:00:01.000000000 +1000
+++ numbers.c	2003-11-21 16:43:46.000000000 +1000
@@ -4972,7 +4972,7 @@
   else if (SCM_COMPLEXP (z))
     return scm_make_real (SCM_COMPLEX_REAL (z));
   else if (SCM_FRACTIONP (z))
-    return scm_make_real (scm_i_fraction2double (z));
+    return z;
   else
     SCM_WTA_DISPATCH_1 (g_real_part, z, SCM_ARG1, s_real_part);
 }

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

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

* Re: real-part frac
  2003-11-21 20:56 real-part frac Kevin Ryde
@ 2003-11-30  1:30 ` Marius Vollmer
  0 siblings, 0 replies; 2+ messages in thread
From: Marius Vollmer @ 2003-11-30  1:30 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> Is there a reason for real-part to return a flonum when given a
> fraction?

No, please apply your patch.  Thanks!

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2003-11-30  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-21 20:56 real-part frac Kevin Ryde
2003-11-30  1:30 ` Marius Vollmer

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).