
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Gerard Zagema wrote: > > No, I'm talking about ROUND(number,precision). > > This function will round a float to the precision given by > 'precision'. If precision is 2 then 525.345 will give 525.35 and > with a precision of -2, ROUND( 9856.0 , -2) will give 9900. > > I already found the code but it's a lot of div. and mul.. I was > hoping that there is a smart way to do it when the number format > ( such as IEEE-754) is known. If you had had the courtesy to quote something to indicate to what you were replying, you would have also seen the following: > > You can build your ROUND function from this with some > > multiplications and divisions. together with a description of the round() function. An elementary consideration of the operations required, and the internal data formats, would show you that such short cuts are not available. If ISO C adds the proposed decimal floating point formats, that situation will change. Don't hold your breath for it. -- Chuck F ([EMAIL PROTECTED]) ([EMAIL PROTECTED]) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!
| <-- __Chronological__ --> | <-- __Thread__ --> |