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


Groups > comp.lang.c > #103588

Re: The required minimum omega for double

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c, comp.lang.c++
Subject Re: The required minimum omega for double
Date 2017-02-10 01:15 +0000
Organization A noiseless patient Spider
Message-ID <87wpcy4zi1.fsf@bsb.me.uk> (permalink)
References <double-20170210014149@ram.dialup.fu-berlin.de>

Cross-posted to 2 groups.

Show all headers | View raw


ram@zedat.fu-berlin.de (Stefan Ram) writes:

> Newsgroups: comp.lang.c,comp.lang.c++
>
> #include <float.h>
>
>   Some implementations have this property:
>
>   A double has at least 14 significant digits (about 14-16) and 
>
> 9007199254740991.

I.e. 2^53 - 1  or, in most C implementations these days

  (1llu << DBL_MANT_DIG) - 1

This works when FLT_RADIX is 2, but it need not be.

>   is the largest double value that can be added to 1.0
>   giving the "next" double value
>
> 9007199254740992.
>
>   (when one adds 1.0 again, the value will not change
>   anymore).
>
>   I don't know whether there is a common name for such a
>   value. I will call it (just for this post) "omega".
>   (In the above example, the omega is 9007199254740991.)
>
>   Now, the standard does not require 14 significant
>   digits, but 10 (DBL_DIG).
>
>   I wonder whether one can somehow find the smallest
>   omega for the type double that is required by the
>   standard.

I don't think you can get more than an approximation to it and probably
quite a crude one at that.  The standard does not give minimum values
for DBL_MANT_DIG as you have no doubt found out already.

<snip>
-- 
Ben.

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: The required minimum omega for double Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-10 01:15 +0000
  Re: The required minimum omega for double Robert Wessel <robertwessel2@yahoo.com> - 2017-02-09 23:58 -0600
    Re: The required minimum omega for double scott@slp53.sl.home (Scott Lurndal) - 2017-02-10 14:57 +0000
      Re: The required minimum omega for double Robert Wessel <robertwessel2@yahoo.com> - 2017-02-12 01:52 -0600
        Re: The required minimum omega for double scott@slp53.sl.home (Scott Lurndal) - 2017-02-14 13:39 +0000
          Re: The required minimum omega for double Robert Wessel <robertwessel2@yahoo.com> - 2017-02-14 08:02 -0600
            Re: The required minimum omega for double scott@slp53.sl.home (Scott Lurndal) - 2017-02-14 17:30 +0000
              Re: The required minimum omega for double Robert Wessel <robertwessel2@yahoo.com> - 2017-02-14 17:39 -0600
    Re: The required minimum omega for double Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-12 10:16 -0800
  Re: The required minimum omega for double Juha Nieminen <nospam@thanks.invalid> - 2017-02-13 07:33 +0000
    Re: The required minimum omega for double Robert Wessel <robertwessel2@yahoo.com> - 2017-02-13 04:07 -0600

csiph-web