From: Geoff Keating <geoffk@geoffk.org>
To: Roger Sayle <roger@eyesopen.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Question on valid transformations for cbrt
Date: Fri, 02 Apr 2004 00:22:00 -0000 [thread overview]
Message-ID: <jmfzbn2pq1.fsf@desire.geoffk.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0403070640560.29012-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> writes:
> i.e. cbrt(-29.7) = -3.1 but pow(-29.7,1.0/3.0) => EDOM.
one reason for this is because 1.0 / 3.0, as a double, gets rounded to
6004799503160661 / 2 ^ 54, and so the result of the pow() is imaginary
and not representable as a 'double'. (If we'd used base-3 arithmetic,
pow() could always provide a result with negative inputs.)
(This also means the same transformations with sqrt() will usually be
safe.)
--
- Geoffrey Keating <geoffk@geoffk.org>
prev parent reply other threads:[~2004-04-02 0:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-06 18:54 Kaveh R. Ghazi
2004-03-07 15:11 ` Roger Sayle
2004-03-10 15:32 ` Segher Boessenkool
2004-03-10 16:06 ` Robert Dewar
2004-04-02 0:22 ` Geoff Keating [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jmfzbn2pq1.fsf@desire.geoffk.org \
--to=geoffk@geoffk.org \
--cc=gcc@gcc.gnu.org \
--cc=roger@eyesopen.com \
/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).