--1678434306-1755858991-1019053563=:24212
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Wed, 17 Apr 2002, Andrey Ulanov wrote:
> Look at this:
>
> $ cat test.c
> #include <stdio.h>
>
> main()
> {
> double h = 0.2;
>
> if(1/h == 5.0)
> printf("1/h == 5.0\n");
>
> if(1/h < 5.0)
> printf("1/h < 5.0\n");
> return 0;
> }
> $ gcc test.c
> $ ./a.out
> 1/h < 5.0
> $
>
> I also ran same a.out under FreeBSD. It says "1/h == 5.0".
> It seems there is difference somewhere in FPU
> initialization code. And I think it should be fixed.
>
No. No. No. Read something about basic programming of floating-point
operations before complaining about something you obviously know
nothing about. "==" has no use in floating-point operations. Any
code that uses "==", referencing floating-point numbers is broken.
If the BSD 'C' runtime library fortuously says that 1.0/0.2 == 5, than
you just got lucky. Time to play the lottery. FYI, you can set the
per-process FPU initialization anyway you want. FYI, by default it
ignores 1/0 errors:
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Windows-2000/Professional isn't.
--1678434306-1755858991-1019053563=:24212
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="fpu.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.1020417102603.24212B@chaos.analogic.com>
Content-Description:
LyoNCiAqICBOb3RlIEZQVSBjb250cm9sIG9ubHkgZXhpc3RzIHBlciBwcm9j
ZXNzLiBUaGVyZWZvcmUsIHlvdSBoYXZlDQogKiAgdG8gc2V0IHVwIHRoZSBG
UFUgYmVmb3JlIHlvdSB1c2UgaXQgaW4gYW55IHByb2dyYW0uDQogKi8NCiNp
bmNsdWRlIDxpMzg2L2ZwdV9jb250cm9sLmg+DQoNCiNkZWZpbmUgRlBVX01B
U0sgKF9GUFVfTUFTS19JTSB8XA0KICAgICAgICAgICAgICAgICAgX0ZQVV9N
QVNLX0RNIHxcDQogICAgICAgICAgICAgICAgICBfRlBVX01BU0tfWk0gfFwN
CiAgICAgICAgICAgICAgICAgIF9GUFVfTUFTS19PTSB8XA0KICAgICAgICAg
ICAgICAgICAgX0ZQVV9NQVNLX1VNIHxcDQogICAgICAgICAgICAgICAgICBf
RlBVX01BU0tfUE0pDQoNCnZvaWQgZnB1KCkNCnsNCiAgICBfX3NldGZwdWN3
KF9GUFVfREVGQVVMVCAmIH5GUFVfTUFTSyk7DQp9DQoNCg0KbWFpbigpIHsN
CiAgIGRvdWJsZSB6ZXJvPTAuMDsNCiAgIGRvdWJsZSBvbmU9MS4wOw0KICAg
ZnB1KCk7DQoNCiAgIG9uZSAvPXplcm87DQp9DQoNCg==
--1678434306-1755858991-1019053563=:24212--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/