#1  
Old 22nd January 2020, 02:22 AM
Rodrigo Gómez
 
Posts: n/a
Default Does anybody know of Currency rounding functions?

Hello,

I have been suffering from some rounding issues this past days I've been
implementing some unit tests. In my apps all of the money related data
is stored in Currency fields, which works well except when I need to
round some values. I have been using RoundTo/SimpleRoundTo but there are
Currency values that give incorrect results and the main problem is that
those functions work with floating point values.

So I wonder if there are somewhere rounding functions that work natively
on a Currency value?

I have seen on the internet some code to do the rounding up, but I
haven't found one that does the Banker's Rounding.

Thanks!

--
Rodrigo Gómez [NDX]
México, GMT-6
  #2  
Old 22nd January 2020, 08:29 AM
John Turner
 
Posts: n/a
Default Re: Does anybody know of Currency rounding functions?

On 1/21/2020 11:22 AM, Rodrigo Gómez wrote:
> Hello,
>
> I have been suffering from some rounding issues this past days I've been
> implementing some unit tests. In my apps all of the money related data
> is stored in Currency fields, which works well except when I need to
> round some values. I have been using RoundTo/SimpleRoundTo but there are
> Currency values that give incorrect results and the main problem is that
> those functions work with floating point values.
>
> So I wonder if there are somewhere rounding functions that work natively
> on a Currency value?
>
> I have seen on the internet some code to do the rounding up, but I
> haven't found one that does the Banker's Rounding.
>
> Thanks!
>

Rodrigo,

Try: https://sourceforge.net/projects/tpsystools/

John
  #3  
Old 22nd January 2020, 10:04 AM
Eivind Bakkestuen [NDD]
 
Posts: n/a
Default Re: Does anybody know of Currency rounding functions?

> So I wonder if there are somewhere rounding functions that work
> natively on a Currency value?


For built in routines, try working with the value as BCD and use
routines from the FmtBcd unit.

--
Eivind Bakkestuen [NDD]
  #4  
Old 25th January 2020, 11:10 AM
Rodrigo Gómez
 
Posts: n/a
Default Re: Does anybody know of Currency rounding functions?


>
> For built in routines, try working with the value as BCD and use
> routines from the FmtBcd unit.


Thanks Eivind, I'll check this out.


--
Rodrigo Gómez [NDX]
México, GMT-6
  #5  
Old 25th January 2020, 11:11 AM
Rodrigo Gómez
 
Posts: n/a
Default Re: Does anybody know of Currency rounding functions?


>
> Try: https://sourceforge.net/projects/tpsystools/
>


Thanks John!


--
Rodrigo Gómez [NDX]
México, GMT-6


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rounding ..... Roberto Nicchi nexusdb.public.support.sql 7 31st March 2015 03:51 AM
Banker's Rounding John Turner nexusdb.public.support.sql 5 16th January 2015 05:40 AM
display currency without currency signature and without changing regional settings Jago Post nexusdb.public.support 1 6th August 2006 10:03 AM
display currency field without currency sign without changing regional settings Jago Post nexusdb.public.support 4 25th July 2006 08:30 AM
Question about SUM and rounding.. Don Miller nexusdb.public.support.sql 1 1st May 2006 01:14 AM


All times are GMT +11. The time now is 05:38 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.