why works
select 10000000000000000000000000000000000000000*9 dual --41 digit number output:
90000000000000000000000000000000000000000 but gives uncorrect result
select 10000000000000000000000000000000000000000+1 dual --41 digit number output:
10000000000000000000000000000000000000000 i cant understand why oracle can multiply large number 9 fail add 1 !
as comments hinting at, hitting limits of oracle's number precision. in other words, oracle has limit of significant digits can handle (even in memory) before being forced perform rounding , start losing precision, observed.
although example makes behavior seem counter-intuitive, make sense if illustrate seeing how translate these numbers scientific notation.
so number 10000000000000000000000000000000000000000, can represented concisely in following form: 1e+40.
however, in order represent number 10000000000000000000000000000000000000001, there no concise way represent that. if don't want lose precision, in scientific notation, shortest way represent 10000000000000000000000000000000000000001e+0. takes lot more space simple 1e+40.
in contrast, number 90000000000000000000000000000000000000000 can represented concisely so: 9e+40.
so yes, last number larger previous one, oracle has no problem representing precision because doesn't have many significant digits.
Comments
Post a Comment