Luc Le Blanc wrote:
> So far, the tests I have run on an actual device have not shown a
> difference, but in principle, is computing on floats faster than
> doubles, at least on some devices, given that there is no FPU?

If there is no FPU, it could be faster, slower or about the same. Assuming 
you are using C/C++, all floating point arithmetic /should/ be performed in 
double precision or better, so the code:

float a, b, c;
a = b+c;

would compile to operations something like:

load float b
convert float to double
load float c
convert float to double
add
convert double to float
store float a

whereas the code

double a, b, c;
a = b+c;

would compile to

load double b
load double c
add
store double a

so there is an obvious tradeoff of the time taken to convert between float 
and double and the time taken to load/store 32 bits as opposed to 64 bits.

Where there is no floating point hardware, some C/C++ compilers for slow 
embedded processors have switches to allow floating point arithmetic to be 
performed only to float precision where the operands and result are float, 
but I don't know if this is the case for any of the Palm compilers.


-- 
Martin



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to