-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
power
and fix
methods
#1
base: master
Are you sure you want to change the base?
Conversation
@hmdne are you okay with this? Thanks! |
Looks good to me. I will backport it to the |
In short, all is fine, a couple of additional Rubyspec tests are passing now (https://github.com/ruby/spec/tree/ee83ee683bf15bb2bdd98498069f298abefbdbcc is the repo): fails "BigDecimal#** 0 to power of 0 is 1" # NoMethodError: undefined method `**' for 0
fails "BigDecimal#** 0 to powers < 0 is Infinity" # NoMethodError: undefined method `**' for 0
fails "BigDecimal#** other powers of 0 are 0" # NoMethodError: undefined method `**' for 0
fails "BigDecimal#** powers of 1 equal 1" # NoMethodError: undefined method `**' for 1
fails "BigDecimal#** returns 0.0 if self is infinite and argument is negative" # NoMethodError: undefined method `**' for Infinity
fails "BigDecimal#** returns NaN if self is NaN" # NoMethodError: undefined method `**' for NaN
fails "BigDecimal#** returns infinite if self is infinite and argument is positive" # NoMethodError: undefined method `**' for Infinity
fails "BigDecimal#fix correctly handles special values" # NoMethodError: undefined method `fix' for Infinity
fails "BigDecimal#fix does not allow any arguments" # Expected ArgumentError but got: NoMethodError (undefined method `fix' for 1.23456789)
fails "BigDecimal#fix returns 0 if the absolute value is < 1" # NoMethodError: undefined method `fix' for 0.99999
fails "BigDecimal#fix returns a BigDecimal" # NoMethodError: undefined method `fix' for Infinity
fails "BigDecimal#fix returns the integer part of the absolute value" # NoMethodError: undefined method `fix' for 2e+1000
fails "BigDecimal#power 0 to power of 0 is 1" # NoMethodError: undefined method `power' for 0
fails "BigDecimal#power 0 to powers < 0 is Infinity" # NoMethodError: undefined method `power' for 0
fails "BigDecimal#power other powers of 0 are 0" # NoMethodError: undefined method `power' for 0
fails "BigDecimal#power powers of 1 equal 1" # NoMethodError: undefined method `power' for 1
fails "BigDecimal#power returns 0.0 if self is infinite and argument is negative" # NoMethodError: undefined method `power' for Infinity
fails "BigDecimal#power returns NaN if self is NaN" # NoMethodError: undefined method `power' for NaN
fails "BigDecimal#power returns infinite if self is infinite and argument is positive" # NoMethodError: undefined method `power' for Infinity But also there are new failures, which probably were disabled due to missing functions, some of which you may want to correct for better compatibility. fails "BigDecimal#truncate returns NaN if self is NaN" # ArgumentError: [BigDecimal#fix] wrong number of arguments (given 1, expected 0)
fails "BigDecimal#truncate returns value of type Integer." # Expected false == true to be truthy but was false
fails "BigDecimal#truncate sets n digits left of the decimal point to 0, if given n < 0" # ArgumentError: [BigDecimal#fix] wrong number of arguments (given 1, expected 0) |
@hmdne, I have fixed the for example In Ruby:
But in BigNumber this will raise the following error (as mentioned here):
can we skip the cc: @ronaldtse |
This PR adds the support
power
andfix
methods for consistency with BigDecimal-Ruby.related to => plurimath/plurimath-js#28