All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Seward <jseward@acm.org>
To: qemu-devel@nongnu.org
Cc: "J. Mayer" <l_indien@magic.fr>
Subject: Re: [Qemu-devel] [PATCH] softfloat missing functions
Date: Mon, 19 Mar 2007 20:37:55 +0000	[thread overview]
Message-ID: <200703192037.55757.jseward@acm.org> (raw)
In-Reply-To: <1174291106.24702.9.camel@rapid>


> Note that float64_to_uint64 functions are not correct, as they won't
> return results between INT64_MAX and UINT64_MAX. Hope someone may know
> the proper solution for this.

How about this?

J

uint64_t float64_to_uint64 (float64 a STATUS_PARAM)
{
    uint64_t res;
    int64_t v;

    if (isinf(a) || isnan(a)) {
       return special value (  maybe 1<<63 ?)
    }
    else
    if (a < 0.0 || a > (float64)UINT64_MAX) {
       return out-of-range value, whatever that is
    } else {

       a += (float64) INT64_MIN;  // move a downwards 
       v = llrint(a);             // convert
       v -= INT64_MIN;            // move v back up

       return v;
    }
}

  reply	other threads:[~2007-03-19 20:42 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 [this message]
2007-03-19 21:10   ` J. Mayer
2007-03-19 22:53     ` Julian Seward
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=200703192037.55757.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.