unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Llorens <daniel.llorens@bluewin.ch>
To: 13905@debbugs.gnu.org
Subject: bug#13905: (max inexact exact) => always inexact?
Date: Fri, 8 Mar 2013 13:43:15 +0100	[thread overview]
Message-ID: <75E5F130-E4B6-49CF-9937-CF2D153B494C@bluewin.ch> (raw)


Not necessarily a bug, but I'd like to hear some thoughts on this.

In current Guile

(max -inf.0 9) => 9.0

The manual says

> R5RS requires that, with few exceptions, a calculation involving inexact numbers always produces an inexact result [...] The only exception to the above requirement is when the values of the inexact numbers do not affect the result. For example (expt n 0) is ‘1’ for any value of n, therefore (expt 5.0 0) is permitted to return an exact ‘1’.

In fact, in current Guile

(expt 5.0 0) => 1

although (!)

(* -1.0 0) => 0.0

Anyway.

R5RS says specifically for max / min

> If any argument is inexact, then the result will also be inexact (unless the procedure can prove that the inaccuracy is not large enough to affect the result, which is possible only in unusual implementations).

Certainly, there are calculations that return -inf.0 when done with inexact arithmetic that would have returned {hugely negative exact number} if done with exact arithmetic. In this sense, the condition above doesn't hold. That doesn't justify (max -inf.0 9) => 9.0 either, of course.

My interest in this is that I don't want

(fold max -inf.0 exact-number-list)

to return an inexact number. I also find inconvenient that max doesn't return one of its arguments even though there's no NaN involved.

I've checked mzscheme and it does as Guile here.

Regards

	Daniel






             reply	other threads:[~2013-03-08 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-08 12:43 Daniel Llorens [this message]
2013-03-08 18:44 ` bug#13905: (max inexact exact) => always inexact? Mark H Weaver
2013-03-08 18:59 ` Mark H Weaver
2013-03-08 19:19   ` Daniel Llorens

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=75E5F130-E4B6-49CF-9937-CF2D153B494C@bluewin.ch \
    --to=daniel.llorens@bluewin.ch \
    --cc=13905@debbugs.gnu.org \
    /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).