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


Groups > comp.std.c > #1830

Re: null pointer constant, address constant

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.std.c
Subject Re: null pointer constant, address constant
Date 2013-01-08 20:21 -0500
Organization A noiseless patient Spider
Message-ID <kcign5$82j$1@dont-email.me> (permalink)
References (4 earlier) <kar2ku$o89$1@speranza.aioe.org> <kar51c$oaj$1@dont-email.me> <kas4pv$to2$1@speranza.aioe.org> <87pq24gqt2.fsf@bazspaz.fatphil.org> <kciegj$bam$1@speranza.aioe.org>

Show all headers | View raw


On 01/08/2013 07:44 PM, Szabolcs Nagy wrote:
> Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:
>> Szabolcs Nagy <nsz@port70.net> writes:
>>> float must be ieee 32bit format otherwise the whole math
>>> implementation is invalid
>>
>> Woh, when did that happen? I have a box which has non-IEEE754 floats,
>> and it aren't even in 36-bit lala-land.
> 
> happened in c99

What happened in C99 is that additional guarantees were added, but only
if __STDC_IEC_559__ was pre-#defined by the compiler. Before C99, IEC
60559 (==IEEE 754) platforms had the same lack of guarantees from the C
standard that non-IEEE754 platforms still have.

> the only way to have usable floating-point in c currently is to assume
> c99 annex f (which is unfortunately not widely supported by compilers)
> (with annex f float is ieee binary32 and double is ieee binary64)
> 
> without annex f there is no guarantee about the precision (and various
> other properties) of float operations which is not adequate for
> practical usage
> (basic assumptions might not hold, eg. .2+.3 > .4 can be false, which
> makes writing robust numerical algorithms hard/impossible)

More accurately, without annex F, the C standard provides no guarantees
about those things. However, it's entirely possible for something other
than the C standard (such as the documentation for the compiler) to
provide all of the guarantees needed to make the implementation usable,
even if it's not compatible with IEEE 754.

> (one can of course rely on the implementation defined floating-point
> behaviour of the given platform, but that's outside the semantics
> specified by c hence not portable, the necessary amount of ifdeffery
> to make up for that is impractical)

Whether it's impractical depends entirely upon the application. If the
application is specifically targeted to a particular non-IEEE 754
platform (such as, presumably, Phil Carmody's applications), no
#ifdeffery is needed (except possibly for #error directives indicating
that it's being compiled for the wrong platform).

Too many people seem to think that if a program relies upon something
that's not guaranteed by the C standard, it's not useful. Not all code
needs to be portable to all platforms that have a conforming
implementation of C.

> some ppl think that weak semantics for floating-point arithmetics
> is enough to write working numeric code, but the history of the
> previous failed attempts at that hints otherwise,
-- 
James Kuyper

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


Thread

null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-18 13:25 +0000
  Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 09:53 -0500
    Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-18 20:06 +0000
      Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 15:39 -0500
        Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-19 00:44 +0000
          Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 20:24 -0500
            Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-19 10:27 +0000
              Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-19 07:15 -0500
              Re: null pointer constant, address constant Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-21 03:03 +0200
                Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-21 12:13 -0500
                Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2013-01-09 00:44 +0000
                Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2013-01-08 20:21 -0500
                Re: null pointer constant, address constant Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-08 20:46 -0500
          Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 20:37 -0500
      Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 16:15 -0500
        Re: null pointer constant, address constant Keith Thompson <kst-u@mib.org> - 2012-12-18 15:52 -0800
          Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 19:12 -0500
            Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 19:51 -0500
          Re: null pointer constant, address constant Keith Thompson <kst-u@mib.org> - 2012-12-18 17:02 -0800
          Re: null pointer constant, address constant "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-12-20 05:34 -0800
            Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-20 10:33 -0500
              Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-20 12:28 -0500
                Re: null pointer constant, address constant Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 21:13 -0800
              Re: null pointer constant, address constant Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 21:05 -0800
            Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-20 12:17 -0500
            Re: null pointer constant, address constant Keith Thompson <kst-u@mib.org> - 2012-12-20 12:10 -0800
              Re: null pointer constant, address constant Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 21:25 -0800
  Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 14:02 -0500
    Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-18 20:09 +0000
      Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 15:54 -0500
        Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 16:18 -0500

csiph-web