# HG changeset patch
# User Robert Bradshaw <robertwb@math.washington.edu>
# Date 1263066099 28800
# Node ID 925df2316d52179ed2025dcdc46c63120b32c8fe
# Parent eb1b6cc7087907589a6592e331a3adfbc78b2014
Trac #7879: Remove unnecessary signal handling for low prec mpfr operations.
diff git a/sage/rings/real_mpfr.pyx b/sage/rings/real_mpfr.pyx
a

b


167  167  cdef object numpy_double_interface = {'typestr': '=f8'} 
168  168  cdef object numpy_object_interface = {'typestr': 'O'} 
169  169  
 170  # Avoid signal handling for cheap operations when the 
 171  # precision is below this threshold. 
 172  cdef enum: 
 173  SIG_PREC_THRESHOLD = 1000 
 174  
170  175  #***************************************************************************** 
171  176  # 
172  177  # External Python access to constants 
… 
… 

810  815  sage: R.pi().sqrt()/2 
811  816  0.88622692545275801364908374167057259139877473 
812  817  """ 
813   cdef RealNumber x 
814   x = self._new() 
815   sig_on() 
 818  cdef RealNumber x = self._new() 
 819  if self.__prec > SIG_PREC_THRESHOLD: sig_on() 
816  820  # The docs for mpfr_free_cache say "Free the cache used by 
817  821  # the functions computing constants if needed (currently 
818  822  # mpfr_const_log2, mpfr_const_pi and mpfr_const_euler)", so 
… 
… 

822  826  # functions, but this free is needed for them too! 
823  827  mpfr_free_cache() 
824  828  mpfr_const_pi(x.value, self.rnd) 
825   sig_off() 
 829  if self.__prec > SIG_PREC_THRESHOLD: sig_off() 
826  830  return x 
827  831  
828  832  
… 
… 

836  840  sage: RealField(100).euler_constant() 
837  841  0.57721566490153286060651209008 
838  842  """ 
839   cdef RealNumber x 
840   x = self._new() 
 843  cdef RealNumber x = self._new() 
841  844  sig_on() 
842  845  mpfr_free_cache() 
843  846  mpfr_const_euler(x.value, self.rnd) 
… 
… 

854  857  sage: RealField(100).catalan_constant() 
855  858  0.91596559417721901505460351493 
856  859  """ 
857   cdef RealNumber x 
858   x = self._new() 
859   sig_on() 
 860  cdef RealNumber x = self._new() 
 861  if self.__prec > SIG_PREC_THRESHOLD: sig_on() 
860  862  mpfr_free_cache() 
861  863  mpfr_const_catalan(x.value, self.rnd) 
862   sig_off() 
 864  if self.__prec > SIG_PREC_THRESHOLD: sig_off() 
863  865  return x 
864  866  
865  867  # int mpfr_const_log2 (mpfr_t rop, mp_rnd_t rnd) 
… 
… 

877  879  0.69314718055994530941723212146 
878  880  """ 
879  881  cdef RealNumber x = self._new() 
880   sig_on() 
 882  if self.__prec > SIG_PREC_THRESHOLD: sig_on() 
881  883  mpfr_free_cache() 
882  884  mpfr_const_log2(x.value, self.rnd) 
883   sig_off() 
 885  if self.__prec > SIG_PREC_THRESHOLD: sig_off() 
884  886  return x 
885  887  
886  888  def random_element(self, min=1, max=1, distribution=None): 
… 
… 

963  965  if n < 0: 
964  966  raise ArithmeticError, "n must be nonnegative" 
965  967  x = self._new() 
966   sig_on() 
 968  if self.__prec > SIG_PREC_THRESHOLD and n < SIG_PREC_THRESHOLD: sig_on() 
967  969  mpfr_fac_ui(x.value, n, self.rnd) 
968   sig_off() 
 970  if self.__prec > SIG_PREC_THRESHOLD and n < SIG_PREC_THRESHOLD: sig_off() 
