mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/bigdecimal/lib/bigdecimal/math.rb (atan): reduce loop with
the formula of the double corner. based on a patch from Masahiro Kanai (CanI) in [ruby-dev:39367]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									12fcef8829
								
							
						
					
					
						commit
						1ef3ac4738
					
				
					 2 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,9 @@
 | 
			
		|||
Thu Sep 24 02:08:35 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* ext/bigdecimal/lib/bigdecimal/math.rb (atan): reduce loop with
 | 
			
		||||
	  the formula of the double corner.  based on a patch from
 | 
			
		||||
	  Masahiro Kanai (CanI) in [ruby-dev:39367].
 | 
			
		||||
 | 
			
		||||
Thu Sep 24 01:14:18 2009  Yutaka Kanemoto  <kanemoto@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* dln.c (aix_loaderror): fixed typo. suppress warnings.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,11 +125,14 @@ module BigMath
 | 
			
		|||
    if neg = x < 0
 | 
			
		||||
      x = -x
 | 
			
		||||
    end
 | 
			
		||||
    if x == 1
 | 
			
		||||
    if x.round(prec) == 1
 | 
			
		||||
      return pi / (neg ? -4 : 4)
 | 
			
		||||
    elsif inv = x > 1
 | 
			
		||||
      x = 1 / x
 | 
			
		||||
    end
 | 
			
		||||
    if dbl = x > 0.5
 | 
			
		||||
      x = (-1 + sqrt(1 + x**2, prec))/x
 | 
			
		||||
    end
 | 
			
		||||
    n    = prec + BigDecimal.double_fig
 | 
			
		||||
    y = x
 | 
			
		||||
    d = y
 | 
			
		||||
| 
						 | 
				
			
			@ -143,6 +146,7 @@ module BigMath
 | 
			
		|||
      y += d
 | 
			
		||||
      r += 2
 | 
			
		||||
    end
 | 
			
		||||
    y *= 2 if dbl
 | 
			
		||||
    y = pi / 2 - y if inv
 | 
			
		||||
    y = -y if neg
 | 
			
		||||
    y
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue