# HG changeset patch
# User Robert Bradshaw <robertwb@math.washington.edu>
# Date 1263066099 28800
# Node ID 5de66881154e762500fa79378068e138e1de6cee
# Parent db3cc513fb4d21f0df9bb1e552578db8165dc58a
Trac #7879: Remove unnecessary signal handling for low prec mpfr operations.
diff r db3cc513fb4d r 5de66881154e sage/rings/real_mpfr.pyx
a

b


663  663  sage: R.pi().sqrt()/2 
664  664  0.88622692545275801364908374167057259139877473 
665  665  """ 
666   cdef RealNumber x 
667   x = self._new() 
668   _sig_on 
 666  cdef RealNumber x = self._new() 
 667  if self.__prec > 1000: _sig_on 
669  668  # The docs for mpfr_free_cache say "Free the cache used by 
670  669  # the functions computing constants if needed (currently 
671  670  # mpfr_const_log2, mpfr_const_pi and mpfr_const_euler)", so 
… 
… 

675  674  # functions, but this free is needed for them too! 
676  675  mpfr_free_cache() 
677  676  mpfr_const_pi(x.value, self.rnd) 
678   _sig_off 
 677  if self.__prec > 1000: _sig_off 
679  678  return x 
680  679  
681  680  
… 
… 

689  688  sage: RealField(100).euler_constant() 
690  689  0.57721566490153286060651209008 
691  690  """ 
692   cdef RealNumber x 
693   x = self._new() 
 691  cdef RealNumber x = self._new() 
694  692  _sig_on 
695  693  mpfr_free_cache() 
696  694  mpfr_const_euler(x.value, self.rnd) 
… 
… 

707  705  sage: RealField(100).catalan_constant() 
708  706  0.91596559417721901505460351493 
709  707  """ 
710   cdef RealNumber x 
711   x = self._new() 
712   _sig_on 
 708  cdef RealNumber x = self._new() 
 709  if self.__prec > 1000: _sig_on 
713  710  mpfr_free_cache() 
714  711  mpfr_const_catalan(x.value, self.rnd) 
715   _sig_off 
 712  if self.__prec > 1000: _sig_off 
716  713  return x 
717  714  
718  715  # int mpfr_const_log2 (mpfr_t rop, mp_rnd_t rnd) 
… 
… 

729  726  0.69314718055994530941723212146 
730  727  """ 
731  728  cdef RealNumber x = self._new() 
732   _sig_on 
 729  if self.__prec > 1000: _sig_on 
733  730  mpfr_free_cache() 
734  731  mpfr_const_log2(x.value, self.rnd) 
735   _sig_off 
 732  if self.__prec > 1000: _sig_off 
736  733  return x 
737  734  
738  735  def random_element(self, min=1, max=1, distribution=None): 
… 
… 

799  796  if n < 0: 
800  797  raise ArithmeticError, "n must be nonnegative" 
801  798  x = self._new() 
802   _sig_on 
 799  if self.__prec > 1000 and n < 1000: _sig_on 
803  800  mpfr_fac_ui(x.value, n, self.rnd) 
804   _sig_off 
 801  if self.__prec > 1000 and n < 1000: _sig_off 
805  802  return x 
806  803  
807  804  def rounding_mode(self): 
… 
… 

1688  1685  sage: R(1.5) + R(2.5) 
1689  1686  1.00000000000000 
1690  1687  """ 
1691   cdef RealNumber x 
1692   x = self._new() 
 1688  cdef RealNumber x = self._new() 
1693  1689  mpfr_add(x.value, self.value, (<RealNumber>other).value, (<RealField>self._parent).rnd) 
1694  1690  return x 
1695  1691  
… 
… 

1706  1702  sage: R(1.5)  R(2.5) 
1707  1703  4.00000000000000 
1708  1704  """ 
1709   cdef RealNumber x 
1710   x = self._new() 
 1705  cdef RealNumber x = self._new() 
1711  1706  mpfr_sub(x.value, self.value, (<RealNumber>right).value, (<RealField> self._parent).rnd) 
1712  1707  return x 
1713  1708  
… 
… 