969  971  return x 
970  972  
971  973  def rounding_mode(self): 
… 
… 

1868  1870  sage: R(1.5) + R(2.5) 
1869  1871  1.00000000000000 
1870  1872  """ 
1871   cdef RealNumber x 
1872   x = self._new() 
 1873  cdef RealNumber x = self._new() 
1873  1874  mpfr_add(x.value, self.value, (<RealNumber>other).value, (<RealField_class>self._parent).rnd) 
1874  1875  return x 
1875  1876  
… 
… 

1886  1887  sage: R(1.5)  R(2.5) 
1887  1888  4.00000000000000 
1888  1889  """ 
1889   cdef RealNumber x 
1890   x = self._new() 
 1890  cdef RealNumber x = self._new() 
1891  1891  mpfr_sub(x.value, self.value, (<RealNumber>right).value, (<RealField_class> self._parent).rnd) 
1892  1892  return x 
1893  1893  
… 
… 

1921  1921  sage: parent(b*a) 
1922  1922  Real Field with 20 bits of precision 
1923  1923  """ 
1924   cdef RealNumber x 
1925   x = self._new() 
 1924  cdef RealNumber x = self._new() 
1926  1925  mpfr_mul(x.value, self.value, (<RealNumber>right).value, (<RealField_class>self._parent).rnd) 
1927  1926  return x 
1928  1927  
… 
… 

1945  1944  sage: R(1.5) / R(2.5) 
1946  1945  0.600000000000000 
1947  1946  """ 
1948   cdef RealNumber x 
1949   x = self._new() 
 1947  cdef RealNumber x = self._new() 
1950  1948  mpfr_div((<RealNumber>x).value, self.value, 
1951  1949  (<RealNumber>right).value, (<RealField_class>self._parent).rnd) 
1952  1950  return x 
… 
… 

1964  1962  sage: RR('nan')._neg_() 
1965  1963  NaN 
1966  1964  """ 
1967   cdef RealNumber x 
1968   x = self._new() 
 1965  cdef RealNumber x = self._new() 
1969  1966  mpfr_neg(x.value, self.value, (<RealField_class>self._parent).rnd) 
1970  1967  return x 
1971  1968  
… 
… 

2001  1998  sage: RR('nan').abs() 
2002  1999  NaN 
2003  2000  """ 
2004   cdef RealNumber x 
2005   x = self._new() 
 2001  cdef RealNumber x = self._new() 
2006  2002  mpfr_abs(x.value, self.value, (<RealField_class>self._parent).rnd) 
2007  2003  return x 
2008  2004  
… 
… 

2058  2054  """ 
2059  2055  if n > sys.maxint: 
2060  2056  raise OverflowError, "n (=%s) must be <= %s"%(n, sys.maxint) 
2061   cdef RealNumber x 
2062   x = self._new() 
 2057  cdef RealNumber x = self._new() 
2063  2058  mpfr_div_2exp(x.value, self.value, n, (<RealField_class>self._parent).rnd) 
2064  2059  return x 
2065  2060  
… 
… 

2248  2243  sage: RR(0.5).round() 
2249  2244  1 
2250  2245  """ 
2251   cdef RealNumber x 
2252   x = self._new() 
 2246  cdef RealNumber x = self._new() 
2253  2247  mpfr_round(x.value, self.value) 
2254  2248  return x.integer_part() 
2255  2249  
… 
… 

2326  2320  sage: (0.00).trunc() 
2327  2321  0 
2328  2322  """ 
2329   cdef RealNumber x 
2330   x = self._new() 
 2323  cdef RealNumber x = self._new() 
2331  2324  mpfr_trunc(x.value, self.value) 
2332  2325  return x.integer_part() 
2333  2326  
… 
… 

2380  2373  else: 
2381  2374  other_rn = self._parent(other) 
2382  2375  
2383   cdef RealNumber x 
2384   x = self._new() 
 2376  cdef RealNumber x = self._new() 
2385  2377  
2386  2378  mpfr_set(x.value, self.value, GMP_RNDN) 
2387  2379  mpfr_nexttoward(x.value, other_rn.value) 
… 
… 

2406  2398  '1.4142135623730949' 
2407  2399  """ 
2408  2400  
2409   cdef RealNumber x 
2410   x = self._new() 
 2401  cdef RealNumber x = self._new() 
2411  2402  mpfr_set(x.value, self.value, GMP_RNDN) 
2412  2403  mpfr_nextabove(x.value) 
2413  2404  
… 
… 

2431  2422  '1.4142135623730954' 
2432  2423  """ 
2433  2424  
2434   cdef RealNumber x 
2435   x = self._new() 
 2425  cdef RealNumber x = self._new() 
2436  2426  mpfr_set(x.value, self.value, GMP_RNDN) 
2437  2427  mpfr_nextbelow(x.value) 
2438  2428  
… 
… 

3397  3387  cdef RealNumber x 
3398  3388  if mpfr_cmp_ui(self.value, 0) >= 0: 
3399  3389  x = self._new() 
3400   sig_on() 
 3390  if (<RealField_class>self._parent).__prec > 10*SIG_PREC_THRESHOLD: sig_on() 
3401  3391  mpfr_sqrt(x.value, self.value, (<RealField_class>self._parent).rnd) 
3402   sig_off() 
 3392  if (<RealField_class>self._parent).__prec > 10*SIG_PREC_THRESHOLD: sig_off() 
3403  3393  if all: 
3404  3394  if x.is_zero(): 
3405  3395  return [x] 
… 
… 

3442  3432  sage: r.cube_root()^3  r # illustrates precision loss 
3443  3433  1.42108547152020e14 
3444  3434  """ 
3445   cdef RealNumber x 
3446   x = self._new() 
3447   sig_on() 
 3435  cdef RealNumber x = self._new() 
 3436  if (<RealField_class>self._parent).__prec > 10*SIG_PREC_THRESHOLD: sig_on() 
3448  3437  mpfr_cbrt(x.value, self.value, (<RealField_class>self._parent).rnd) 
3449   sig_off() 
 3438  if (<RealField_class>self._parent).__prec > 10*SIG_PREC_THRESHOLD: sig_off() 
3450  3439  return x 
3451  3440  
3452  3441  def __pow(self, RealNumber exponent): 
… 
… 

3569  3558  return self._complex_number_().log(base) 
3570  3559  if base == 'e': 
3571  3560  x = self._new() 
3572   sig_on() 
 3561  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3573  3562  mpfr_log(x.value, self.value, (<RealField_class>self._parent).rnd) 
3574   sig_off() 
 3563  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3575  3564  return x 
3576  3565  elif base == 10: 
3577  3566  return self.log10() 
… 
… 

3610  3599  if self < 0: 
3611  3600  return self._complex_number_().log(2) 
3612  3601  x = self._new() 
3613   sig_on() 
 3602  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3614  3603  mpfr_log2(x.value, self.value, (<RealField_class>self._parent).rnd) 
3615   sig_off() 
 3604  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3616  3605  return x 
3617  3606  
3618  3607  def log10(self): 
… 
… 

3647  3636  if self < 0: 
3648  3637  return self._complex_number_().log(10) 
3649  3638  x = self._new() 
3650   sig_on() 
 3639  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3651  3640  mpfr_log10(x.value, self.value, (<RealField_class>self._parent).rnd) 
3652   sig_off() 
 3641  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3653  3642  return x 
3654  3643  
3655  3644  def log1p(self): 
… 
… 

