Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Handling numeric types in interpreter |
| Date | 2015-07-26 18:57 -0400 |
| Organization | Self |
| Message-ID | <55B565C8.5000302@verizon.net> (permalink) |
| References | (7 earlier) <aa38ral5h5j538fqkdtdfc8cub5tl8b4a5@4ax.com> <55B41602.1030903@verizon.net> <qfr8ra1c730jpbf9hfjqahq9vfhhfr6ofj@4ax.com> <mp2jfn$79m$1@dont-email.me> <hijaratgjp79vv08mn4sbgt7k7gdr1mnhh@4ax.com> |
On 07/26/2015 05:28 PM, Robert Wessel wrote: > On Sun, 26 Jul 2015 08:24:50 -0400, James Kuyper > <jameskuyper@verizon.net> wrote: > >> On 07/26/2015 01:23 AM, Robert Wessel wrote: >>> On Sat, 25 Jul 2015 19:04:34 -0400, James Kuyper >>> <jameskuyper@verizon.net> wrote: >>> >>>> On 07/25/2015 06:31 PM, Robert Wessel wrote: >>>>> On Sat, 25 Jul 2015 17:48:59 -0400, James Kuyper >>>>> <jameskuyper@verizon.net> wrote: >>>>> >>>>>> On 07/25/2015 04:46 PM, Robert Wessel wrote: >>>>>>> On Sat, 25 Jul 2015 06:12:16 -0700 (PDT), Malcolm McLean >>>>>>> <malcolm.mclean5@btinternet.com> wrote: >>>> ... >>>>>>>> long double being present or not is important. Actually legitimate >>>>>>>> values in a tiff file for a tiff reader can't go over 2^50 as far as >>>>>>>> I know, so double is OK. >>>>>>> >>>>>>> >>>>>>> Doubles are required to have 2**50 in their range, but are not >>>>>> >>>>>> I'm curious - where is this specified? I went searching for a >>>>>> specification of the TIFF format, and found >>>>>> <http://partners.adobe.com/public/developer/tiff/index.html>. I couldn't >>>>>> find it in any of the documents listed there. Did I find the wrong >>>>>> documents? >>>>> >>>>> >>>>> I was referring to the C requirements for doubles, which require a >>>>> range of 10**-37..10**37 and 10 decimal digit of precision for a >>>>> double. The first requirement accommodates 2**50, the second does >>>>> not. The TIFF spec is that floats and double are IEEE format (which >>>>> has a 11 bit exponent and a 53 bit significand). >>>> >>>> In that case, the limit that Malcolm should be using should be derived >>> >from the IEEE double specification, and is therefore >>>> 0X1.fffffffffffffP1023, not 2^50. >>> >>> >>> No, he has to be able to process all values that can *validly* occur >>> in a TIFF file, or at least in a TIFF file his code purports to >>> handle. If an invalid value is found (and they all ned to be checked) >>> he needs to return INVALID_TIFF_FILE. I'm not commenting on what the >>> actual range of valid values are. >> >> Well, unlike you, I was commenting on the actual range of valid values. >> He seems to think the upper limit is 2^50, and I was asking about the >> basis for that limit. His wording imply that it's a limit that applies >> to all TIFF files, not just the particular TIFF files his reader is >> intended to process. As far as I can tell, since the TIFF specification >> says that DOUBLE is supposed to have IEEE format (and presumably, >> specifically the IEEE format for double precision), >> 0X1.fffffffffffffP1023 is the correct upper limit. As a result, on some >> machines 'double' might not have enough range: DBL_MAX is allowed to be >> as low as 1e37. Of course, LDBL_MAX is also allowed to be as low as 1e37 >> - but it will never be smaller than DBL_MAX, so using 'long double' is >> marginally safer. He's free to assume that all machines this code will >> ever be ported to will have IEEE doubles, but if so, he should state >> that as a requirement rather than silently failing to address the issue. > > > Just because a value is stored as an IEEE float doesn't mean that all > values possible in that representation are meaningful or valid. > Consider a medical application that stored a human's mass and height > in floats - no one would expect it to produce valid results if it > encountered a record specifying a 20,000kg or 40m human. OTOH, it's > perfectly reasonable to expect that the application would (safely) > refuse to process such a record with an appropriate error message. Again, that's application-specific. His wording implied a reason specific to TIFF for a limit that all TIFF readers can rely upon TIFF data not to exceed. Your argument suggests that it's a completely arbitrary limit based upon "nobody needs to store numbers that big". It's called "scientific notation" for a reason - I'd expect that any TIFF file that contains data pushing the limits on the range of double would contain scientific data. I can assure you that TIFF is at least occasionally used to store floating point scientific data - I've seen it used to store MODIS (the NASA project I work on) radiance data, for instance. The larger a number is, the fewer are the contexts in which it's likely to come up, and even I have a great deal of trouble coming up with a plausible example of a reason to store a number that big. The most likely candidate I can think of for such numbers is numerical modeling of black hole collisions - but the designers of such simulations would presumable go to a great deal of trouble to design them so they don't have to involve numbers that big - in order to ensure that intermediate calculations neither overflow nor underflow nor suffer a large loss of significance. But if it's to be a generic limit that applies to all TIFF readers, I don't see how he can justify assuming that no one will ever use more than a tiny fraction of the permitted range of a supported data type.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Handling numeric types in interpreter luser droog <luser.droog@gmail.com> - 2015-07-13 19:33 -0700
Re: Handling numeric types in interpreter jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-14 07:31 +0200
Handling numeric types in interpreter asetofsymbols@gmail.com - 2015-07-14 00:35 -0700
Re: Handling numeric types in interpreter David Kleinecke <dkleinecke@gmail.com> - 2015-07-14 08:55 -0700
Re: Handling numeric types in interpreter Bartc <bc@freeuk.com> - 2015-07-15 23:18 +0100
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-24 00:21 -0700
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-24 08:36 -0700
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-24 11:04 -0700
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-24 12:25 -0700
Re: Handling numeric types in interpreter James Kuyper <jameskuyper@verizon.net> - 2015-07-24 22:21 -0400
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-25 02:28 -0700
Re: Handling numeric types in interpreter Bartc <bc@freeuk.com> - 2015-07-25 15:16 +0100
Re: Handling numeric types in interpreter Richard Damon <Richard@Damon-Family.org> - 2015-07-25 11:03 -0400
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-25 10:05 -0700
Re: Handling numeric types in interpreter gazelle@shell.xmission.com (Kenny McCormack) - 2015-07-25 12:32 +0000
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-25 06:12 -0700
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-25 10:08 -0700
Re: Handling numeric types in interpreter ais523 <ais523@nethack4.org> - 2015-07-28 17:50 +0000
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-28 11:52 -0700
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-28 12:25 -0700
Re: Handling numeric types in interpreter Richard Heathfield <rjh@cpax.org.uk> - 2015-07-28 20:52 +0100
Re: Handling numeric types in interpreter jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-28 23:01 +0200
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-28 14:44 -0700
Re: Handling numeric types in interpreter Ian Collins <ian-news@hotmail.com> - 2015-07-29 09:43 +1200
Re: Handling numeric types in interpreter glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-28 23:10 +0000
Re: Handling numeric types in interpreter Ian Collins <ian-news@hotmail.com> - 2015-07-29 12:04 +1200
Re: Handling numeric types in interpreter Melzzzzz <mel@zzzzz.com> - 2015-07-29 02:39 +0200
Re: Handling numeric types in interpreter jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-29 12:04 +0200
Re: Handling numeric types in interpreter glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-29 14:58 +0000
Re: Handling numeric types in interpreter jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-29 14:14 +0200
Re: Handling numeric types in interpreter Bartc <bc@freeuk.com> - 2015-07-29 13:29 +0100
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-29 08:48 -0700
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-29 08:45 -0700
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-28 16:28 -0700
Re: Handling numeric types in interpreter jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-29 12:02 +0200
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-29 08:51 -0700
Re: Handling numeric types in interpreter jacobnavia <jacob@jacob.remcomp.fr> - 2015-07-29 18:35 +0200
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-29 10:47 -0700
Re: Handling numeric types in interpreter Robert Wessel <robertwessel2@yahoo.com> - 2015-07-25 15:46 -0500
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-25 14:08 -0700
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-25 15:42 -0700
Re: Handling numeric types in interpreter Robert Wessel <robertwessel2@yahoo.com> - 2015-07-26 00:31 -0500
Re: Handling numeric types in interpreter James Kuyper <jameskuyper@verizon.net> - 2015-07-25 17:48 -0400
Re: Handling numeric types in interpreter Robert Wessel <robertwessel2@yahoo.com> - 2015-07-25 17:31 -0500
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-25 15:57 -0700
Re: Handling numeric types in interpreter Bartc <bc@freeuk.com> - 2015-07-26 01:07 +0100
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-25 17:26 -0700
Re: Handling numeric types in interpreter Richard Damon <Richard@Damon-Family.org> - 2015-07-25 22:25 -0400
Re: Handling numeric types in interpreter James Kuyper <jameskuyper@verizon.net> - 2015-07-25 19:04 -0400
Re: Handling numeric types in interpreter Robert Wessel <robertwessel2@yahoo.com> - 2015-07-26 00:23 -0500
Re: Handling numeric types in interpreter James Kuyper <jameskuyper@verizon.net> - 2015-07-26 08:24 -0400
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-26 06:36 -0700
Re: Handling numeric types in interpreter Robert Wessel <robertwessel2@yahoo.com> - 2015-07-26 16:30 -0500
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-26 15:42 -0700
Re: Handling numeric types in interpreter Robert Wessel <robertwessel2@yahoo.com> - 2015-07-26 16:28 -0500
Re: Handling numeric types in interpreter James Kuyper <jameskuyper@verizon.net> - 2015-07-26 18:57 -0400
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-26 16:20 -0700
Re: Handling numeric types in interpreter Keith Thompson <kst-u@mib.org> - 2015-07-25 15:58 -0700
Re: Handling numeric types in interpreter James Kuyper <jameskuyper@verizon.net> - 2015-07-25 12:56 -0400
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-25 14:18 -0700
Re: Handling numeric types in interpreter glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-24 18:06 +0000
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-24 11:16 -0700
Re: Handling numeric types in interpreter glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-24 23:06 +0000
Re: Handling numeric types in interpreter Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-24 16:21 -0700
Re: Handling numeric types in interpreter Michael Angelo Ravera <maravera@prodigy.net> - 2015-07-15 19:13 -0700
Re: Handling numeric types in interpreter luser droog <luser.droog@gmail.com> - 2015-07-23 08:36 -0700
csiph-web