on Sat, Dec 12, 2009 Andy Lee may have said:
>As glenn pointed out, that string most certainly *can* be a string that
>can be converted back to a bitwise equivalent of the original float.
>Ben's question was whether in practice it is guaranteed to be so, or
>whether stringValue uses a maximum numb
On Dec 12, 2009, at 7:38 PM, RedleX Support wrote:
> My original intent was to store a representation of the float in a string so
> I can load it back again. In the meanwhile I found that using the %a format
> along with NSScanner's scanHexDouble does the trick (since I don't need that
> string
You should not compare floating point numbers for equality in most
cases. This is true of any language on any platform.
Indeed, some floating-point numbers (such as the one represented by
the integer 0x7fc0) will compare as not equal to themselves:
I think what the OP really wanted to
On 12 Dec 2009, at 09:32, Ben Haller wrote:
>>> You should not compare floating point numbers for equality in most cases.
>>> This is true of any language on any platform.
>>
>> Indeed, some floating-point numbers (such as the one represented by the
>> integer 0x7fc0) will compare as not equ
P.P.S. Never mind, passing f = 0.12345678901234567 is a counterexample. So
the answer is no, you won't get a bitwise equivalent if you do a
stringValue-floatValue round trip.
--Andy
On Dec 12, 2009, at 1:25 PM, Andy Lee wrote:
> On Dec 12, 2009, at 1:07 PM, Andy Lee wrote:
>> If I understand
On Dec 12, 2009, at 1:07 PM, Andy Lee wrote:
> If I understand the question, it's not about converting an arbitrary decimal
> string to a float, but specifically a string that was generated from a float
> in the first place.
>
> As glenn pointed out, that string most certainly *can* be a string
On Dec 12, 2009, at 12:51 PM, David Rowland wrote:
> On Dec 12, 2009, at 9:32 AM, Ben Haller wrote:
>
You should not compare floating point numbers for equality in most cases.
This is true of any language on any platform.
>>>
>>> Indeed, some floating-point numbers (such as the one rep
On Dec 12, 2009, at 9:32 AM, Ben Haller wrote:
You should not compare floating point numbers for equality in most
cases. This is true of any language on any platform.
Indeed, some floating-point numbers (such as the one represented by
the integer 0x7fc0) will compare as not equal to th
On Saturday, December 12, 2009, at 11:32AM, "Ben Haller"
wrote:
>>> You should not compare floating point numbers for equality in most
>>> cases. This is true of any language on any platform.
>>
>> Indeed, some floating-point numbers (such as the one represented by
>> the integer 0x7fc0
You should not compare floating point numbers for equality in most
cases. This is true of any language on any platform.
Indeed, some floating-point numbers (such as the one represented by
the integer 0x7fc0) will compare as not equal to themselves:
I think what the OP really wanted to
On 11 Dec 2009, at 21:14, Bryan Henry wrote:
> You should not compare floating point numbers for equality in most cases.
> This is true of any language on any platform.
Indeed, some floating-point numbers (such as the one represented by the integer
0x7fc0) will compare as not equal to themse
Hi,
>
> I need to output a double into a text file and then read it back with 100%
> accuracy, will using NSNumber stringValue and then using NSString doubleValue
> give me good results?
>
> For example, if I write the following:
>
> double a,b;
>
>
Hi,
I need to output a double into a text file and then read it back with
100% accuracy, will using NSNumber stringValue and then using NSString
doubleValue give me good results?
For example, if I write the following:
double a,b;
a=some number;
b=[[[NSNumber numberWithDouble:a
13 matches
Mail list logo