3675  3664  sage: (1+r100).log() 
3676  3665  2.9999999995500000000978021372e10 
3677  3666  
 3667  For small values, this is more accurate than computing `log(1 + self)` 
 3668  directly, as it avoid cancelation issues:: 
 3669  
 3670  sage: r = 3e10 
 3671  sage: r.log1p() 
 3672  2.99999999955000e10 
 3673  sage: (1+r).log() 
 3674  3.00000024777111e10 
 3675  sage: r100 = RealField(100)(r) 
 3676  sage: (1+r100).log() 
 3677  2.9999999995500000000978021372e10 
 3678  
3678  3679  :: 
3679  3680  
3680  3681  sage: r = 38.9; r.log1p() 
… 
… 

3696  3697  if self < 1: 
3697  3698  return (self+1.0)._complex_number_().log() 
3698  3699  x = self._new() 
3699   sig_on() 
 3700  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3700  3701  mpfr_log1p(x.value, self.value, (<RealField_class>self._parent).rnd) 
3701   sig_off() 
 3702  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3702  3703  return x 
3703  3704  
3704  3705  def exp(self): 
… 
… 

3725  3726  sage: r.exp() 
3726  3727  9.38184458849869e15 
3727  3728  """ 
3728   cdef RealNumber x 
3729   x = self._new() 
 3729  cdef RealNumber x = self._new() 
3730  3730  sig_on() 
3731  3731  mpfr_exp(x.value, self.value, (<RealField_class>self._parent).rnd) 
3732  3732  sig_off() 
… 
… 

3754  3754  sage: r.exp2() 
3755  3755  1.89117248253021e10 
3756  3756  """ 
3757   cdef RealNumber x 
3758   x = self._new() 
3759   sig_on() 
 3757  cdef RealNumber x = self._new() 
 3758  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3760  3759  mpfr_exp2(x.value, self.value, (<RealField_class>self._parent).rnd) 
3761   sig_off() 
 3760  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3762  3761  return x 
3763  3762  
3764  3763  def exp10(self): 
… 
… 

3783  3782  sage: r.exp10() 
3784  3783  5.01187233627276e33 
3785  3784  """ 
3786   cdef RealNumber x 
3787   x = self._new() 
3788   sig_on() 
 3785  cdef RealNumber x = self._new() 
 3786  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3789  3787  mpfr_exp10(x.value, self.value, (<RealField_class>self._parent).rnd) 
3790   sig_off() 
 3788  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3791  3789  return x 
3792  3790  
3793  3791  def expm1(self): 
… 
… 

3809  3807  sage: r.expm1() 
3810  3808  1.00000000000000e16 
3811  3809  """ 
3812   cdef RealNumber x 
3813   x = self._new() 
3814   sig_on() 
 3810  cdef RealNumber x = self._new() 
 3811  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3815  3812  mpfr_expm1(x.value, self.value, (<RealField_class>self._parent).rnd) 
3816   sig_off() 
 3813  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
3817  3814  return x 
3818  3815  
3819  3816  def eint(self): 
… 
… 

3832  3829  sage: r.eint() 
3833  3830  NaN 
3834  3831  """ 
3835   cdef RealNumber x 
3836   x = self._new() 
3837   sig_on() 
 3832  cdef RealNumber x = self._new() 
 3833  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3838  3834  mpfr_eint(x.value, self.value, (<RealField_class>self._parent).rnd) 
3839   sig_off() 
 3835  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
3840  3836  return x 
3841  3837  
3842  3838  def cos(self): 
… 
… 

3849  3845  sage: t.cos() 
3850  3846  6.12323399573677e17 
3851  3847  """ 
3852   cdef RealNumber x 
3853   x = self._new() 
3854   sig_on() 
 3848  cdef RealNumber x = self._new() 
 3849  sig_on() 
3855  3850  mpfr_cos(x.value, self.value, (<RealField_class>self._parent).rnd) 
3856  3851  sig_off() 
3857  3852  return x 
… 
… 

3875  3870  sage: R(2).sin() 
3876  3871  0.90929742682568169539601986591 
3877  3872  """ 
3878   cdef RealNumber x 
3879   x = self._new() 
 3873  cdef RealNumber x = self._new() 
3880  3874  sig_on() 
3881  3875  mpfr_sin(x.value, self.value, (<RealField_class>self._parent).rnd) 
3882  3876  sig_off() 
… 
… 

3895  3889  sage: q.tan() 
3896  3890  0.577350269189626 
3897  3891  """ 
3898   cdef RealNumber x 
3899   x = self._new() 
 3892  cdef RealNumber x = self._new() 
3900  3893  sig_on() 
3901  3894  mpfr_tan(x.value, self.value, (<RealField_class>self._parent).rnd) 
3902  3895  sig_off() 
… 
… 

3935  3928  sage: i.arccos() == q 
3936  3929  True 
3937  3930  """ 
3938   cdef RealNumber x 
3939   x = self._new() 
 3931  cdef RealNumber x = self._new() 
3940  3932  sig_on() 
3941  3933  mpfr_acos(x.value, self.value, (<RealField_class>self._parent).rnd) 
3942  3934  sig_off() 
… 
… 

3955  3947  sage: i.arcsin()  q 
3956  3948  0.000000000000000 
3957  3949  """ 
3958   cdef RealNumber x 
3959   x = self._new() 
 3950  cdef RealNumber x = self._new() 
3960  3951  sig_on() 
3961  3952  mpfr_asin(x.value, self.value, (<RealField_class>self._parent).rnd) 
3962  3953  sig_off() 
… 
… 

3973  3964  sage: i.arctan() == q 
3974  3965  True 
3975  3966  """ 
3976   cdef RealNumber x 
3977   x = self._new() 
 3967  cdef RealNumber x = self._new() 
3978  3968  sig_on() 
3979  3969  mpfr_atan(x.value, self.value, (<RealField_class>self._parent).rnd) 
3980  3970  sig_off() 
… 
… 

3994  3984  sage: q.cosh() 
3995  3985  1.03446564009551 
3996  3986  """ 
3997   cdef RealNumber x 
3998   x = self._new() 
 3987  cdef RealNumber x = self._new() 
3999  3988  sig_on() 
4000  3989  mpfr_cosh(x.value, self.value, (<RealField_class>self._parent).rnd) 
4001  3990  sig_off() 
… 
… 

4011  4000  sage: q.sinh() 
4012  4001  0.264800227602271 
4013  4002  """ 
4014   cdef RealNumber x 
4015   x = self._new() 
 4003  cdef RealNumber x = self._new() 
4016  4004  sig_on() 
4017  4005  mpfr_sinh(x.value, self.value, (<RealField_class>self._parent).rnd) 
4018  4006  sig_off() 
… 
… 

4028  4016  sage: q.tanh() 
4029  4017  0.278079429295850 
4030  4018  """ 
4031   cdef RealNumber x 
4032   x = self._new() 
 4019  cdef RealNumber x = self._new() 
4033  4020  sig_on() 
4034  4021  mpfr_tanh(x.value, self.value, (<RealField_class>self._parent).rnd) 
4035  4022  sig_off() 
… 
… 

4044  4031  sage: RealField(100)(2).coth() 
4045  4032  1.0373147207275480958778097648 
4046  4033  """ 
4047   cdef RealNumber x 
4048   x = self._new() 
 4034  cdef RealNumber x = self._new() 
4049  4035  sig_on() 
4050  4036  mpfr_coth(x.value, self.value, (<RealField_class>self._parent).rnd) 
4051  4037  sig_off() 
… 
… 

4073  4059  sage: RealField(100)(2).cot() 
4074  4060  0.45765755436028576375027741043 
4075  4061  """ 
4076   cdef RealNumber x 
4077   x = self._new() 
 4062  cdef RealNumber x = self._new() 
4078  4063  sig_on() 
4079  4064  mpfr_cot(x.value, self.value, (<RealField_class>self._parent).rnd) 
4080  4065  sig_off() 
… 
… 

