This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ask for help]: Met a problem with strtof


Hi,

I test the code below :
-------------------------------------------------------------
int main() {

	char *str1="-0x1.4EF009P-16";
	char *str2="-0x1.744513P-55";
	char *str3="+0x1.1C7509P-19";
	float temp;

	fesetround(FE_UPWARD);

	temp = strtof(str1, NULL);
	printf(" %s -> %a\n", str1, temp);

	fesetround(FE_DOWNWARD);

        temp = strtof(str2, NULL);
        printf("%s -> %a\n", str2, temp);
        temp = strtof(str3, NULL);
        printf("%s -> %a\n", str3, temp);
	return 0;
}

-------------------------------------------------------------

I met a problem as below:
On SUSE-SP1 x86_64 with glibc-2.11-3 and gcc-4.3.2
I got the result:

-0x1.4EF009P-16 -> -0x1.4ef00ap-16
-0x1.744513P-55 -> -0x1.744514p-55
+0x1.1C7509P-19 -> 0x1.1c750ap-19

while On Fedora x86_64 with glibc-2.17-19 and gcc-4.8.2
I got the result:

-0x1.4EF009P-16 -> -0x1.4ef008p-16
-0x1.744513P-55 -> -0x1.744512p-55
+0x1.1C7509P-19 -> 0x1.1c7508p-19

All the fesetround setted success.
Can someone tell me which is right and why?

Regards.
Wang


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]