1741  1736  sage: parent(b*a) 
1742  1737  Real Field with 20 bits of precision 
1743  1738  """ 
1744   cdef RealNumber x 
1745   x = self._new() 
 1739  cdef RealNumber x = self._new() 
1746  1740  mpfr_mul(x.value, self.value, (<RealNumber>right).value, (<RealField>self._parent).rnd) 
1747  1741  return x 
1748  1742  
… 
… 

1765  1759  sage: R(1.5) / R(2.5) 
1766  1760  0.600000000000000 
1767  1761  """ 
1768   cdef RealNumber x 
1769   x = self._new() 
 1762  cdef RealNumber x = self._new() 
1770  1763  mpfr_div((<RealNumber>x).value, self.value, 
1771  1764  (<RealNumber>right).value, (<RealField>self._parent).rnd) 
1772  1765  return x 
1773  1766  
1774  1767  cpdef ModuleElement _neg_(self): 
1775   cdef RealNumber x 
1776   x = self._new() 
 1768  cdef RealNumber x = self._new() 
1777  1769  mpfr_neg(x.value, self.value, (<RealField>self._parent).rnd) 
1778  1770  return x 
1779  1771  
… 
… 

1816  1808  def _rshift_(RealNumber self, n): 
1817  1809  if n > sys.maxint: 
1818  1810  raise OverflowError, "n (=%s) must be <= %s"%(n, sys.maxint) 
1819   cdef RealNumber x 
1820   x = self._new() 
 1811  cdef RealNumber x = self._new() 
1821  1812  mpfr_div_2exp(x.value, self.value, n, (<RealField>self._parent).rnd) 
1822  1813  return x 
1823  1814  
… 
… 

1963  1954  sage: RR(0.5).round() 
1964  1955  1 
1965  1956  """ 
1966   cdef RealNumber x 
1967   x = self._new() 
 1957  cdef RealNumber x = self._new() 
1968  1958  mpfr_round(x.value, self.value) 
1969  1959  return x.integer_part() 
1970  1960  
… 
… 

2042  2032  sage: (0.00).trunc() 
2043  2033  0 
2044  2034  """ 
2045   cdef RealNumber x 
2046   x = self._new() 
 2035  cdef RealNumber x = self._new() 
2047  2036  mpfr_trunc(x.value, self.value) 
2048  2037  return x.integer_part() 
2049  2038  
… 
… 

2061  2050  sage: (2.79).frac() 
2062  2051  0.790000000000000 
2063  2052  """ 
2064   cdef RealNumber x 
2065   x = self._new() 
 2053  cdef RealNumber x = self._new() 
2066  2054  mpfr_frac(x.value, self.value, (<RealField>self._parent).rnd) 
2067  2055  return x 
2068  2056  
… 
… 

2093  2081  else: 
2094  2082  other_rn = self._parent(other) 
2095  2083  
2096   cdef RealNumber x 
2097   x = self._new() 
 2084  cdef RealNumber x = self._new() 
2098  2085  
2099  2086  mpfr_set(x.value, self.value, GMP_RNDN) 
2100  2087  mpfr_nexttoward(x.value, other_rn.value) 
… 
… 

2119  2106  '1.4142135623730949' 
2120  2107  """ 
2121  2108  
2122   cdef RealNumber x 
2123   x = self._new() 
 2109  cdef RealNumber x = self._new() 
2124  2110  mpfr_set(x.value, self.value, GMP_RNDN) 
2125  2111  mpfr_nextabove(x.value) 
2126  2112  
… 
… 

