unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: real-part frac
Date: Sat, 22 Nov 2003 06:56:09 +1000	[thread overview]
Message-ID: <87brr5qw46.fsf@zip.com.au> (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

             reply	other threads:[~2003-11-21 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-21 20:56 Kevin Ryde [this message]
2003-11-30  1:30 ` real-part frac Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87brr5qw46.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).