Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6911

Re: higher precision doubles

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: higher precision doubles
Date 2011-08-09 14:00 +0200
Organization albasani.net
Message-ID <j1r7gn$8f1$1@news.albasani.net> (permalink)
References <j1hqc1$1ch$1@news.albasani.net> <cOqdnfXfM99lhaDTnZ2dnUVZ_vednZ2d@earthlink.com> <j1qdrt$30a$1@speranza.aioe.org> <soqdnRy-6cN1idzTnZ2dnUVZ_tidnZ2d@earthlink.com>

Show all headers | View raw


Patricia Shanahan schrieb:
>
> My understanding when strictfp was being added was that the x86
> instruction set allowed for efficient rounding to the correct 32 and 64
> bit mantissa widths, but did not allow for the overflow and underflow
> processing to be done based on the correct exponent widths.


The typical overflow example is:

   double x = Double.MAX_VALUE * 1.1 / 1.1;

When internally during an arithmetic expression evaluation
long double is used, Double.MAX_VALUE * 1.1 can be
fully represented thanks to the additional bits in mantissa
AND exponent. And eventually we would get back Double.MAX_VALUE
in x after rounding.

When internally no long doubles are used, then Double.MAX_VAlUE*1.1
gives already +inf or somesuch. Since Java does not throw an
exception, but is required to return some value. And then division
by 1.1 does not help anymore. Another example is the following:

  float f = Float.MAX_VALUE;
  float g = Float.MAX_VALUE;
  doube x = f * g;

https://www.securecoding.cert.org/confluence/display/java/NUM06-J.+Use+the+strictfp+modifier+for+floating-point+calculation+consistency+across+platforms

The above document is a little bit sloppy, since it mentions
only additional bits in the exponent. But 80bit doubles have
both, additional bits in the mantissa and in the exponent.
So differences might be more subtle.

Bye

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-06 00:20 +0200
  Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-06 03:35 -0700
    Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-06 13:03 +0200
      Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-06 12:20 -0700
        Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-06 23:30 +0200
          Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-06 16:12 -0700
            Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 01:35 +0200
              Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-06 19:26 -0700
    Re: higher precision doubles supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-08-09 00:42 -0400
      Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-09 04:07 -0700
        Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-09 14:00 +0200
          Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-09 09:07 -0700
            Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-10 08:50 +0200
        Re: higher precision doubles supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-08-10 20:16 -0400
      Re: higher precision doubles Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-09 10:11 -0500
        Re: higher precision doubles Arne Vajhøj <arne@vajhoej.dk> - 2011-08-09 22:40 -0400
          Re: higher precision doubles Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-09 22:06 -0500
            Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-10 08:53 -0700
  Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-06 21:24 +0200
    Re: higher precision doubles markspace <-@.> - 2011-08-06 13:29 -0700
      Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-06 23:20 +0200
        Re: higher precision doubles markspace <-@.> - 2011-08-06 15:43 -0700
          Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 01:06 +0200
            Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-06 16:21 -0700
              Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 01:34 +0200
                Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-06 21:32 -0700
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 17:24 +0200
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 17:39 +0200
                Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-07 09:26 -0700
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 21:23 +0200
                Re: higher precision doubles Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-07 20:48 -0400
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-08 09:05 +0200
                Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-08 05:37 -0700
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-08 19:08 +0200
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-08 19:16 +0200
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-08 19:29 +0200
                Re: higher precision doubles Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-08 21:34 -0500
                Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-08 13:49 -0700
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-09 01:08 +0200
                Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-09 02:44 -0700
                Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-09 12:52 +0200
                Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-09 13:15 -0700
                Re: higher precision doubles BGB <cr88192@hotmail.com> - 2011-08-07 13:51 -0700
              Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 01:59 +0200
        Re: higher precision doubles Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-08 21:03 -0500
    Re: higher precision doubles Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-06 17:33 -0400
    Re: higher precision doubles Patricia Shanahan <pats@acm.org> - 2011-08-06 14:51 -0700
      Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-08-07 00:57 +0200

csiph-web