2144  2130  '1.4142135623730954' 
2145  2131  """ 
2146  2132  
2147   cdef RealNumber x 
2148   x = self._new() 
 2133  cdef RealNumber x = self._new() 
2149  2134  mpfr_set(x.value, self.value, GMP_RNDN) 
2150  2135  mpfr_nextbelow(x.value) 
2151  2136  
… 
… 

2904  2889  cdef RealNumber x 
2905  2890  if mpfr_cmp_ui(self.value, 0) >= 0: 
2906  2891  x = self._new() 
2907   _sig_on 
 2892  if (<RealField>self._parent).__prec > 10000: _sig_on 
2908  2893  mpfr_sqrt(x.value, self.value, (<RealField>self._parent).rnd) 
2909   _sig_off 
 2894  if (<RealField>self._parent).__prec > 10000: _sig_off 
2910  2895  if all: 
2911  2896  if x.is_zero(): 
2912  2897  return [x] 
… 
… 

2949  2934  sage: r.cube_root()^3  r # illustrates precision loss 
2950  2935  1.42108547152020e14 
2951  2936  """ 
2952   cdef RealNumber x 
2953   x = self._new() 
2954   _sig_on 
 2937  cdef RealNumber x = self._new() 
 2938  if (<RealField>self._parent).__prec > 10000: _sig_on 
2955  2939  mpfr_cbrt(x.value, self.value, (<RealField>self._parent).rnd) 
2956   _sig_off 
 2940  if (<RealField>self._parent).__prec > 10000: _sig_off 
2957  2941  return x 
2958  2942  
2959  2943  def __pow(self, RealNumber exponent): 
2960   cdef RealNumber x 
2961   x = self._new() 
2962   _sig_on 
 2944  cdef RealNumber x = self._new() 
 2945  if (<RealField>self._parent).__prec > 1000: _sig_on 
2963  2946  mpfr_pow(x.value, self.value, exponent.value, (<RealField>self._parent).rnd) 
2964   _sig_off 
 2947  if (<RealField>self._parent).__prec > 1000: _sig_off 
2965  2948  if mpfr_nan_p(x.value): 
2966  2949  return self._complex_number_()**exponent._complex_number_() 
2967  2950  return x 
… 
… 

3039  3022  return self._complex_number_().log(base) 
3040  3023  if base == 'e': 
3041  3024  x = self._new() 
3042   _sig_on 
 3025  if (<RealField>self._parent).__prec > 1000: _sig_on 
3043  3026  mpfr_log(x.value, self.value, (<RealField>self._parent).rnd) 
3044   _sig_off 
 3027  if (<RealField>self._parent).__prec > 1000: _sig_off 
3045  3028  return x 
3046  3029  elif base == 10: 
3047  3030  return self.log10() 
… 
… 

3080  3063  if self < 0: 
3081  3064  return self._complex_number_().log(2) 
3082  3065  x = self._new() 
3083   _sig_on 
 3066  if (<RealField>self._parent).__prec > 1000: _sig_on 
3084  3067  mpfr_log2(x.value, self.value, (<RealField>self._parent).rnd) 
3085   _sig_off 
 3068  if (<RealField>self._parent).__prec > 1000: _sig_off 
3086  3069  return x 
3087  3070  
3088  3071  def log10(self): 
… 
… 

3117  3100  if self < 0: 
3118  3101  return self._complex_number_().log(10) 
3119  3102  x = self._new() 
3120   _sig_on 
 3103  if (<RealField>self._parent).__prec > 1000: _sig_on 
3121  3104  mpfr_log10(x.value, self.value, (<RealField>self._parent).rnd) 
3122   _sig_off 
 3105  if (<RealField>self._parent).__prec > 1000: _sig_off 
3123  3106  return x 
3124  3107  
3125  3108  def log1p(self): 
… 
… 

3133  3116  sage: (r+1).log() 
3134  3117  2.77258872223978 
3135  3118  
 3119  For small values, this is more accurate than computing `log(1 + self)` 
 3120  directly, as it avoid cancelation issues:: 
 3121  
 3122  sage: r = 3e10 
 3123  sage: r.log1p() 
 3124  2.99999999955000e10 
 3125  sage: (1+r).log() 
 3126  3.00000024777111e10 
 3127  sage: r100 = RealField(100)(r) 
 3128  sage: (1+r100).log() 
 3129  2.9999999995500000000978021372e10 
 3130  
3136  3131  :: 
3137  3132  
3138  3133  sage: r = 38.9; r.log1p() 
… 
… 

