[linux-audio-dev] Traps in floating point code
Erik de Castro Lopo
erikd-lad at mega-nerd.com
Wed Jun 30 20:51:13 UTC 2004
On Wed, 30 Jun 2004 15:25:53 -0400
Pete Bessman <ninjadroid at gazuga.net> wrote:
> Ah. Now I get to find all the places in my code that can benefit from
> that. If you assign a float value into an int variable, is that an
> implicit cast?
Yes, see my paper here:
http://www.mega-nerd.com/FPcast/
> Good to know, thanks for the tip. Although, just using lrintf(val)
> would be wrong anyway because it would round up if fmod(val, 1.0) >
> 0.5, right?
Yes, but be careful you quoted the broken code, not the working code.
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"When your hammer is C++, everything begins to look like a thumb."
-- Steve Hoflich in comp.lang.c++
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"TLC declared bankruptcy after they received less than 2 percent of the $175
million earned by their CD sales. That was about 40 times less than the
profit that was divided among their management, production and record
companies." -- Courtney Love on the REAL piracy
More information about the Linux-audio-dev
mailing list