Re: Floating point usage inside kernel

From: Paulo Marques
Date: Mon Nov 28 2011 - 07:50:50 EST


Nuno Santos wrote:
> Ok, understood!
>
> Just one more question. To do this, do I need to change the data type
> from double to int?

You shouldn't have any "double" declarations on kernel code or the
compiler might start using floating point instructions to handle it.

Things that the compiler can work out at compile time are probably ok,
like converting constants:

#define FIXED(a) (s32)((a) * 65536.0)

fixed = FIXED(1.25);

In this case compiler should make all the calculations at compile time
and replace the macro "FIXED(1.25)" with the integer 81920.

--
Paulo Marques - www.grupopie.com

"Don't worry, you'll be fine; I saw it work in a cartoon once..."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/