3154  3149  if self < 1: 
3155  3150  return (self+1.0)._complex_number_().log() 
3156  3151  x = self._new() 
3157   _sig_on 
 3152  if (<RealField>self._parent).__prec > 1000: _sig_on 
3158  3153  mpfr_log1p(x.value, self.value, (<RealField>self._parent).rnd) 
3159   _sig_off 
 3154  if (<RealField>self._parent).__prec > 1000: _sig_off 
3160  3155  return x 
3161  3156  
3162  3157  def exp(self): 
… 
… 

3183  3178  sage: r.exp() 
3184  3179  9.38184458849869e15 
3185  3180  """ 
3186   cdef RealNumber x 
3187   x = self._new() 
3188   _sig_on 
 3181  cdef RealNumber x = self._new() 
 3182  if (<RealField>self._parent).__prec > 10000: _sig_on 
3189  3183  mpfr_exp(x.value, self.value, (<RealField>self._parent).rnd) 
3190   _sig_off 
 3184  if (<RealField>self._parent).__prec > 10000: _sig_off 
3191  3185  return x 
3192  3186  
3193  3187  def exp2(self): 
… 
… 

3212  3206  sage: r.exp2() 
3213  3207  1.89117248253021e10 
3214  3208  """ 
3215   cdef RealNumber x 
3216   x = self._new() 
3217   _sig_on 
 3209  cdef RealNumber x = self._new() 
 3210  if (<RealField>self._parent).__prec > 10000: _sig_on 
3218  3211  mpfr_exp2(x.value, self.value, (<RealField>self._parent).rnd) 
3219   _sig_off 
 3212  if (<RealField>self._parent).__prec > 10000: _sig_off 
3220  3213  return x 
3221  3214  
3222  3215  def exp10(self): 
… 
… 

3241  3234  sage: r.exp10() 
3242  3235  5.01187233627276e33 
3243  3236  """ 
3244   cdef RealNumber x 
3245   x = self._new() 
3246   _sig_on 
 3237  cdef RealNumber x = self._new() 
 3238  if (<RealField>self._parent).__prec > 10000: _sig_on 
3247  3239  mpfr_exp10(x.value, self.value, (<RealField>self._parent).rnd) 
3248   _sig_off 
 3240  if (<RealField>self._parent).__prec > 10000: _sig_off 
3249  3241  return x 
3250  3242  
3251  3243  def expm1(self): 
… 
… 

3267  3259  sage: r.expm1() 
3268  3260  1.00000000000000e16 
3269  3261  """ 
3270   cdef RealNumber x 
3271   x = self._new() 
3272   _sig_on 
 3262  cdef RealNumber x = self._new() 
 3263  if (<RealField>self._parent).__prec > 10000: _sig_on 
3273  3264  mpfr_expm1(x.value, self.value, (<RealField>self._parent).rnd) 
3274   _sig_off 
 3265  if (<RealField>self._parent).__prec > 10000: _sig_off 
3275  3266  return x 
3276  3267  
3277  3268  def eint(self): 
… 
… 

3290  3281  sage: r.eint() 
3291  3282  NaN 
3292  3283  """ 
3293   cdef RealNumber x 
3294   x = self._new() 
 3284  cdef RealNumber x = self._new() 
3295  3285  _sig_on 
3296  3286  mpfr_eint(x.value, self.value, (<RealField>self._parent).rnd) 
3297  3287  _sig_off 
… 
… 

3307  3297  sage: t.cos() 
3308  3298  6.12323399573677e17 
3309  3299  """ 
3310   cdef RealNumber x 
3311   x = self._new() 
3312   _sig_on 
 3300  cdef RealNumber x = self._new() 
 3301  if (<RealField>self._parent).__prec > 1000: _sig_on 
3313  3302  mpfr_cos(x.value, self.value, (<RealField>self._parent).rnd) 
3314   _sig_off 
 3303  if (<RealField>self._parent).__prec > 1000: _sig_off 
3315  3304  return x 
3316  3305  
3317  3306  ########################################################## 
… 
… 

