From: Paulo Marques <pmarques@grupopie.com>
To: Nuno Santos <nsantos@edigma.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Floating point usage inside kernel
Date: Mon, 28 Nov 2011 12:50:38 +0000 [thread overview]
Message-ID: <4ED3839E.6080702@grupopie.com> (raw)
In-Reply-To: <4ED35E52.5010008@edigma.com>
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..."
next prev parent reply other threads:[~2011-11-28 12:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <S1754322Ab1KYK6W/20111125105822Z+929@vger.kernel.org>
2011-11-25 11:14 ` Floating point usage inside kernel Nuno Santos
2011-11-25 12:08 ` Jiri Slaby
2011-11-25 16:16 ` Nuno Santos
2011-11-25 17:05 ` Paulo Marques
2011-11-25 17:46 ` Nuno Santos
2011-11-25 18:10 ` Paulo Marques
2011-11-28 10:11 ` Nuno Santos
2011-11-28 12:50 ` Paulo Marques [this message]
2011-11-28 4:00 ` Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ED3839E.6080702@grupopie.com \
--to=pmarques@grupopie.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nsantos@edigma.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox