This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: glibc conditioning
Jinsong Zhao <zhaojs@cadence.com> writes:
> I tested again on all the machines I have access to. The following
> lines:
>
> double d=0.3;
> int i = (int)(1000*d);
>
> Only on Linux i is 299, while on all other machines (Solaris, AIX,
> HPUX, FreeBSD) i is 300.
And your point is? It just means that the conversion functions are
based on the same code or written with compatibility with this code in
mind. None of this is applies and is desirable.
And just to show everybody how stupid this whole claim is try this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <fpu_control.h>
int
main (void)
{
fpu_control_t t;
const char *a = "0.3";
double d;
int i;
_FPU_GETCW (t);
t &= ~ _FPU_EXTENDED;
t |= _FPU_DOUBLE;
_FPU_SETCW (t);
d = atof(a);
i = (int)(1000*d);
if (i != 300)
printf("%d: This must be Linux!\n", i);
else
printf("%d: Correct result\n", i);
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Try this (and note the correction of the code). Oh wonder! This
clearly shows that you and whoever wrote this article you referenced
have no grasp of the problem at all.
> Unfortunately, we have to live with the history and the legacy. For
> me, for now I have to stop working on porting to Linux and regret
> that I cannot enjoy the speed of Intel computers. The floating point
> problems are showing in the thousands of lines codes written by
> others.
Others have already commented on how completely inadequate this whole
posting is. Let's paraphrase it once again:
I have code written by some lousy programmers who had no understanding
of floating-point arithmetic and which runs fine in the environment
it was written for. I don't want to fix the code and therefore want
to bend reality to match my code.
I know this works with HP etc where you can promise them hardware
sales. The IT industry consists entirely of sluts who do all for
money. But Free Software ain't!
And as the example code above clearly shows this is no problem with
Linux or glibc, it's a problem with the engineering on your side where
there is apparently nobody you understands either floating-point
arithmetic or the x86 architecture.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------