0002-whitespace-fixes-for-the-CMath-module.patch

Jason Dew, 05/17/2011 09:50 AM

Download (2.37 KB)

View differences:

lib/cmath.rb
36 36
      exp!(z)
37 37
    else
38 38
      ere = exp!(z.real)
39
      Complex(ere * cos!(z.imag),
40
	      ere * sin!(z.imag))
39
      Complex(ere * cos!(z.imag), ere * sin!(z.imag))
41 40
    end
42 41
  end
43 42

  
......
51 50
    else
52 51
      a = Complex(log!(z.abs), z.arg)
53 52
      if b
54
	a /= log(b)
53
        a /= log(b)
55 54
      end
56 55
      a
57 56
    end
......
82 81
  def sqrt(z)
83 82
    if z.real?
84 83
      if z < 0
85
	Complex(0, sqrt!(-z))
84
        Complex(0, sqrt!(-z))
86 85
      else
87
	sqrt!(z)
86
        sqrt!(z)
88 87
      end
89 88
    else
90
      if z.imag < 0 ||
91
	  (z.imag == 0 && z.imag.to_s[0] == '-')
92
	sqrt(z.conjugate).conjugate
89
      if z.imag < 0 || (z.imag == 0 && z.imag.to_s[0] == '-')
90
        sqrt(z.conjugate).conjugate
93 91
      else
94
	r = z.abs
95
	x = z.real
96
	Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
92
        r = z.abs
93
        x = z.real
94
        Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
97 95
      end
98 96
    end
99 97
  end
......
114 112
    if z.real?
115 113
      sin!(z)
116 114
    else
117
      Complex(sin!(z.real) * cosh!(z.imag),
118
	      cos!(z.real) * sinh!(z.imag))
115
      Complex(sin!(z.real) * cosh!(z.imag), cos!(z.real) * sinh!(z.imag))
119 116
    end
120 117
  end
121 118

  
......
125 122
    if z.real?
126 123
      cos!(z)
127 124
    else
128
      Complex(cos!(z.real) * cosh!(z.imag),
129
	      -sin!(z.real) * sinh!(z.imag))
125
      Complex(cos!(z.real) * cosh!(z.imag), -sin!(z.real) * sinh!(z.imag))
130 126
    end
131 127
  end
132 128

  
......
146 142
    if z.real?
147 143
      sinh!(z)
148 144
    else
149
      Complex(sinh!(z.real) * cos!(z.imag),
150
	      cosh!(z.real) * sin!(z.imag))
145
      Complex(sinh!(z.real) * cos!(z.imag), cosh!(z.real) * sin!(z.imag))
151 146
    end
152 147
  end
153 148

  
......
157 152
    if z.real?
158 153
      cosh!(z)
159 154
    else
160
      Complex(cosh!(z.real) * cos!(z.imag),
161
	      sinh!(z.real) * sin!(z.imag))
155
      Complex(cosh!(z.real) * cos!(z.imag), sinh!(z.real) * sin!(z.imag))
162 156
    end
163 157
  end
164 158

  
165
-