From: | Alexander Yerenkow <yerenkow(at)gmail(dot)com> |
---|---|
To: | Kanitchet Vaiassava <kanichet(at)hotmail(dot)com> |
Cc: | pgadmin-support(at)postgresql(dot)org, Kanitchet Vaiassava <kanitchet(dot)vai(at)thaiace(dot)co(dot)th>, Thanarit Maneechote <thanarit(dot)man(at)thaiace(dot)co(dot)th> |
Subject: | Re: (Bug) Numeric fault calculation |
Date: | 2013-04-23 08:48:55 |
Message-ID: | CAPJF9w=_XekyYy5R8MUhOKdxdA9RbCTHkU_723Y-Cc35GDTrUA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support |
Try
select (260739.94::double precision * (1.00::double precision /
365.00::double precision) )
default precision in postgres is pretty lossy, use double precision
whenever you need max precision.
2013/4/23 Kanitchet Vaiassava <kanichet(at)hotmail(dot)com>
> **
> *(Bug) Numeric fault calculation*
>
> My company has using postgresql as database for ERP application which
> in-house developed.
> For store financial and accounting data, we chose "numeric" type for
> accurate calculation (and with recommend by postgres's documentation) and
> we faced the problem by using "double precision" before.
>
> However, we found that by using numeric had the problem too.
> In our formula for calculate interest for customer's overdue payment
> that using numeric,
> we found that it had fault calculate. So, it effected our interest amount.
>
> In the attached file you can see that the result from postgresql and by
> using long division method is difference.
>
> *postgresql :* 714.35599999999xxxx
> *long division method*: 714.356
>
> and if we multiply this result with interest rate and others factor and
> round up later. the amount is miscalculate.
>
> Thank you and sorry for bad english gramma.
>
>
> Best Regards,
> Kanitchet Vaiassava
> ThaiAce Group
> 555 Nawamin Rd., Klongkum, Buengkum, Bangkok 10230, Thailand
> Mobile +66 89 515 9955; Office +66 2 744 2288; Fax +66 2 379 1166
>
> ---------------------------------------------------------------------------------------------------------------
>
>
> --
> Sent via pgadmin-support mailing list (pgadmin-support(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-support
>
>
--
Regards,
Alexander Yerenkow
From | Date | Subject | |
---|---|---|---|
Next Message | Kanitchet Vaiassava | 2013-04-23 09:17:09 | Fw: (Bug) Numeric fault calculation |
Previous Message | Kanitchet Vaiassava | 2013-04-23 08:37:26 | (Bug) Numeric fault calculation |