Subject: Re: [linux-audio-dev] Traps in floating point code
From: Erik de Castro Lopo (erikd-lad_AT_mega-nerd.com)
Date: Wed Jun 30 2004 - 23:51:13 EEST
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
This archive was generated by hypermail 2b28 : Wed Jun 30 2004 - 23:45:32 EEST