From: Marc-Andre Lafortune Date: 2009-10-11T02:23:13+09:00 Subject: [ruby-core:26044] [Bug #2189](Open) Math.atanh(1) & Math.atanh(-1) should not raise an error Issue #2189 has been updated by Marc-Andre Lafortune. Status changed from Assigned to Open I should have ran make test-all, I'm sorry. I also should have realized that the correct solution should have been more careful about platform independence. I'll be more careful in the future. I will also have to find out why I currently get 6 failures and 3 errors running test-all... ---------------- As to the question if atanh should raise an error or return +/- infinity, I'd like to point out: a) The SUSv3 sentence given above continues and states "If x is ��1, a pole error shall occur, and atanh() shall return the value of the macro HUGE_VAL with the same sign as the correct value of the function." Since it is not possible to both return a value and raise an error in Ruby, a choice must be made even if one wants to follow SUSv3. Also, isn't a pole error different from a range error or a domain error in that document? b) In math, atanh(tanh(x)) == x. Since tanh(x=1.0/0) doesn't raise an error, I believe atanh should not raise an error and return x. c) atanh(��1) returns ��infinity in the following programs: - Mathematica - Matlab - Python - C++ boost library I therefore suggest to make an explicit check for ��1 and return ��Infinity in those cases, so to have a result that is: - platform independent (1.8.x's result is currently platform dependent) - useful - mathematically valid Thanks ---------------------------------------- http://redmine.ruby-lang.org/issues/show/2189 ---------------------------------------- http://redmine.ruby-lang.org