I meant that java thinks 1.5 + 1.5 = 3.0, not 2.99.
- Don
On Dec 5, 2003, at 11:31 AM, Martin Chapman wrote:
> Don,
>
> How is this fixed in Java 3.0? If I understood your comment correctly.
>
> Martin
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick@bbn.com]
> Sent: Friday, December 05, 2003 8:04 AM
> To: Nicholas Wright
> Cc: openmap-users@bbn.com; Martin Chapman
> Subject: Re: [OpenMap Users] Floats Vs. Doubles
>
>
>
> On Dec 5, 2003, at 4:49 AM, Nicholas Wright wrote:
>
>> Hi
>>
>> The biggest problem with floats is not the acurracy when representing
>> something on the map per-se. It's the problem with using floats in
>> calculations. I remember watching my 'C' program output the answer
>> 2.99 to
>> the code:
>>
>> float f = 1.5;
>> float g = 1.5;
>> float c = f+g; // c = 2.99
>>
>> in complete disbelief until I read it was designed that way.
>
> I guess luckily for us, java gives 3.0 as the answer.
>
>> I think Martin is lucky that his floats were *just* truncated.
>> Searching
>> through hundreds of lines of code for one inaccuracy like the above,
>> is far
>> more infuriating.
>>
>> It's a shame the handy LatLonPoint class is float based.
>
> I don't consider it a shame. It's a feature.
>
> - Don
>
>> From: "Christof Dallermassl" <cdaller@iicm.tu-graz.ac.at>
>> To: "Nicholas Wright" <nick.wright@ist.co.uk>
>> Cc: <openmap-users@bbn.com>; "Martin Chapman" <mchapman@sanz.com>
>> Sent: Friday, December 05, 2003 8:35 AM
>> Subject: Re: [OpenMap Users] Floats Vs. Doubles
>>
>>
>>> Hi!
>>>
>>> Nicholas> I didn't see an answer to this question. Apologies if I
>>> Nicholas> have missed.
>>>
>>> Nicholas> Why are floats used instead of doubles?
>>>
>>> yes, I'd prefer doubles as well! I know, it is probably diffikult to
>>> change now...
>>>
>>> another thing is that two LatLonPoints are not equal, if their
>>> coordinates differ on 0.00001f. Could you decrease this factor?
>>>
>>>
>>> mit freundlichen Gruessen
>>> Christof
>>> --
>>>
> ----------------------------------------------------------------------
>>> ----
>> -
>>> Christof Dallermassl / Institute for Information Processing and
>> Computer
>>> cdaller@iicm.edu / Supported new Media, Graz University of
>> Technology
>>> ---------------------------------------------------------------------
>>> -
>>> ----
>> -
>>> Dino Developer Community - be a part of it -
>>> http://www.dinopolis.org
>>>
>>
>>
>> --
>> [To unsubscribe to this list send an email to "majdart@bbn.com"
>> with the following text in the BODY of the message "unsubscribe
>> openmap-users"]
>>
>
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Fri Dec 5 11:34:50 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:37 EDT