From: Julian Seward <jseward@acm.org>
To: "J. Mayer" <l_indien@magic.fr>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] softfloat missing functions
Date: Mon, 19 Mar 2007 22:53:40 +0000 [thread overview]
Message-ID: <200703192253.40834.jseward@acm.org> (raw)
In-Reply-To: <1174338614.24702.23.camel@rapid>
Thinking about this more, you ask "is this correct", but that
is only meaningful if you say what the specification is.
Correct relative to what?
> Yes, it seems to be the correct way, but thinking more about the
> problem, it appeared to me that the implementation could be even easier
> than yours. It seems to me that this may be sufficient:
> uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
> {
> int64_t v;
>
> v = llrint(a + (float64)INT64_MIN);
>
> return v - INT64_MIN;
> }
If a is NaN then so is the argument to llrint. 'man llrint' says:
If x is infinite or NaN, or if the rounded value is
outside the range of the return type, the numeric result
is unspecified.
So then float64_to_uint64 produces an unspecified result.
It seems to me much safer to test and handle NaN, Inf and
out-of-range values specially. However, even that does not help
unless you say what the specification is.
J
next prev parent reply other threads:[~2007-03-19 22:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-19 7:58 [Qemu-devel] [PATCH] softfloat missing functions J. Mayer
2007-03-19 20:37 ` Julian Seward
2007-03-19 21:10 ` J. Mayer
2007-03-19 22:53 ` Julian Seward [this message]
2007-03-19 23:13 ` J. Mayer
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=200703192253.40834.jseward@acm.org \
--to=jseward@acm.org \
--cc=l_indien@magic.fr \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).