Floating Point

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am

Floating Point

Post by rp181 »

Does anyone know exactly how much slower operations with floating point numbers are than with fixed point?


User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

You can't say that exactly as it depends on the implementation.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

If it doesn't need to be IEEE 754 compliant, and you can skip a software exception handling for floating points, many operations can be saved. E.g. instead of using double prec. use {63 bit + sign} or 64 bit (2 ALU registers) for the digits and 32 or {31bit + sign} (1 ALU register) for the exponent.

Using directed rounding mode, you can calculate FADD and FMUL in about 10 operations or a little more, (converting from integer to float vice-versa not included)
Probably not the most confused programmer anymore on the XCORE forum.
yzoer
XCore Addict
Posts: 133
Joined: Tue Dec 15, 2009 10:23 pm

Post by yzoer »

Floating point is ALWAYS going to be slower than fixed point because of normalization. If you *really* need extra precision, you can use 64-bit integers using assembly.

-Yvo