3333  3322  sage: R(2).sin() 
3334  3323  0.90929742682568169539601986591 
3335  3324  """ 
3336   cdef RealNumber x 
3337   x = self._new() 
3338   _sig_on 
 3325  cdef RealNumber x = self._new() 
 3326  if (<RealField>self._parent).__prec > 1000: _sig_on 
3339  3327  mpfr_sin(x.value, self.value, (<RealField>self._parent).rnd) 
3340   _sig_off 
 3328  if (<RealField>self._parent).__prec > 1000: _sig_off 
3341  3329  return x 
3342  3330  
3343  3331  def tan(self): 
… 
… 

3353  3341  sage: q.tan() 
3354  3342  0.577350269189626 
3355  3343  """ 
3356   cdef RealNumber x 
3357   x = self._new() 
3358   _sig_on 
 3344  cdef RealNumber x = self._new() 
 3345  if (<RealField>self._parent).__prec > 1000: _sig_on 
3359  3346  mpfr_tan(x.value, self.value, (<RealField>self._parent).rnd) 
3360   _sig_off 
 3347  if (<RealField>self._parent).__prec > 1000: _sig_off 
3361  3348  return x 
3362  3349  
3363  3350  def sincos(self): 
… 
… 

3371  3358  sage: t.sincos() 
3372  3359  (0.500000000000000, 0.866025403784439) 
3373  3360  """ 
3374   cdef RealNumber x,y 
3375   x = self._new() 
3376   y = self._new() 
3377   _sig_on 
 3361  cdef RealNumber x = self._new() 
 3362  cdef RealNumber y = self._new() 
 3363  if (<RealField>self._parent).__prec > 1000: _sig_on 
3378  3364  mpfr_sin_cos(x.value, y.value, self.value, (<RealField>self._parent).rnd) 
3379   _sig_off 
 3365  if (<RealField>self._parent).__prec > 1000: _sig_off 
3380  3366  return x,y 
3381  3367  
3382  3368  
… 
… 

3393  3379  sage: i.arccos() == q 
3394  3380  True 
3395  3381  """ 
3396   cdef RealNumber x 
3397   x = self._new() 
3398   _sig_on 
 3382  cdef RealNumber x = self._new() 
 3383  if (<RealField>self._parent).__prec > 1000: _sig_on 
3399  3384  mpfr_acos(x.value, self.value, (<RealField>self._parent).rnd) 
3400   _sig_off 
 3385  if (<RealField>self._parent).__prec > 1000: _sig_off 
3401  3386  return x 
3402  3387  
3403  3388  def arcsin(self): 
… 
… 

3413  3398  sage: i.arcsin()  q 
3414  3399  0.000000000000000 
3415  3400  """ 
3416   cdef RealNumber x 
3417   x = self._new() 
3418   _sig_on 
 3401  cdef RealNumber x = self._new() 
 3402  if (<RealField>self._parent).__prec > 1000: _sig_on 
3419  3403  mpfr_asin(x.value, self.value, (<RealField>self._parent).rnd) 
3420   _sig_off 
 3404  if (<RealField>self._parent).__prec > 1000: _sig_off 
3421  3405  return x 
3422  3406  
3423  3407  def arctan(self): 
… 
… 

3431  3415  sage: i.arctan() == q 
3432  3416  True 
3433  3417  """ 
3434   cdef RealNumber x 
3435   x = self._new() 
3436   _sig_on 
 3418  cdef RealNumber x = self._new() 
 3419  if (<RealField>self._parent).__prec > 1000: _sig_on 
3437  3420  mpfr_atan(x.value, self.value, (<RealField>self._parent).rnd) 
3438   _sig_off 
 3421  if (<RealField>self._parent).__prec > 1000: _sig_off 
3439  3422  return x 
3440  3423  
3441  3424  #int mpfr_acos _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); 
… 
… 

