Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Roundoff error question
I have added a select after each update. The difference is where you
have .09.. in your calculations the query shows a value of 1.
UT1 > set numwidth 38
UT1 > CREATE TABLE roundoff_error (N NUMBER);
Table created.
UT1 > INSERT INTO roundoff_error(N) values(1/190);
1 row created.
UT1 > SELECT * FROM roundoff_error;
N
--------------------------------------
UT1 > UPDATE roundoff_error SET N = N * 10;
1 row updated.
UT1 > SELECT * FROM roundoff_error;
N
--------------------------------------
UT1 > UPDATE roundoff_error SET N = N * 19;
1 row updated.
UT1 > SELECT * FROM roundoff_error;
N
--------------------------------------
1
UT1 > UPDATE roundoff_error SET N = N - 1;
1 row updated.
UT1 > SELECT * FROM roundoff_error;
N
--------------------------------------
-6.0000000000000000000000000000000E-40
HTH -- Mark D Powell -- Received on Thu Oct 27 2005 - 10:53:58 CDT