Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Arithmetics
That is because you don't use printf/ sprintf. Printf/sprintf helps you handle this thing
correctly. Try executing the following code:
my $x=1.999999999999999999999;
The result will be "2.0".
Herzliche Gruessen.
On 2003.12.03 05:54, Stefan Jahnke wrote:
> Hi list
>
> In PL/SQL, 174413 - 169281.6 (as FLOAT) results in 5131.4 as it should.
> In Perl, it results in 5131.39999999999. In C++ (GCC on both Linux and MS
> Windows) it results in 5131.4.
> I find it pretty irritating that perl doesn't handle that correctly.
> I know, it's always a problem with floating point arithmetics, but how is
> it, that perl already says good bye to accurate results while PL/SQL and C
> both still give the correct result ?
> Is there any work around or something I have to consider when doing floating
> point arithmetics in Perl ?
> I need to have accurate values without rounding them for statistic
> calculations.
>
> TIA,
> Stefan
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Stefan Jahnke
> INET: Stefan.Jahnke_at_bov.de
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
-- Mladen Gogala Oracle DBA -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: mgogala_at_adelphia.net Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Dec 03 2003 - 05:44:24 CST