Re: ESL - math.e - rounding
- Posted by "Juergen Luethje" <j.lue at gmx.de> Aug 04, 2005
- 549 views
Christian Cuvier wrote: <snip> > In theory, we need the 4 rounding modes below. I think we should have all 4 rounding modes in the ESL, shouldn't we? > And the Intel FP architecture supports them all. > > [Quoting from Intel FPU documentation] > > Table 4-8. Rounding Modes and Encoding of Rounding Control (RC) Field > > -------------------------------------------------------------------- > Rounding ! RC Field ! Setting Description > Mode ! ! > ---------------+----------+---------------------------------------- > ! ! Rounded result is the closest to the > Round to ! 00B ! infinitely precise result. If two values > nearest (even) ! ! are equally close, the result is the even > ! ! value (that is, the one with the > ! ! least-significant bit of zero). Default > ---------------+----------+------------------------------------------ > Round down ! ! Rounded result is closest to but no greater > (toward =E2=88=92=E2=88=9E) ! 01B !than the infinitely precise resu= > lt. > ---------------+----------+------------------------------------------ > Round up ! ! Rounded result is closest to but no less > (toward +=E2=88=9E) ! 10B !than the infinitely precise result. > ---------------+----------+------------------------------------------ > Round toward ! ! Rounded result is closest to but no greater > zero (Truncate)! 11B ! in absolute value than the infinitely precise > > ! ! result. > --------------------------------------------------------------------- Interesting, thanks for the information. It looks as if this must be programmed by using special FP assembler instructions. So this is no job for me ... > Commercial rounding is just rounding up, while scientific calculations > use round to nearst more often. > > CChris Regards, Juergen