public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "\"Jürgen Urban\"" <JuergenUrban@gmx.de>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, binutils@sourceware.org
Subject: Re: Support for MIPS r5900
Date: Sun, 20 Jan 2013 21:43:00 -0000	[thread overview]
Message-ID: <20130120214241.59480@gmx.net> (raw)
In-Reply-To: <alpine.DEB.1.10.1301172232280.4834@tp.orcam.me.uk>

Hello Maciej,

> > I tested the calculation with the type "float".
> > ABI o32 with -mhard-float and -msingle-float produces the following
> results:
> > 1.000000 (0x3f800000) / 0.000000 (0x00000000) = nan (0x7fffffff)
> > 0.000000 (0x00000000) / 0.000000 (0x00000000) = nan (0x7fffffff)
> > 0.000000 (0x00000000) / nan (0x7fc00000) = 0.000000 (0x00000000)
> > 1.000000 (0x3f800000) + 1.000000 (0x3f800000) = 2.000000 (0x40000000)
> > 1.000000 (0x3f800000) + inf (0x7f800000) = inf (0x7f800000)
> > inf (0x7f800000) + inf (0x7f800000) = nan (0x7fffffff)
> > inf (0x7f800000) + -inf (0xff800000) = 0.000000 (0x00000000)
> > nan (0x7fc00000) + nan (0x7fc00000) = nan (0x7fffffff)
> > nan (0x7fc00000) + nan (0xffc00000) = 0.000000 (0x00000000)
> > 
> > The r5900 manual calls the result of 0/0 Fmax. So 0x7fffffff seems to be
> Fmax.
> 
>  So presumably you can get 0x7fffffff as an arithmetic result of a 
> calculation involving regular numbers as well, right?  Say 0x7f7ffffe + 
> 0x74000000 (using the binary-encoded notation)?  That would be beyond the
> IEEE-754 single range.

The FPU of the r5900 calculates the following:
340282306073709652508363335590014353408.000000 (0x7f7ffffd) + 40564819207303340847894502572032.000000 (0x74000000) = 340282346638528859811704183484516925440.000000 (0x7f7fffff)
340282326356119256160033759537265639424.000000 (0x7f7ffffe) + 40564819207303340847894502572032.000000 (0x74000000) = inf (0x7f800000)
340282346638528859811704183484516925440.000000 (0x7f7fffff) + 40564819207303340847894502572032.000000 (0x74000000) = inf (0x7f800000)
inf (0x7f800000) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7f800001)
nan (0x7f800001) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7f800002)
nan (0x7f900000) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7f900001)
nan (0x7f900001) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7f900002)
nan (0x7ffffff1) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7ffffff2)
nan (0x7ffffffc) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7ffffffd)
nan (0x7ffffffd) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7ffffffe)
nan (0x7ffffffe) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7fffffff)
nan (0x7fffffff) + 40564819207303340847894502572032.000000 (0x74000000) = nan (0x7fffffff)

So it seems that it interprets nan and inf as normal numbers, but it stops at 0x7fffffff. So 0x7fffffff should be interpreted as overflow.

Best regards
Jürgen

  parent reply	other threads:[~2013-01-20 21:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 22:57 "Jürgen Urban"
2013-01-07 17:15 ` Jeff Law
2013-01-07 20:44   ` Richard Sandiford
2013-01-07 21:52 ` Richard Sandiford
2013-01-08  0:23   ` Maciej W. Rozycki
2013-01-08  7:28     ` Richard Sandiford
2013-01-08 17:24       ` Maciej W. Rozycki
2013-01-08 18:25         ` Richard Sandiford
2013-01-08 22:34     ` "Jürgen Urban"
2013-01-10 23:25       ` Maciej W. Rozycki
2013-01-11  9:49         ` Richard Sandiford
2013-01-11 16:55           ` Maciej W. Rozycki
2013-01-13 14:16         ` "Jürgen Urban"
2013-01-14 18:42           ` Maciej W. Rozycki
2013-01-17 22:21             ` "Jürgen Urban"
2013-01-17 23:23               ` Maciej W. Rozycki
2013-01-19 10:53                 ` Richard Sandiford
2013-01-20 21:43                 ` "Jürgen Urban" [this message]
2013-01-08  4:22   ` Jeff Law
2013-01-08  7:22     ` Richard Sandiford
2013-01-08 22:49       ` "Jürgen Urban"
2013-01-09  5:25         ` Jeff Law
2013-01-10 22:59           ` "Jürgen Urban"
2013-01-11  4:41             ` Jeff Law
2013-01-08  7:16   ` Richard Sandiford
2013-01-08 21:30   ` "Jürgen Urban"

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=20130120214241.59480@gmx.net \
    --to=juergenurban@gmx.de \
    --cc=binutils@sourceware.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=macro@codesourcery.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).