3452  3435  sage: q.cosh() 
3453  3436  1.03446564009551 
3454  3437  """ 
3455   cdef RealNumber x 
3456   x = self._new() 
3457   _sig_on 
 3438  cdef RealNumber x = self._new() 
 3439  if (<RealField>self._parent).__prec > 1000: _sig_on 
3458  3440  mpfr_cosh(x.value, self.value, (<RealField>self._parent).rnd) 
3459   _sig_off 
 3441  if (<RealField>self._parent).__prec > 1000: _sig_off 
3460  3442  return x 
3461  3443  
3462  3444  def sinh(self): 
… 
… 

3469  3451  sage: q.sinh() 
3470  3452  0.264800227602271 
3471  3453  """ 
3472   cdef RealNumber x 
3473   x = self._new() 
3474   _sig_on 
 3454  cdef RealNumber x = self._new() 
 3455  if (<RealField>self._parent).__prec > 1000: _sig_on 
3475  3456  mpfr_sinh(x.value, self.value, (<RealField>self._parent).rnd) 
3476   _sig_off 
 3457  if (<RealField>self._parent).__prec > 1000: _sig_off 
3477  3458  return x 
3478  3459  
3479  3460  def tanh(self): 
… 
… 

3486  3467  sage: q.tanh() 
3487  3468  0.278079429295850 
3488  3469  """ 
3489   cdef RealNumber x 
3490   x = self._new() 
3491   _sig_on 
 3470  cdef RealNumber x = self._new() 
 3471  if (<RealField>self._parent).__prec > 1000: _sig_on 
3492  3472  mpfr_tanh(x.value, self.value, (<RealField>self._parent).rnd) 
3493   _sig_off 
 3473  if (<RealField>self._parent).__prec > 1000: _sig_off 
3494  3474  return x 
3495  3475  
3496  3476  def coth(self): 
… 
… 

3502  3482  sage: RealField(100)(2).coth() 
3503  3483  1.0373147207275480958778097648 
3504  3484  """ 
3505   cdef RealNumber x 
3506   x = self._new() 
3507   _sig_on 
 3485  cdef RealNumber x = self._new() 
 3486  if (<RealField>self._parent).__prec > 1000: _sig_on 
3508  3487  mpfr_coth(x.value, self.value, (<RealField>self._parent).rnd) 
3509   _sig_off 
 3488  if (<RealField>self._parent).__prec > 1000: _sig_off 
3510  3489  return x 
3511  3490  
3512  3491  def arccoth(self): 
… 
… 

3531  3510  sage: RealField(100)(2).cot() 
3532  3511  0.45765755436028576375027741043 
3533  3512  """ 
3534   cdef RealNumber x 
3535   x = self._new() 
3536   _sig_on 
 3513  cdef RealNumber x = self._new() 
 3514  if (<RealField>self._parent).__prec > 1000: _sig_on 
3537  3515  mpfr_cot(x.value, self.value, (<RealField>self._parent).rnd) 
3538   _sig_off 
 3516  if (<RealField>self._parent).__prec > 1000: _sig_off 
3539  3517  return x 
3540  3518  
3541  3519  def csch(self): 
… 
… 

3547  3525  sage: RealField(100)(2).csch() 
3548  3526  0.27572056477178320775835148216 
3549  3527  """ 
3550   cdef RealNumber x 
3551   x = self._new() 
3552   _sig_on 
 3528  cdef RealNumber x = self._new() 
 3529  if (<RealField>self._parent).__prec > 1000: _sig_on 
3553  3530  mpfr_csch(x.value, self.value, (<RealField>self._parent).rnd) 
3554   _sig_off 
 3531  if (<RealField>self._parent).__prec > 1000: _sig_off 
3555  3532  return x 
3556  3533  
3557  3534  def arccsch(self): 
… 
… 

3576  3553  sage: RealField(100)(2).csc() 
3577  3554  1.0997501702946164667566973970 
3578  3555  """ 
3579   cdef RealNumber x 
3580   x = self._new() 
3581   _sig_on 
 3556  cdef RealNumber x = self._new() 
 3557  if (<RealField>self._parent).__prec > 1000: _sig_on 
3582  3558  mpfr_csc(x.value, self.value, (<RealField>self._parent).rnd) 
3583   _sig_off 
 3559  if (<RealField>self._parent).__prec > 1000: _sig_off 
3584  3560  return x 
3585  3561  
3586  3562  def sech(self): 
… 
… 

3592  3568  sage: RealField(100)(2).sech() 
3593  3569  0.26580222883407969212086273982 
3594  3570  """ 
3595   cdef RealNumber x 
3596   x = self._new() 
3597   _sig_on 
 3571  cdef RealNumber x = self._new() 
 3572  if (<RealField>self._parent).__prec > 1000: _sig_on 
