Re: Rounding

From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 09/22/04


Date: Tue, 21 Sep 2004 21:51:48 -0400

Subtracting 0.0049 and then casting to DECIMAL with a scale of 2 will
effectively truncate the third digit to the right of the decimal point:

DECLARE @YourVal DECIMAL(9,2)
SET @YourVal = 1.375 - 0.0049
PRINT @YourVal

"MPF" <abcd@senditon.com> wrote in message
news:eftVxTEoEHA.132@TK2MSFTNGP14.phx.gbl...
> Thanks in advance for any help.
>
> Via flat file, we receive a value of 1.375%. The corresponding printed
> document shows an applied rate of 1.37%, dropping any rounding that
> would/should occur.
>
> All of the functions that I have tested, with regards to rounding, round
the
> value up to 1.38.
>
> Thanks,
>
> Morgan
>
>



Relevant Pages

  • Re: OT: Determining the size of plotting area
    ... rounding has come up here more than once, ... I don't recall the routines as being much more than half a dozen ... (Sometimes one wants to force zero to be ... included in the scale; other times one doesn't). ...
    (comp.lang.fortran)
  • Re: "scale" numbers?
    ... Is there some procedure to "scale" all the numbers to lie in the range ... let v' be the scaled vector into, and v" be an intermediate ... Depending on the application, you may want floor, ceiling, rounding, ... if you use the integer portion instead (which is the same as the ...
    (sci.math)
  • Re: floats, doubles and maths
    ... Patricia Shanahan writes: ... choice for financial calculations that need two decimal place rounding ... is java.math.BigDecimal, with scale factor 2. ...
    (comp.lang.java.help)
  • Re: rounding
    ... Rounding .5625 to two places should result in .57 and rounding 6.125 to two places should result in 6.13, ... double RoundToMultiple(double num, double multiple) ... return Math.Round(num * scale) / scale; ... Note that if you pick something that is theoretically divisible into 1.0, but which is not representable in binary, you may wind up wind rounding error. ...
    (microsoft.public.dotnet.languages.csharp)