Re: One-liner breaks "strtold" in XCode 2.4
Re: One-liner breaks "strtold" in XCode 2.4
- Subject: Re: One-liner breaks "strtold" in XCode 2.4
- From: "Jordan K. Hubbard" <email@hidden>
- Date: Tue, 28 Nov 2006 18:21:41 -0800
Works for me:
jkh@fifi-> uname -a
Darwin ap0101m-dhcp11.apple.com 8.8.0 Darwin Kernel Version 8.8.0:
Fri Sep 8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC
Power Macintosh powerpc
jkh@fifi-> gcc -Wall strtoldtest.c -o strtoldtest
strtoldtest.c: In function 'main':
strtoldtest.c:13: warning: control reaches end of non-void function
jkh@fifi-> ./strtoldtest
1.900000000000000000000000000000e+27
On Nov 28, 2006, at 2:37 PM, Jay Reynolds Freeman wrote:
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
_______________________________________________
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