Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: More physical source files |
| Date | Sat, 04 Jul 2015 15:42:17 -0700 |
| Organization | None to speak of |
| Lines | 55 |
| Message-ID | <lnlhevwnna.fsf@kst-u.example.com> (permalink) |
| References | <36e79c40-a86d-416d-b290-b2de49560c61@googlegroups.com> <mmmt6f$82a$1@dont-email.me> <7cf2be57-a46a-454a-a6cb-0c81d77ed7fb@googlegroups.com> <ln8ub2fstw.fsf@kst-u.example.com> <bad1394d-623e-4ef3-8936-876af70857bb@googlegroups.com> <lnbnfw3kum.fsf@kst-u.example.com> <56d054c6-5316-46eb-b7b4-686bd405149d@googlegroups.com> <lnmvzf21kt.fsf@kst-u.example.com> <de40dc32-3557-4219-8eb8-c40d5481694d@googlegroups.com> <lnegkq160c.fsf@kst-u.example.com> <39cf9193-5d10-4db9-b766-9452d7c1b0bf@googlegroups.com> <ln4mll18ak.fsf@kst-u.example.com> <71c62ee8-0007-446b-9004-c6def341205a@googlegroups.com> <lnpp47ww8j.fsf@kst-u.example.com> <d5e66ec9-845a-4dd4-8df0-ad913b4d2adb@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="27955"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uOkFtFbQyWBVtc8xSM9Wo" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:k1OCB8XC/55GA5I0yaXVaTPVI/0= sha1:l/nVrOOcqCVebrNn91Y2yVqOBZA= |
| Xref | csiph.com comp.lang.c:64676 |
Show key headers only | View raw
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Saturday, July 4, 2015 at 8:36:53 PM UTC+1, Keith Thompson wrote:
>> You can write a program that uses floating-point whose output *doesn't*
>> depend on unspecified, undefined, or implementation-defined behavior.
>> Such a program may be strictly confoming.
>>
> A C program can't output reals. It can only output bits, which are
> often interpreted as integers or rationals for the user.
Arguable, but I didn't say anything about outputting reals, or even
floating-point values.
> If you
> insist that no integer shall be off by even one place, and you are
> face with a perverse implementation designed to break your program,
> it becomes difficult to use floating point. Relax the requirements
> a bit, and it becomes quite easy.
Using floating-point in a strictly conforming program is difficult,
given C's lax requirements for floating-point precision. (On the
other hand, strict conformance is not usually a requirement;
reasonable portability is almost always good enough.)
For example, I believe this program:
#include <stdio.h>
int main(void) {
if (0.0 < 1.0) puts("ok");
else puts("OOPS");
}
is strictly conforming (ignoring the possibility of errors on the puts()
call). This program:
#include <stdio.h>
int main(void) {
if (1.0 + 1.0 > 1.0) puts("ok");
else puts("OOPS");
}
is probably not strictly conforming, given that the accuracy of
floating-point "+" is implementation-defined (N1570 5.2.4.2.2p6).
On the other hand, I would argue that if the program prints "OOPS",
then the implementation violates N1570 6.5.6p5:
The result of the binary + operator is the sum of the operands.
But there's no good way to define how much of an error would render
an implementation non-conforming.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-06-27 11:19 -0700
Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-06-27 11:54 -0700
Re: More physical source files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-27 21:20 +0100
Re: More physical source files Bartc <bc@freeuk.com> - 2015-06-27 20:24 +0100
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-06-29 07:14 -0700
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-06-29 08:16 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-06-30 08:24 -0700
Re: More physical source files Robert Wessel <robertwessel2@yahoo.com> - 2015-06-30 12:15 -0500
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-06-30 15:14 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-01 08:38 -0700
Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-01 16:43 +0000
Re: More physical source files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-01 18:52 +0100
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-01 11:21 -0700
Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-01 18:36 +0000
Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-01 22:33 -0400
Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-02 19:11 +0000
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-01 11:08 -0700
Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-01 22:30 -0400
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-02 08:29 -0700
Re: More physical source files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-02 17:56 +0100
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-02 13:21 -0400
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-03 08:54 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 12:23 -0400
Re: More physical source files Martin Shobe <martin.shobe@yahoo.com> - 2015-07-04 11:36 -0500
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-02 16:42 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-03 08:54 -0700
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-03 10:05 -0700
Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-03 21:57 +0000
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 00:30 -0400
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-04 08:08 -0700
Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-04 12:21 -0400
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-05 09:22 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-05 09:49 -0700
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-05 18:16 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-06 08:37 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-06 12:56 -0400
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-06 11:59 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-06 15:45 -0400
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-06 13:14 -0700
Re: More physical source files Philip Lantz <prl@canterey.us> - 2015-07-07 01:10 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-07 08:00 -0700
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-07 07:55 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-07 13:13 -0400
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-08 08:35 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-08 12:31 -0400
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-09 08:50 -0700
Re: More physical source files Richard Heathfield <rjh@cpax.org.uk> - 2015-07-09 16:56 +0100
Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-09 13:31 -0700
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-09 15:03 -0700
Re: More physical source files Ian Collins <ian-news@hotmail.com> - 2015-07-10 10:54 +1200
Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-10 09:52 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-09 14:32 -0400
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-05 13:41 -0400
Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-05 14:17 -0400
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-04 12:36 -0700
Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-04 15:19 -0700
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-04 15:42 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 19:04 -0400
Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-05 03:25 -0700
Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-05 09:18 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-05 14:11 -0400
Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-05 13:41 -0700
Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 12:50 -0400
Re: More physical source files Bartc <bc@freeuk.com> - 2015-06-29 17:20 +0100
Re: More physical source files Rosario19 <Ros@invalid.invalid> - 2015-06-28 11:57 +0200
csiph-web