Joseph Ottinger wrote:

> Why do I detect a "Java is slow" post in your future? :) As usual, 
> when you're doing floating point on binary systems, you always have to 
> figure out if it's *really* important to have the precision... and 
> usually, it isn't. 

I'm going from memory so the exact figures may be somewhat off, but I 
remember reading in a Calculus text that, although PI has been 
calculated to thousands or even millions of places, the effort is more 
an academic exercise than a useful pursuit.  Using PI to 9 decimal 
places will give the circumference of the entire universe (assuming one 
knew the exact radius) to within an inch.

> I'm sure at this point, people are finding woodwork to crawl out of 
> saying, "Yes, it is!" - and you're all correct, for you it's important 
> because you're rocket scientists and all that, and maybe even a 
> financial programmer or two are finding graves to spin in as well. 

In the financial world, the greatest precision (not the same as 
accuracy) is three decimal places -- in dollar/penny currencies, a tenth 
of a penny.  Ivan is about to sacrifice performance on the alter of 
precision because he is confusing precision with accuracy.  What he 
really needs to do is determine exactly how much precision his 
application needs.  I'll bet real money it is a good deal less than the 
precision available with float, much less double.

> However... I'd still stand by the statement that in most cases, the 
> accuracy simply isn't important enough to justify crippling your 
> program's speed. It's all about the tradeoffs. If it's all about what 
> you SEE, then format the numbers going out instead. 

Aamof, he should be rounding off his results to that precision (usually 
just before storing the finished value after all the calculations have 
been done).  Not just format for printing at that precision, but 
actually discard the unnecessary places.

Tomm




To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to