Group: comp.lang.java.programmer
From: Patricia Shanahan
Date: Wednesday, April 02, 2008 10:39 AM
Subject: Re: Calling Methods Again [so, are you guys sick of me yet?]

RedGrittyBrick wrote:
> Hendrik Maryns wrote:
...
>> But why use float in the first place? To make life more difficult?
>> Just use double, forget the f suffixes and use Math.PI.
>>
>
> When replying I considered that, then I wondered what purpose float
> serves, then I assumed that the Java gods must have known some reason
> for it's existence - sometimes people may have a valid reason for using
> float? Someone using 3.14 as a value of PI may be just such a case :-)
>

I think float does have uses, but they are rather specialized. It is
useful, for example, in some seismic data processing. I would use it if,
and only if, both of the following were true:

1. The application has so much floating point data that a factor of two
difference in the space it occupies has a significant effect on
performance, or size of problem that can be solved, or some other
measure that matters.

2. I am sure the required precision can be achieved using float. Being
sure float is good enough is can be harder than being sure double is
good enough. Often, a very simple worst-case analysis will show double
is good enough, but sophisticated numerial analysis is needed for float.

Patricia

News in English | Binaries Groups | 20lbs in 30 days