Re: floating-point abuse in 2.1.113
Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
Tue, 4 Aug 1998 22:26:34 +0200 (CEST)
On Tue, 4 Aug 1998, Rogier Wolff wrote:
> Mikael Pettersson wrote:
> > On Tue, 4 Aug 1998, Geert Uytterhoeven wrote:
> >
> > > On Tue, 4 Aug 1998, Mikael Pettersson wrote:
> > > > - frequency = (frequency / 16.0) * 100; /* massage data a bit */
> > > > + frequency = (frequency * 100) / 16; /* massage data a bit */
> > >
> > > Shouldn't these be rounded, i.e.
> > >
> > > frequency = (frequency * 100 + 8) / 16;
> >
> > No, there is no rounding in the original calculation:
>
> Yes, thank you, most of us know C.
>
> Question stands: Shouldn't these be rounded?
>
> Someone might have forgotten the round operation, and as we're looking
> at the code right now, lets make sure we get it right....
Thanks Rogier! That's what I meant, too. I always put roundings in my drivers
if integer calculations are derived from real numbers math.
Greetings,
Geert
--
Geert Uytterhoeven Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP} http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html