Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #126462
| From | GOTHIER Nathan <nathan.gothier@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: What happened to short float? |
| Date | 2018-02-08 22:58 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <20180208225832.0fe90c05adfa88fcce7ceea9@gmail.com> (permalink) |
| References | (6 earlier) <ca738dea-8d44-4650-8a25-d67d44bdff2c@googlegroups.com> <20180208170417.6b4eb9764749db51883c29e1@gmail.com> <cfe89d9b-5cf6-4455-a985-5532fa927ec1@googlegroups.com> <20180208185253.edc9c5661a6197dd64f9cb02@gmail.com> <a1957c13-7f4c-4e89-a85e-11141ef67a7d@googlegroups.com> |
On Thu, 8 Feb 2018 11:27:51 -0800 (PST) jameskuyper@verizon.net wrote: > I don't agree. Based upon 5.2.4.2.2p11,12,13, and 16, here's a > comparison of the requirements for C float and double with the actual > characteristics of IEEE single and double precision formats: > > Feature |float| IEEE single |double| IEEE double > ================================================================ > _EPSILON |1E-5 | 0X1P-23F | 1E-9 | 0X1P-52 > _DECIMAL_DIG| 6 | 9 | 10 | 17 > _DIG | 6 | 6 | 10 | 15 > _MIN |1E-37| 0X1P-126F | 1E-37| 0X1P-1022 > _TRUE_MIN |1E-37| 0X1P-149F | 1E-37| 0X1P-1074 > _MIN_10_EXP | -37 | -37 | -37 | -307 > _MAX |1E37 |0X1.fffffeP127F| 1E37 |0X1.fffffffffffffP1023 > _MAX_10_EXP | 37 | 38 | 37 | 308 > > The requirements of the standard appear to have been targeted to a > base 10 implementation. Allowing for that fact, the limits on the MIN > and MAX values for float and double (which are identical) are pretty > close to IEEE single precision. However, the minimum values for the > precision- related characteristics are different for float and > double, and significantly lower than actual values for the > corresponding IEEE formats. Clearly, you're right! I was a bit distracted by the binary definitions from the IEEE 754 standard. Obviously the collective defined limits for the float, double and long double type doesn't work for an half_t type covering the IEEE 754 binary16 format. Since the exponent width of the binary16 format is 5 bits corresponding to the range [-14, +15] with a 15 exponent bias, it could be safe to define an half_t type with HLF_MIN equal to 1E-4 and HLF_MAX equal to 1E+4. This range should be enought to cover a normalized value in [0.0, 1.0] corresponding to the [0, 1023] range for a 10-bit color component. -- GOTHIER Nathan
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What happened to short float? Philipp Klaus Krause <pkk@spth.de> - 2018-01-17 17:21 +0100
Re: What happened to short float? "James R. Kuyper" <jameskuyper@verizon.net> - 2018-01-17 11:42 -0500
Re: What happened to short float? jacobnavia <jacob@jacob.remcomp.fr> - 2018-02-02 23:08 +0100
Re: What happened to short float? Jakob Bohm <jb-usenet@wisemo.com> - 2018-02-05 07:57 +0100
Re: What happened to short float? jameskuyper@verizon.net - 2018-02-05 05:31 -0800
Re: What happened to short float? Tim Prince <tprince@intelretiree.com> - 2018-02-05 08:55 -0500
Re: What happened to short float? jacobnavia <jacob@jacob.remcomp.fr> - 2018-02-05 15:46 +0100
Re: What happened to short float? GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-08 01:29 +0100
Re: What happened to short float? Keith Thompson <kst-u@mib.org> - 2018-02-07 16:59 -0800
Re: What happened to short float? Philipp Klaus Krause <pkk@spth.de> - 2018-02-08 09:08 +0100
Re: What happened to short float? Keith Thompson <kst-u@mib.org> - 2018-02-08 09:27 -0800
Re: What happened to short float? GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-08 09:54 +0100
Re: What happened to short float? Keith Thompson <kst-u@mib.org> - 2018-02-08 10:13 -0800
Re: What happened to short float? jameskuyper@verizon.net - 2018-02-08 06:36 -0800
Re: What happened to short float? GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-08 17:04 +0100
Re: What happened to short float? jameskuyper@verizon.net - 2018-02-08 08:56 -0800
Re: What happened to short float? scott@slp53.sl.home (Scott Lurndal) - 2018-02-08 17:23 +0000
Re: What happened to short float? GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-08 18:52 +0100
Re: What happened to short float? jameskuyper@verizon.net - 2018-02-08 11:27 -0800
Re: What happened to short float? GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-08 22:58 +0100
Re: What happened to short float? Keith Thompson <kst-u@mib.org> - 2018-02-08 10:18 -0800
Re: What happened to short float? Jakob Bohm <jb-usenet@wisemo.com> - 2018-02-08 18:59 +0100
Re: What happened to short float? Robert Wessel <robertwessel2@yahoo.com> - 2018-02-08 16:22 -0600
Re: What happened to short float? Jakob Bohm <jb-usenet@wisemo.com> - 2018-02-09 15:01 +0100
Re: What happened to short float? Chad <cdalten@gmail.com> - 2018-01-17 09:12 -0800
Re: What happened to short float? scott@slp53.sl.home (Scott Lurndal) - 2018-01-17 17:31 +0000
Re: What happened to short float? jacobnavia <jacob@jacob.remcomp.fr> - 2018-01-17 19:52 +0100
Re: What happened to short float? Philipp Klaus Krause <pkk@spth.de> - 2018-01-18 13:18 +0100
Re: What happened to short float? bartc <bc@freeuk.com> - 2018-01-18 12:40 +0000
csiph-web