4089  4074  sage: RealField(100)(2).csch() 
4090  4075  0.27572056477178320775835148216 
4091  4076  """ 
4092   cdef RealNumber x 
4093   x = self._new() 
 4077  cdef RealNumber x = self._new() 
4094  4078  sig_on() 
4095  4079  mpfr_csch(x.value, self.value, (<RealField_class>self._parent).rnd) 
4096  4080  sig_off() 
… 
… 

4118  4102  sage: RealField(100)(2).csc() 
4119  4103  1.0997501702946164667566973970 
4120  4104  """ 
4121   cdef RealNumber x 
4122   x = self._new() 
 4105  cdef RealNumber x = self._new() 
4123  4106  sig_on() 
4124  4107  mpfr_csc(x.value, self.value, (<RealField_class>self._parent).rnd) 
4125  4108  sig_off() 
… 
… 

4134  4117  sage: RealField(100)(2).sech() 
4135  4118  0.26580222883407969212086273982 
4136  4119  """ 
4137   cdef RealNumber x 
4138   x = self._new() 
 4120  cdef RealNumber x = self._new() 
4139  4121  sig_on() 
4140  4122  mpfr_sech(x.value, self.value, (<RealField_class>self._parent).rnd) 
4141  4123  sig_off() 
… 
… 

4163  4145  sage: RealField(100)(2).sec() 
4164  4146  2.4029979617223809897546004014 
4165  4147  """ 
4166   cdef RealNumber x 
4167   x = self._new() 
 4148  cdef RealNumber x = self._new() 
4168  4149  sig_on() 
4169  4150  mpfr_sec(x.value, self.value, (<RealField_class>self._parent).rnd) 
4170  4151  sig_off() 
… 
… 

4182  4163  sage: q == i.arccosh() 
4183  4164  True 
4184  4165  """ 
4185   cdef RealNumber x 
4186   x = self._new() 
 4166  cdef RealNumber x = self._new() 
4187  4167  sig_on() 
4188  4168  mpfr_acosh(x.value, self.value, (<RealField_class>self._parent).rnd) 
4189  4169  sig_off() 
… 
… 

4201  4181  sage: i.arcsinh()  q 
4202  4182  0.000000000000000 
4203  4183  """ 
4204   cdef RealNumber x 
4205   x = self._new() 
 4184  cdef RealNumber x = self._new() 
4206  4185  sig_on() 
4207  4186  mpfr_asinh(x.value, self.value, (<RealField_class>self._parent).rnd) 
4208  4187  sig_off() 
… 
… 

4220  4199  sage: i.arctanh()  q 
4221  4200  0.000000000000000 
4222  4201  """ 
4223   cdef RealNumber x 
4224   x = self._new() 
 4202  cdef RealNumber x = self._new() 
4225  4203  sig_on() 
4226  4204  mpfr_atanh(x.value, self.value, (<RealField_class>self._parent).rnd) 
4227  4205  sig_off() 
… 
… 

4311  4289  sage: R(6).erf() 
4312  4290  1.00000000000000 
4313  4291  """ 
4314   cdef RealNumber x 
4315   x = self._new() 
 4292  cdef RealNumber x = self._new() 
4316  4293  sig_on() 
4317  4294  mpfr_erf(x.value, self.value, (<RealField_class>self._parent).rnd) 
4318  4295  sig_off() 
… 
… 

4331  4308  sage: R(6).erfc() 
4332  4309  2.15197367124989e17 
4333  4310  """ 
4334   cdef RealNumber x 
4335   x = self._new() 
 4311  cdef RealNumber x = self._new() 
4336  4312  sig_on() 
4337  4313  mpfr_erfc(x.value, self.value, (<RealField_class>self._parent).rnd) 
4338  4314  sig_off() 
… 
… 

4348  4324  sage: R(2).j0() 
4349  4325  0.223890779141236 
4350  4326  """ 
4351   cdef RealNumber x 
4352   x = self._new() 
 4327  cdef RealNumber x = self._new() 
