Re: Rounding Problem

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 07/04/04


Date: Sun, 04 Jul 2004 22:02:32 +0200

On Sun, 4 Jul 2004 11:50:24 +0300, s.isa wrote:

>Hi all,
>
>Is there any function that truncates a decimal numeric without rounding, if
>i use cast it rounds the figure but can i don't want that i.e i want it to
>be as follows:
>
>23.1238 turns to 23.123 and not 23.124 so it keeps only three decimals as
>is
>
>Please advise if there is any function or so
>
>Thanks in advance
>Suad
>

Hi Suad,

DECLARE @Test decimal(9,5)
SET @Test=23.1238
SELECT CAST((@Test - 0.0005) AS decimal(9,3))

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Rounding Problem
    ... Is there any function that truncates a decimal numeric without rounding, ... i use cast it rounds the figure but can i don't want that i.e i want it to ...
    (microsoft.public.sqlserver.mseq)
  • Re: Rounding Dollar Amounts
    ... LineTaxExempt field is checked (meaning tax exempt), ... This works most of the time, but I have run into a few rounding errors. ... With tax exempt checked (and multiple lines) ... By "rounds wrong", I mean I ...
    (comp.databases.ms-access)
  • Re: [OT] Rounding v Truncation, was: Re: Platform Support vs.
    ... > I would regard rounding to be the correct thing to do from a maths viewpoint. ... memories of integer operation rules is that any fractional part is ... Ada rounds and C truncates: ...
    (comp.os.vms)
  • Re: How to round down to nearest 5 minutes, time calc?
    ... Your formula rounds to 15 mins, your subject says to 5 mins. ... The first totals cell shows total exact time, ... The complex rounding down formula I got ...
    (microsoft.public.excel.programming)
  • Re: Bug in Delphi SimpleRoundTo function?
    ... Ask any mathematician and you'll get the same answer: 0.5 rounds up. ... Banker's Rounding is a convenience to avoid either party ... the trap of using floating *binary* point numbers, ...
    (borland.public.delphi.non-technical)