Re: Accurate decimal numbers?
Re: Accurate decimal numbers?
- Subject: Re: Accurate decimal numbers?
- From: mark <email@hidden>
- Date: Sat, 01 Jan 2005 12:17:25 -0800
I can't duplicate this result using NSScanner's scanDouble. Maybe it
catches this case for me?
> From: John Stiles <email@hidden>
> Date: Sat, 01 Jan 2005 11:36:55 -0800
> To: mark <email@hidden>
> Cc: Dev Cocoa <email@hidden>
> Subject: Re: Accurate decimal numbers?
>
> You can get the same results with:
>
> int main () {
> printf( "%f",
> atof("100000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000
> 0000000000000000000000000000000000000000000000000") );
> return 0;
> }
>
>
> On Jan 1, 2005, at 10:43 AM, mark wrote:
>
>> I don't allow "e" as a valid input character, so that case should be
>> covered
>>
>>> From: John Stiles <email@hidden>
>>> Date: Sat, 01 Jan 2005 09:44:39 -0800
>>> To: mark <email@hidden>
>>> Cc: Dev Cocoa <email@hidden>
>>> Subject: Re: Accurate decimal numbers?
>>>
>>> Don't be so sure :)
>>>
>>> int main() {
>>> printf( "%f", atof("1e500") );
>>> }
>>>
>>> [Session started at 2005-01-01 09:43:57 -0800.]
>>> inf
>>> Executable ³atof² has exited with status 0.
>>>
>>>
>>> On Jan 1, 2005, at 9:01 AM, mark wrote:
>>>
>>>> Thinking about it, you're correct. I thought I had a case, but the
>>>> more I
>>>> thought about it, the more it didn't make sense. In my case, I
>>>> should
>>>> never
>>>> see infinity or NaN, as the number comes from a scan of a string,
>>>> which
>>>> should reject anything that might cause a problem.
>>>>
>>>> Thanks again,
>>>>
>>>> mark
>>>>
>>>>> From: John Stiles <email@hidden>
>>>>> Date: Fri, 31 Dec 2004 22:22:45 -0800
>>>>> To: mark <email@hidden>
>>>>> Cc: Dev Cocoa <email@hidden>, Brendan Younger
>>>>> <email@hidden>
>>>>> Subject: Re: Accurate decimal numbers?
>>>>>
>>>>> In what case would "floor(x) == ceil(x)" return a different result
>>>>> from
>>>>> "floor(x) == x", exactly? I don't see how the ceil affects anything.
>>>>> Also, I don't know if I 100% understand your last question. floor
>>>>> and
>>>>> ceil return floats--they're typically* integral values, but still
>>>>> float
>>>>> types.
>>>>>
>>>>> * Why "typically" and not "always"? Infinity and NaN.
>>>>>
>>>>
>>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden