Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
116ec56
* version.h (RUBY_VERSION): bump RUBY_VERSION to 2.1.7.
unak Apr 14, 2015
976bf35
merge revision(s) 49154,49155,49156,49159: [Backport #10384] [Backpor…
unak Apr 24, 2015
513b313
merge revision(s) 50316: [Backport #11030]
unak Apr 28, 2015
7829c32
merge revision(s) 50141: [Backport #11021]
unak Apr 28, 2015
4a680e8
merge revision(s) 50402: [Backport #11107]
unak May 11, 2015
14c7be2
merge revision(s) 50416: [Backport #11111]
unak May 11, 2015
dd4cf6b
* ext/tk/extconf.rb: support Tcl/Tk8.6.
unak May 12, 2015
0cddf1b
merge revision(s) 49095: [Backport #11144]
unak May 13, 2015
79881c9
merge revision(s) 50541,50542: [Backport #11159]
unak May 20, 2015
f1cb00f
merge revision(s) 49776: [Backport #9144]
unak May 21, 2015
bf8a18a
merge revision(s) 49792: [Backport #10918]
unak May 21, 2015
53ce4da
merge revision(s) 50185: [Backport #10952]
unak May 21, 2015
e358e2f
merge revision(s) 50187,50202: [Backport #11051]
unak May 21, 2015
39a6566
merge revision(s) 50206: [Backport #10724]
unak May 21, 2015
bdf81a6
merge revision(s) 50305: [Backport #11065]
unak May 21, 2015
ad70c73
merge revision(s) 50404,50405: [Backport #10975]
unak May 21, 2015
137514a
merge revision(s) 50406,50407: [Backport #11075]
unak May 21, 2015
7a03d46
merge revision(s) 50421: [Backport #11113]
unak May 21, 2015
a2126a6
merge revision(s) 50509: [Backport #11132]
unak May 21, 2015
7944b62
merge revision(s) 50444: [Backport #11128]
unak May 21, 2015
3a31231
merge revision(s) 50449: [Backport #11123]
unak May 21, 2015
ed737b8
merge revision(s) 49999,50000: [Backport #10979]
unak May 28, 2015
847b7bc
* marshal.c (r_symreal): register the symbol name first so that
unak May 29, 2015
e8dc702
Partially merge revision 49195: [Bug #10717]
unak May 29, 2015
6f97605
merge revision(s) 49618,49640: [Backport #10858]
unak May 29, 2015
0d1f4fb
merge revision(s) 49491: [Backport #10823]
unak May 29, 2015
4def227
merge revision(s) 50515: [Backport #11155]
unak Jun 9, 2015
16b551f
merge revision(s) 50637: [Backport #11172]
unak Jun 9, 2015
7d7ed2c
merge revision(s) 50646: [Backport #11185]
unak Jun 9, 2015
f201642
merge revision(s) 50685: [Backport #11198]
unak Jun 9, 2015
9af0f53
merge revision(s) 49898: [Backport #10951]
unak Jun 17, 2015
61f3bae
merge revision(s) 50982,50983: [Backport #11291]
unak Jun 29, 2015
ee15197
merge revision(s) 49224,49225,49234,49235: [Backport #10711]
unak Jun 30, 2015
dffe87c
merge revision(s) 50887,50896,50902: [Backport #11060]
unak Jul 3, 2015
1bd36e3
merge revision(s) 50430,50440: [Backport #11117]
unak Jul 3, 2015
a57c925
merge revision(s) 50793,51120: [Backport #11162]
unak Jul 3, 2015
bf57198
merge revision(s) 50671: [Backport #11192]
unak Jul 3, 2015
f81db3c
merge revision(s) 50717: [Backport #11201]
unak Jul 3, 2015
759d128
merge revision(s) 49235: [Backport #10711]
unak Jul 3, 2015
b0ed276
* test/ruby/test_require.rb (TestRequire#test_loading_fifo_threading):
unak Jul 3, 2015
6282b15
* test/ruby/test_require.rb (TestRequire#test_loading_fifo_threading):
unak Jul 3, 2015
e25bb03
merge revision(s) 50972:
unak Jul 7, 2015
a0cf0fb
merge revision(s) 50860: [Backport #11249]
unak Jul 7, 2015
c7458b5
merge revision(s) 50834: [Backport #11221]
unak Jul 7, 2015
e9ea9d6
merge revision(s) 49542: [Backport #10820]
unak Aug 17, 2015
b2bb029
merge revision(s) 50827,50921: [Backport #11235]
unak Aug 17, 2015
7766666
merge revision(s) 51037: [Backport #11277]
unak Aug 17, 2015
a61756e
merge revision(s) 49788,49790: [Backport #10904]
unak Aug 17, 2015
51954bd
merge revision(s) 51344: [Backport #11387]
unak Aug 17, 2015
59f1eaa
merge revision(s) 51263,51264: [Backport #11352]
unak Aug 17, 2015
9580200
merge revision(s) 51061,51063,51091: [Backport #11285]
unak Aug 17, 2015
ccef579
merge revision(s) 51213: [Backport #11344]
unak Aug 17, 2015
d3a6478
merge revision(s) 51531: [Backport #11368]
unak Aug 17, 2015
510bdd1
merge revision(s) 51350: [Backport #11380]
unak Aug 17, 2015
bd929bb
merge revision(s) 51202,51203,51204: [Backport #11340]
unak Aug 17, 2015
d3cd7b4
merge revision(s) 51409,51453: [Backport #10910]
unak Aug 17, 2015
a5ffcda
merge revision(s) 46681,51464,51465: [Backport #11058]
unak Aug 17, 2015
190241f
merge revision(s) 51046: [Backport #11260]
unak Aug 17, 2015
813b5f4
merge revision(s) 51066: [Backport #11319]
unak Aug 17, 2015
445954a
merge revision(s) 44497: [Backport #11441]
unak Aug 17, 2015
170f64d
merge revision(s) 51423,51425: [Backport #9381]
unak Aug 17, 2015
4bf7894
merge revision(s) 51116: [Backport #11324]
unak Aug 17, 2015
26eb8e4
merge revision(s) 51470: [Backport #11413]
unak Aug 17, 2015
911ade3
merge revision(s) 51575,51584: [Backport #11439]
unak Aug 17, 2015
9ce1bf8
merge revision(s) 50829: [Backport #11248]
unak Aug 18, 2015
0f66473
add tag v2_1_7
unak Aug 18, 2015
eef7698
Merge tag 'v2_1_7' into 2.1
dbussink Aug 19, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge revision(s) 50793,51120: [Backport ruby#11162]
	* lib/cmath.rb: [DOC] Add docs [ci skip][Fix rubyGH-909][Bug ruby#11162]
	Patch provided by @davydovanton

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Jul 3, 2015
commit a57c9250608f6e0de74d659010ad7476a866cdea
68 changes: 55 additions & 13 deletions lib/cmath.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
##
# = Trigonometric and transcendental functions for complex numbers.
#
# CMath is a library that provides trigonometric and transcendental
# functions for complex numbers.
# functions for complex numbers. The functions in this module accept
# integers, floating-point numbers or complex numbers as arguments.
#
# Note that the selection of functions is similar, but not identical,
# to that in module math. The reason for having two modules is that
# some users aren’t interested in complex numbers, and perhaps don’t
# even know what they are. They would rather have Math.sqrt(-1) raise
# an exception than return a complex number.
#
# == Usage
#
# To start using this library, simply:
# To start using this library, simply require cmath library:
#
# require "cmath"
#
# Square root of a negative number is a complex number.
# And after call any CMath function. For example:
#
# CMath.sqrt(-9) #=> 0+3.0i
# CMath.exp(0 + 0i) #=> 1.0+0.0i
# CMath.log10(-5.to_c) #=> (0.6989700043360187+1.3643763538418412i)
#
# CMath.sqrt(-9) #=> 0+3.0i
#
# For more information you can see Complec class.

module CMath

Expand Down Expand Up @@ -44,9 +57,7 @@ module CMath
##
# Math::E raised to the +z+ power
#
# exp(Complex(0,0)) #=> 1.0+0.0i
# exp(Complex(0,PI)) #=> -1.0+1.2246467991473532e-16i
# exp(Complex(0,PI/2.0)) #=> 6.123233995736766e-17+1.0i
# CMath.exp(2i) #=> (-0.4161468365471424+0.9092974268256817i)
def exp(z)
begin
if z.real?
Expand All @@ -62,10 +73,11 @@ def exp(z)
end

##
# Returns the natural logarithm of Complex. If a second argument is given,
# Returns the natural logarithm of Complex. If a second argument is given,
# it will be the base of logarithm.
#
# log(Complex(0,0)) #=> -Infinity+0.0i
# CMath.log(1 + 4i) #=> (1.416606672028108+1.3258176636680326i)
# CMath.log(1 + 4i, 10) #=> (0.6152244606891369+0.5757952953408879i)
def log(*args)
begin
z, b = args
Expand All @@ -88,6 +100,8 @@ def log(*args)

##
# returns the base 2 logarithm of +z+
#
# CMath.log2(-1) => (0.0+4.532360141827194i)
def log2(z)
begin
if z.real? and z >= 0
Expand All @@ -102,6 +116,8 @@ def log2(z)

##
# returns the base 10 logarithm of +z+
#
# CMath.log10(-1) #=> (0.0+1.3643763538418412i)
def log10(z)
begin
if z.real? and z >= 0
Expand All @@ -116,9 +132,8 @@ def log10(z)

##
# Returns the non-negative square root of Complex.
# sqrt(-1) #=> 0+1.0i
# sqrt(Complex(-1,0)) #=> 0.0+1.0i
# sqrt(Complex(0,8)) #=> 2.0+2.0i
#
# CMath.sqrt(-1 + 0i) #=> 0.0+1.0i
def sqrt(z)
begin
if z.real?
Expand All @@ -144,12 +159,16 @@ def sqrt(z)

##
# returns the principal value of the cube root of +z+
#
# CMath.cbrt(1 + 4i) #=> (1.449461632813119+0.6858152562177092i)
def cbrt(z)
z ** (1.0/3)
end

##
# returns the sine of +z+, where +z+ is given in radians
#
# CMath.sin(1 + 1i) #=> (1.2984575814159773+0.6349639147847361i)
def sin(z)
begin
if z.real?
Expand All @@ -165,6 +184,8 @@ def sin(z)

##
# returns the cosine of +z+, where +z+ is given in radians
#
# CMath.cos(1 + 1i) #=> (0.8337300251311491-0.9888977057628651i)
def cos(z)
begin
if z.real?
Expand All @@ -180,6 +201,8 @@ def cos(z)

##
# returns the tangent of +z+, where +z+ is given in radians
#
# CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)
def tan(z)
begin
if z.real?
Expand All @@ -194,6 +217,8 @@ def tan(z)

##
# returns the hyperbolic sine of +z+, where +z+ is given in radians
#
# CMath.sinh(1 + 1i) #=> (0.6349639147847361+1.2984575814159773i)
def sinh(z)
begin
if z.real?
Expand All @@ -209,6 +234,8 @@ def sinh(z)

##
# returns the hyperbolic cosine of +z+, where +z+ is given in radians
#
# CMath.cosh(1 + 1i) #=> (0.8337300251311491+0.9888977057628651i)
def cosh(z)
begin
if z.real?
Expand All @@ -224,6 +251,8 @@ def cosh(z)

##
# returns the hyperbolic tangent of +z+, where +z+ is given in radians
#
# CMath.tanh(1 + 1i) #=> (1.0839233273386943+0.27175258531951174i)
def tanh(z)
begin
if z.real?
Expand All @@ -238,6 +267,8 @@ def tanh(z)

##
# returns the arc sine of +z+
#
# CMath.asin(1 + 1i) #=> (0.6662394324925153+1.0612750619050355i)
def asin(z)
begin
if z.real? and z >= -1 and z <= 1
Expand All @@ -252,6 +283,8 @@ def asin(z)

##
# returns the arc cosine of +z+
#
# CMath.acos(1 + 1i) #=> (0.9045568943023813-1.0612750619050357i)
def acos(z)
begin
if z.real? and z >= -1 and z <= 1
Expand All @@ -266,6 +299,8 @@ def acos(z)

##
# returns the arc tangent of +z+
#
# CMath.atan(1 + 1i) #=> (1.0172219678978514+0.4023594781085251i)
def atan(z)
begin
if z.real?
Expand All @@ -281,6 +316,8 @@ def atan(z)
##
# returns the arc tangent of +y+ divided by +x+ using the signs of +y+ and
# +x+ to determine the quadrant
#
# CMath.atan2(1 + 1i, 0) #=> (1.5707963267948966+0.0i)
def atan2(y,x)
begin
if y.real? and x.real?
Expand All @@ -295,6 +332,8 @@ def atan2(y,x)

##
# returns the inverse hyperbolic sine of +z+
#
# CMath.asinh(1 + 1i) #=> (1.0612750619050357+0.6662394324925153i)
def asinh(z)
begin
if z.real?
Expand All @@ -309,6 +348,8 @@ def asinh(z)

##
# returns the inverse hyperbolic cosine of +z+
#
# CMath.acosh(1 + 1i) #=> (1.0612750619050357+0.9045568943023813i)
def acosh(z)
begin
if z.real? and z >= 1
Expand All @@ -323,6 +364,8 @@ def acosh(z)

##
# returns the inverse hyperbolic tangent of +z+
#
# CMath.atanh(1 + 1i) #=> (0.4023594781085251+1.0172219678978514i)
def atanh(z)
begin
if z.real? and z >= -1 and z <= 1
Expand Down Expand Up @@ -397,4 +440,3 @@ def handle_no_method_error # :nodoc:
module_function :handle_no_method_error

end

2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.7"
#define RUBY_RELEASE_DATE "2015-07-03"
#define RUBY_PATCHLEVEL 371
#define RUBY_PATCHLEVEL 372

#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 7
Expand Down