3598  3573  mpfr_sech(x.value, self.value, (<RealField>self._parent).rnd) 
3599   _sig_off 
 3574  if (<RealField>self._parent).__prec > 1000: _sig_off 
3600  3575  return x 
3601  3576  
3602  3577  def arcsech(self): 
… 
… 

3621  3596  sage: RealField(100)(2).sec() 
3622  3597  2.4029979617223809897546004014 
3623  3598  """ 
3624   cdef RealNumber x 
3625   x = self._new() 
3626   _sig_on 
 3599  cdef RealNumber x = self._new() 
 3600  if (<RealField>self._parent).__prec > 1000: _sig_on 
3627  3601  mpfr_sec(x.value, self.value, (<RealField>self._parent).rnd) 
3628   _sig_off 
 3602  if (<RealField>self._parent).__prec > 1000: _sig_off 
3629  3603  return x 
3630  3604  
3631  3605  def arccosh(self): 
… 
… 

3640  3614  sage: q == i.arccosh() 
3641  3615  True 
3642  3616  """ 
3643   cdef RealNumber x 
3644   x = self._new() 
3645   _sig_on 
 3617  cdef RealNumber x = self._new() 
 3618  if (<RealField>self._parent).__prec > 1000: _sig_on 
3646  3619  mpfr_acosh(x.value, self.value, (<RealField>self._parent).rnd) 
3647   _sig_off 
 3620  if (<RealField>self._parent).__prec > 1000: _sig_off 
3648  3621  return x 
3649  3622  
3650  3623  def arcsinh(self): 
… 
… 

3659  3632  sage: i.arcsinh()  q 
3660  3633  0.000000000000000 
3661  3634  """ 
3662   cdef RealNumber x 
3663   x = self._new() 
3664   _sig_on 
 3635  cdef RealNumber x = self._new() 
 3636  if (<RealField>self._parent).__prec > 1000: _sig_on 
3665  3637  mpfr_asinh(x.value, self.value, (<RealField>self._parent).rnd) 
3666   _sig_off 
 3638  if (<RealField>self._parent).__prec > 1000: _sig_off 
3667  3639  return x 
3668  3640  
3669  3641  def arctanh(self): 
… 
… 

3678  3650  sage: i.arctanh()  q 
3679  3651  0.000000000000000 
3680  3652  """ 
3681   cdef RealNumber x 
3682   x = self._new() 
3683   _sig_on 
 3653  cdef RealNumber x = self._new() 
 3654  if (<RealField>self._parent).__prec > 1000: _sig_on 
3684  3655  mpfr_atanh(x.value, self.value, (<RealField>self._parent).rnd) 
3685   _sig_off 
 3656  if (<RealField>self._parent).__prec > 1000: _sig_off 
3686  3657  return x 
3687  3658  
3688  3659  def agm(self, other): 
… 
… 

3769  3740  sage: R(6).erf() 
3770  3741  1.00000000000000 
3771  3742  """ 
3772   cdef RealNumber x 
3773   x = self._new() 
 3743  cdef RealNumber x = self._new() 
3774  3744  _sig_on 
3775  3745  mpfr_erf(x.value, self.value, (<RealField>self._parent).rnd) 
3776  3746  _sig_off 
… 
… 

3789  3759  sage: R(6).erfc() 
3790  3760  2.15197367124989e17 
3791  3761  """ 
3792   cdef RealNumber x 
3793   x = self._new() 
 3762  cdef RealNumber x = self._new() 
3794  3763  _sig_on 
3795  3764  mpfr_erfc(x.value, self.value, (<RealField>self._parent).rnd) 
3796  3765  _sig_off 
… 
… 

