Closed koic closed 7 years ago
Fix https://github.com/kubo/ruby-oci8/issues/143 .
BigDecimal has changed that raise error for an invalid string for BigDecimal() in Ruby 2.4.0 RC1.
BigDecimal()
https://github.com/ruby/bigdecimal/commit/3081a627cebdc1fc119425c7a9f009dbb6bec8e8
We can use both "1.E+00" and "1.0E+00" for BigDecimal().
"1.E+00"
"1.0E+00"
require "bigdecimal" BigDecimal("1.E+00").to_s #=> "0.1E1" BigDecimal("1.E+00") == BigDecimal("1.0E+00") #=> true
We can not use "1.E+00" that will result ArgumentError.
ArgumentError
require "bigdecimal" BigDecimal("1.E+00") #=> ArgumentError: invalid value for BigDecimal(): "1.E+00" BigDecimal("1.0E+00") #=> 0.1e1
This PR has change below.
Previously used format of to_char:
to_char
OraNumber(1).to_char('FM9.99999999999999999999999999999999999999EEEE') #=> "1.E+00"
This PR used format of to_char:
OraNumber(1).to_char('FM9.09999999999999999999999999999999999999EEEE') #=> "1.0E+00"
See also, I'm asking questions about BigDecimal() change.
https://github.com/ruby/bigdecimal/issues/47 .
By the way, I think that this PR change using "1.0E+00" is better, maybe.
Related issue: https://github.com/rsim/oracle-enhanced/issues/1085
Thanks.
Confirmed this pull request addresses this issue and rsim/oracle-enhanced#1085 . Thanks.
@koic Thanks a lot!
Thanks for merging.
Fix https://github.com/kubo/ruby-oci8/issues/143 .
BigDecimal has changed that raise error for an invalid string for
BigDecimal()
in Ruby 2.4.0 RC1.https://github.com/ruby/bigdecimal/commit/3081a627cebdc1fc119425c7a9f009dbb6bec8e8
Before (Ruby 2.3.3)
We can use both
"1.E+00"
and"1.0E+00"
forBigDecimal()
.After (Ruby 2.4.0 RC1)
We can not use
"1.E+00"
that will resultArgumentError
.This PR has change below.
Previously used format of
to_char
:This PR used format of
to_char
:See also, I'm asking questions about
BigDecimal()
change.https://github.com/ruby/bigdecimal/issues/47 .
By the way, I think that this PR change using
"1.0E+00"
is better, maybe.Related issue: https://github.com/rsim/oracle-enhanced/issues/1085
Thanks.