4353  4328  sig_on() 
4354  4329  mpfr_j0(x.value, self.value, (<RealField_class>self._parent).rnd) 
4355  4330  sig_off() 
… 
… 

4365  4340  sage: R(2).j1() 
4366  4341  0.576724807756873 
4367  4342  """ 
4368   cdef RealNumber x 
4369   x = self._new() 
 4343  cdef RealNumber x = self._new() 
4370  4344  sig_on() 
4371  4345  mpfr_j1(x.value, self.value, (<RealField_class>self._parent).rnd) 
4372  4346  sig_off() 
… 
… 

4385  4359  sage: R(2).jn(17) 
4386  4360  2.65930780516787e15 
4387  4361  """ 
4388   cdef RealNumber x 
4389   x = self._new() 
 4362  cdef RealNumber x = self._new() 
4390  4363  sig_on() 
4391  4364  mpfr_jn(x.value, n, self.value, (<RealField_class>self._parent).rnd) 
4392  4365  sig_off() 
… 
… 

4402  4375  sage: R(2).y0() 
4403  4376  0.510375672649745 
4404  4377  """ 
4405   cdef RealNumber x 
4406   x = self._new() 
 4378  cdef RealNumber x = self._new() 
4407  4379  sig_on() 
4408  4380  mpfr_y0(x.value, self.value, (<RealField_class>self._parent).rnd) 
4409  4381  sig_off() 
… 
… 

4419  4391  sage: R(2).y1() 
4420  4392  0.107032431540938 
4421  4393  """ 
4422   cdef RealNumber x 
4423   x = self._new() 
 4394  cdef RealNumber x = self._new() 
4424  4395  sig_on() 
4425  4396  mpfr_y1(x.value, self.value, (<RealField_class>self._parent).rnd) 
4426  4397  sig_off() 
… 
… 

4439  4410  sage: R(2).yn(17) 
4440  4411  7.09038821729481e12 
4441  4412  """ 
4442   cdef RealNumber x 
4443   x = self._new() 
 4413  cdef RealNumber x = self._new() 
4444  4414  sig_on() 
4445  4415  mpfr_yn(x.value, n, self.value, (<RealField_class>self._parent).rnd) 
4446  4416  sig_off() 
… 
… 

4458  4428  sage: R(1.5).gamma() 
4459  4429  0.886226925452758 
4460  4430  """ 
4461   cdef RealNumber x 
4462   x = self._new() 
4463   sig_on() 
 4431  cdef RealNumber x = self._new() 
 4432  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
4464  4433  mpfr_gamma(x.value, self.value, (<RealField_class>self._parent).rnd) 
4465   sig_off() 
 4434  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
4466  4435  return x 
4467  4436  
4468  4437  def lngamma(self): 
… 
… 

4493  4462  sage: R(1e10).log_gamma() 
4494  4463  2.20258509288811e11 
4495  4464  """ 
4496   cdef RealNumber x 
4497   x = self._new() 
4498   sig_on() 
 4465  cdef RealNumber x = self._new() 
 4466  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_on() 
4499  4467  mpfr_lngamma(x.value, self.value, (<RealField_class>self._parent).rnd) 
4500   sig_off() 
 4468  if (<RealField_class>self._parent).__prec > SIG_PREC_THRESHOLD: sig_off() 
4501  4469  return x 
4502  4470  
4503  4471  def zeta(self): 
… 
… 

4545  4513  sage: R(z) 
4546  4514  1.64493406684823 
4547  4515  """ 
4548   cdef RealNumber x 
4549   x = self._new() 
 4516  cdef RealNumber x = self._new() 
4550  4517  sig_on() 
4551  4518  mpfr_zeta(x.value, self.value, (<RealField_class>self._parent).rnd) 
4552  4519  sig_off() 