One-liner breaks "strtold" in XCode 2.4
One-liner breaks "strtold" in XCode 2.4
- Subject: One-liner breaks "strtold" in XCode 2.4
- From: Jay Reynolds Freeman <email@hidden>
- Date: Tue, 28 Nov 2006 14:37:44 -0800
I have a one-line C program that breaks "strtold"
(string to long double) when compiled with gcc and
linked with the libraries that came with XCode 2.4,
running on a Macbook with OS X 10.4.8.
"strtold" is a library routine that reads a string
and converts it to a long double -- IEEE 80-bit
in this case.
I have reported the bug to Apple -- bug ID
number 4852115.
I am mentioning it here because, although not too
many people use straight C any more, I believe the
library with the errant code came from Apple (the
GNU folks say they don't distribute libraries),
and if so, it is possible that the problem might
show up in string-to-number conversion in other,
more popular languages supported by Apple; that
might be a good thing to make well known. I am
so new to the XCode stuff that I am not
immediately able to check for myself. (Mostly
I work in a Unix shell in Terminal.)
I would be curious myself to know whose problem
this is, so that I can report it appropriately
if it is not Apple's
If this posting is inappropriate here, please
forgive me, I just joined the group.
Source code appended.
-- Jay Reynolds Freeman
---------------------
email@hidden
http://web.mac.com/jay_reynolds_freeman (personal web site)
/****** Source for "bug2.c" ******/
#include <stdio.h>
#include <stdlib.h>
// Compile this file with "gcc -o bug2 bug2.c" and run "bug2".
// It fprints out the long double that "strtold" gets from "1.9e27L".
//
// For me, it prints "nan". That shouldn't be ...
int main()
{
fprintf( stdout, "%.30Le\n", strtold( "1.9e27L", 0 ) );
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden