[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [fpu] Rounding of Floating Point Numbers





>-----Original Message-----
>From: owner-fpu@opencores.org [mailto:owner-fpu@opencores.org]On Behalf
>Of Damjan Lampret
>
>I also remember from somewhere that there are four modes of rounding.
>Although I don't know how one usually switches between them. I don't
>think this is done automatically by the compiler but must be done
>explicitly through some FPU control register.

Right, both of you are correct. These are the rounding modes specified by
IEEE 754 (This is summarized directly from the IEEE-754 Spec.):
1) Round to Nearest [DEFAULT]
2) Directed Roundings [USER SELECTABLE]
   a) Round to +INF
   b) Round to -INF
   c) Round to Zero

So I guess I have to implement ALL of those modes :*(

My question was to the math behind the rounding. How is it mathematically
done. There is no explanation to the algorithms etc.

Instead of sitting down and figuring this all out, I thought there might be
already some white papers or other information that describes the rounding
technique and perhaps has some efficient implementation suggestions.

>I have just bought a book on implementing math algorithms in hardware.
>Great book. I'll check FP section. Anyway at the moment I don't have it
>right here so I can't do this right away. Expect something a few hrs
>later.

Let me know if it is any good and answers any of my questions !

>--damjan

Thanks !
rudi

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com