L
Lew
Tom said:Performance, of course!
That bubble was burst upthread:
Tom said:Performance, of course!
Lew said:That bubble was burst upthread:
Thomas said:According to Eric Sosman said:The bubble may have been prodded, but exhibits some
resilience and a resistance to bursting. For what it's
worth, my system[*] takes 5.88 seconds to do 200 naive
Gaussian eliminations on a 250x250 double matrix, 4.86
seconds to do the same on a float matrix. That's a 21%
speed penalty for double, which seems more than "modest."
[*] 3 GHz Pentium 4, Windows XP SP3, Java 1.6.0_13.
That's why I wrote "in-CPU processing". Your matrix uses about
250 KB with floats, 500 KB with doubles. Your CPU has only 32 KB
of L1 cache for data, so what you are seeing is a cache effect.
For _storage_ (as opposed to _computations_), you should use
floats if their precision is sufficient for your data.
Nonetheless, when you perform the multiplications and subtractions that
Gaussian reduction entails, you should use doubles (i.e. you read floats
from the matrix, cast them to doubles, perform the computation, then
cast back the result as float and store it back in the matrix).
Eric said:Thomas said:According to Eric Sosman said:The bubble may have been prodded, but exhibits some
resilience and a resistance to bursting. For what it's
worth, my system[*] takes 5.88 seconds to do 200 naive
Gaussian eliminations on a 250x250 double matrix, 4.86
seconds to do the same on a float matrix. That's a 21%
speed penalty for double, which seems more than "modest."
[*] 3 GHz Pentium 4, Windows XP SP3, Java 1.6.0_13.
That's why I wrote "in-CPU processing". Your matrix uses about
250 KB with floats, 500 KB with doubles. Your CPU has only 32 KB
of L1 cache for data, so what you are seeing is a cache effect.
For _storage_ (as opposed to _computations_), you should use
floats if their precision is sufficient for your data.
Christian said:Stefan said:I teach some properties of the data type »double«:
public class Main
{ public static void main( final java.lang.String[] args ) {
java.lang.System.out.println( 0.1 + 0.1 + 0.1 == 0.3 );
java.lang.System.out.println( 1.1 * 1.1 == 1.21 ); }}
false
false
. I also teach that beginners should not use the data type
»float«, because it will only cause trouble.
imho this is a bad thing to tell...
Its like telling "Don't use int because it will only give you trouble ,
always use long"
For most applications (as in 99% of all I see) float is more than enough
for floating point computations.
Also a situtation where float is preferred for me to double:
A volatile float is written atomic while a volatile double is not!
Though concurrency is at least here not part of the programming classes...
Tom said:Performance, of course!
There's no great advantage. For me, this works as a form of
documentation - whenever i see a float, i know it's something sums-ish
rather than mathematical.
double are not more mathemaical than float. Seen from a mathematical
perspective they work identical - just with a different number of bits.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.