3806  3775  sage: R(2).j0() 
3807  3776  0.223890779141236 
3808  3777  """ 
3809   cdef RealNumber x 
3810   x = self._new() 
 3778  cdef RealNumber x = self._new() 
3811  3779  _sig_on 
3812  3780  mpfr_j0(x.value, self.value, (<RealField>self._parent).rnd) 
3813  3781  _sig_off 
… 
… 

3823  3791  sage: R(2).j1() 
3824  3792  0.576724807756873 
3825  3793  """ 
3826   cdef RealNumber x 
3827   x = self._new() 
 3794  cdef RealNumber x = self._new() 
3828  3795  _sig_on 
3829  3796  mpfr_j1(x.value, self.value, (<RealField>self._parent).rnd) 
3830  3797  _sig_off 
… 
… 

3843  3810  sage: R(2).jn(17) 
3844  3811  2.65930780516787e15 
3845  3812  """ 
3846   cdef RealNumber x 
3847   x = self._new() 
 3813  cdef RealNumber x = self._new() 
3848  3814  _sig_on 
3849  3815  mpfr_jn(x.value, n, self.value, (<RealField>self._parent).rnd) 
3850  3816  _sig_off 
… 
… 

3860  3826  sage: R(2).y0() 
3861  3827  0.510375672649745 
3862  3828  """ 
3863   cdef RealNumber x 
3864   x = self._new() 
 3829  cdef RealNumber x = self._new() 
3865  3830  _sig_on 
3866  3831  mpfr_y0(x.value, self.value, (<RealField>self._parent).rnd) 
3867  3832  _sig_off 
… 
… 

3877  3842  sage: R(2).y1() 
3878  3843  0.107032431540938 
3879  3844  """ 
3880   cdef RealNumber x 
3881   x = self._new() 
 3845  cdef RealNumber x = self._new() 
3882  3846  _sig_on 
3883  3847  mpfr_y1(x.value, self.value, (<RealField>self._parent).rnd) 
3884  3848  _sig_off 
… 
… 

3897  3861  sage: R(2).yn(17) 
3898  3862  7.09038821729481e12 
3899  3863  """ 
3900   cdef RealNumber x 
3901   x = self._new() 
 3864  cdef RealNumber x = self._new() 
3902  3865  _sig_on 
3903  3866  mpfr_yn(x.value, n, self.value, (<RealField>self._parent).rnd) 
3904  3867  _sig_off 
… 
… 

3916  3879  sage: R(1.5).gamma() 
3917  3880  0.886226925452758 
3918  3881  """ 
3919   cdef RealNumber x 
3920   x = self._new() 
3921   _sig_on 
 3882  cdef RealNumber x = self._new() 
 3883  if (<RealField>self._parent).__prec > 1000: _sig_on 
3922  3884  mpfr_gamma(x.value, self.value, (<RealField>self._parent).rnd) 
3923   _sig_off 
 3885  if (<RealField>self._parent).__prec > 1000: _sig_off 
3924  3886  return x 
3925  3887  
3926  3888  def lngamma(self): 
… 
… 

3951  3913  sage: R(1e10).log_gamma() 
3952  3914  2.20258509288811e11 
3953  3915  """ 
3954   cdef RealNumber x 
3955   x = self._new() 
3956   _sig_on 
 3916  cdef RealNumber x = self._new() 
 3917  if (<RealField>self._parent).__prec > 1000: _sig_on 
3957  3918  mpfr_lngamma(x.value, self.value, (<RealField>self._parent).rnd) 
3958   _sig_off 
 3919  if (<RealField>self._parent).__prec > 1000: _sig_off 
3959  3920  return x 
3960  3921  
3961  3922  def zeta(self): 
… 
… 

4003  3964  sage: R(z) 
4004  3965  1.64493406684823 
4005  3966  """ 
4006   cdef RealNumber x 
4007   x = self._new() 
 3967  cdef RealNumber x = self._new() 
4008  3968  _sig_on 
4009  3969  mpfr_zeta(x.value, self.value, (<RealField>self._parent).rnd) 
4010  3970  _sig_off 