Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Truncating an amount
Mon, Apr 27 2009 12:33 AMPermanent Link

"Al Vas"
Hi,

As of V3 of DBISAM the TRUNCATE function is not available, so does anyone
know what is the best way to obtain the whole portion of a number.  I need
to do this as I need to create my own ROUND routine as the standard round
routine in V3 for some inexplicable reason rounds .5 up in some instances
and down in others.

Thanks

Alex
Mon, Apr 27 2009 3:44 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Al

Of the top of my head, and without remembering what functions are available in V3:

1. CAST(xxx AS INTEGER)
2.  CAST(SUBSTR(CAST(xxx AS CHAR) ,1,POS(CAST(xxx AS CHAR),'.')-1) AS INTEGER)


Roy Lambert
Mon, Apr 27 2009 3:36 PMPermanent Link

"Jeff Cook"
Al Vas wrote:

> Hi,
>
> As of V3 of DBISAM the TRUNCATE function is not available, so does
> anyone know what is the best way to obtain the whole portion of a
> number.  I need to do this as I need to create my own ROUND routine
> as the standard round routine in V3 for some inexplicable reason
> rounds .5 up in some instances and down in others.
>
> Thanks
>
> Alex

Alex

To de-inexplicable-ise it, sound like "Bankers Rounding" where even
numbers round up and odd numbers round down - ? or is it the other way?

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz
+
Joan and Jeff Cook
The Cooks Oasis
www.cookislandsoasis.com
Tue, Apr 28 2009 9:57 AMPermanent Link

"Al Vas"
Hi Jeff,

Makes sense but this is the weird thing.  I have two reports (ReportBuilder)
where I've created a data definition (SQL statement) with the same
calculated field (using ROUND) and they produce different results with the
same data.  I don't expect anyone to believe me Smile

Anyway I have used the CAST function to create my own rounding function (as
per Roys advice) and it is a problem no longer.

Alex

"Jeff Cook" <jeffc@aspect.co.nz> wrote in message
news:066CB18B-1D49-4A34-B2B6-7C5E532BCE44@news.elevatesoft.com...
> Al Vas wrote:
>
>> Hi,
>>
>> As of V3 of DBISAM the TRUNCATE function is not available, so does
>> anyone know what is the best way to obtain the whole portion of a
>> number.  I need to do this as I need to create my own ROUND routine
>> as the standard round routine in V3 for some inexplicable reason
>> rounds .5 up in some instances and down in others.
>>
>> Thanks
>>
>> Alex
>
> Alex
>
> To de-inexplicable-ise it, sound like "Bankers Rounding" where even
> numbers round up and odd numbers round down - ? or is it the other way?
>
> Cheers
>
> Jeff
>
> --
> Jeff Cook
> Aspect Systems Ltd
> www.aspect.co.nz
> +
> Joan and Jeff Cook
> The Cooks Oasis
> www.cookislandsoasis.com
Tue, Apr 28 2009 1:04 PMPermanent Link

"Malcolm"
Hi Alex

In your original post when you said sometimes it rounded up and
others down, I assumed you were referring to 'bankers' rounding where
the value is rounded to the nearest *even* whole number.

Malcolm
Wed, Apr 29 2009 2:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Alex,

<< Makes sense but this is the weird thing.  I have two reports
(ReportBuilder) where I've created a data definition (SQL statement) with
the same calculated field (using ROUND) and they produce different results
with the same data.  I don't expect anyone to believe me Smile>>

Sometimes it may appear that way because you're not seeing the entire
textual representation of a floating-point number.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image