Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpfr
mpfr
Commits
872651a5
Commit
872651a5
authored
Dec 21, 2021
by
ZIMMERMANN Paul
Browse files
gnu style
parent
0d3abf10
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/acosh.c
View file @
872651a5
...
...
@@ -27,7 +27,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
* acosh= ln(x + sqrt(x^2-1)) */
int
mpfr_acosh
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
mpfr_acosh
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
{
MPFR_SAVE_EXPO_DECL
(
expo
);
int
inexact
;
...
...
src/agm.c
View file @
872651a5
...
...
@@ -136,7 +136,7 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mpfr_rnd_t rnd_mode)
/* mpfr_add with !=prec is still good */
);
if
(
MPFR_UNLIKELY
(
MPFR_OVERFLOW
(
flags
)
||
MPFR_UNDERFLOW
(
flags
)))
{
mpfr_exp_t
e1
,
e2
;
mpfr_exp_t
e1
,
e2
;
MPFR_ASSERTN
(
scaleop
==
0
);
e1
=
MPFR_GET_EXP
(
op1
);
...
...
src/ai.c
View file @
872651a5
...
...
@@ -216,7 +216,7 @@ mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
mpfr_set_ui
(
ti
,
9
,
MPFR_RNDN
);
mpfr_cbrt
(
ti
,
ti
,
MPFR_RNDN
);
mpfr_mul
(
ti
,
ti
,
temp2
,
MPFR_RNDN
);
mpfr_ui_div
(
ti
,
1
,
ti
,
MPFR_RNDN
);
/* ti = 1/( Gamma (2/3)*9^(1/3) ) */
mpfr_ui_div
(
ti
,
1
,
ti
,
MPFR_RNDN
);
/* ti = 1/( Gamma (2/3)*9^(1/3) ) */
mpfr_set_ui
(
tip1
,
3
,
MPFR_RNDN
);
mpfr_cbrt
(
tip1
,
tip1
,
MPFR_RNDN
);
...
...
@@ -464,7 +464,7 @@ mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
mpfr_set_ui
(
u0
,
9
,
MPFR_RNDN
);
mpfr_cbrt
(
u0
,
u0
,
MPFR_RNDN
);
mpfr_mul
(
u0
,
u0
,
temp2
,
MPFR_RNDN
);
mpfr_ui_div
(
u0
,
1
,
u0
,
MPFR_RNDN
);
/* u0 = 1/( Gamma (2/3)*9^(1/3) ) */
mpfr_ui_div
(
u0
,
1
,
u0
,
MPFR_RNDN
);
/* u0 = 1/( Gamma (2/3)*9^(1/3) ) */
mpfr_set_ui
(
u1
,
3
,
MPFR_RNDN
);
mpfr_cbrt
(
u1
,
u1
,
MPFR_RNDN
);
...
...
src/cmp.c
View file @
872651a5
...
...
@@ -35,7 +35,7 @@ mpfr_cmp3 (mpfr_srcptr b, mpfr_srcptr c, int s)
mp_size_t
bn
,
cn
;
mp_limb_t
*
bp
,
*
cp
;
s
=
MPFR_MULT_SIGN
(
s
,
MPFR_SIGN
(
c
)
);
s
=
MPFR_MULT_SIGN
(
s
,
MPFR_SIGN
(
c
));
if
(
MPFR_ARE_SINGULAR
(
b
,
c
))
{
...
...
src/constant.c
View file @
872651a5
...
...
@@ -30,7 +30,7 @@ const mpfr_t __gmpfr_mone ={{2, MPFR_SIGN_NEG, 1, (mp_limb_t*)__gmpfr_limb1}};
#if 0
#elif
GMP_NUMB_BITS
==
8
static
const
mp_limb_t
mpfr_l2_dd__tab
[]
=
{
0xab
,
0x79
,
0xcf
,
0xd1
,
0xf7
,
0x17
,
0x72
,
0xb1
};
static
const
mp_limb_t
mpfr_l2_dd__tab
[]
=
{
0xab
,
0x79
,
0xcf
,
0xd1
,
0xf7
,
0x17
,
0x72
,
0xb1
};
#elif GMP_NUMB_BITS == 16
static
const
mp_limb_t
mpfr_l2_dd__tab
[]
=
{
0x79ab
,
0xd1cf
,
0x17f7
,
0xb172
};
#elif GMP_NUMB_BITS == 32
...
...
@@ -50,7 +50,7 @@ const mpfr_t __gmpfr_const_log2_RNDD =
#if 0
#elif
GMP_NUMB_BITS
==
8
static
const
mp_limb_t
mpfr_l2_du__tab
[]
=
{
0xac
,
0x79
,
0xcf
,
0xd1
,
0xf7
,
0x17
,
0x72
,
0xb1
};
static
const
mp_limb_t
mpfr_l2_du__tab
[]
=
{
0xac
,
0x79
,
0xcf
,
0xd1
,
0xf7
,
0x17
,
0x72
,
0xb1
};
#elif GMP_NUMB_BITS == 16
static
const
mp_limb_t
mpfr_l2_du__tab
[]
=
{
0x79ac
,
0xd1cf
,
0x17f7
,
0xb172
};
#elif GMP_NUMB_BITS == 32
...
...
src/cosh.c
View file @
872651a5
...
...
@@ -27,7 +27,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
* cosh= 1/2[e^(x)+e^(-x)] */
int
mpfr_cosh
(
mpfr_ptr
y
,
mpfr_srcptr
xt
,
mpfr_rnd_t
rnd_mode
)
mpfr_cosh
(
mpfr_ptr
y
,
mpfr_srcptr
xt
,
mpfr_rnd_t
rnd_mode
)
{
mpfr_t
x
;
int
inexact
;
...
...
src/div.c
View file @
872651a5
...
...
@@ -788,7 +788,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode)
MPFR_SET_NAN
(
q
);
MPFR_RET_NAN
;
}
sign_quotient
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
u
)
,
MPFR_SIGN
(
v
)
);
sign_quotient
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
u
),
MPFR_SIGN
(
v
));
MPFR_SET_SIGN
(
q
,
sign_quotient
);
if
(
MPFR_IS_INF
(
u
))
{
...
...
@@ -899,7 +899,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode)
MPFR_TMP_MARK
(
marker
);
/* set sign */
sign_quotient
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
u
)
,
MPFR_SIGN
(
v
)
);
sign_quotient
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
u
),
MPFR_SIGN
(
v
));
MPFR_SET_SIGN
(
q
,
sign_quotient
);
/* determine if an extra bit comes from the division, i.e. if the
...
...
src/exp10m1.c
View file @
872651a5
...
...
@@ -31,7 +31,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
If we put 0 in t, it means underflow.
Otherwise return 0. */
static
int
mpfr_exp10m1_small
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
,
mpfr_exp10m1_small
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
,
mpfr_ptr
t
)
{
mpfr_prec_t
prec
;
...
...
@@ -58,7 +58,7 @@ mpfr_exp10m1_small (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode,
}
int
mpfr_exp10m1
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
mpfr_exp10m1
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
{
int
inexact
,
nloop
;
mpfr_t
t
;
...
...
src/exp2m1.c
View file @
872651a5
...
...
@@ -31,7 +31,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
If we put 0 in t, it means underflow.
Otherwise return 0. */
static
int
mpfr_exp2m1_small
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
,
mpfr_ptr
t
)
mpfr_exp2m1_small
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
,
mpfr_ptr
t
)
{
mpfr_prec_t
prec
;
mpfr_exp_t
e
;
...
...
@@ -63,7 +63,7 @@ mpfr_exp2m1_small (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode, mpfr_ptr t)
}
int
mpfr_exp2m1
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
mpfr_exp2m1
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
{
int
inexact
,
nloop
;
mpfr_t
t
;
...
...
src/expm1.c
View file @
872651a5
...
...
@@ -28,7 +28,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
*/
int
mpfr_expm1
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
mpfr_expm1
(
mpfr_ptr
y
,
mpfr_srcptr
x
,
mpfr_rnd_t
rnd_mode
)
{
int
inexact
;
mpfr_exp_t
ex
;
...
...
src/fma.c
View file @
872651a5
...
...
@@ -59,7 +59,7 @@ mpfr_fma_singular (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
else
/* z is finite */
{
MPFR_SET_INF
(
s
);
MPFR_SET_SIGN
(
s
,
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
)
,
MPFR_SIGN
(
y
)));
MPFR_SET_SIGN
(
s
,
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
),
MPFR_SIGN
(
y
)));
MPFR_RET
(
0
);
}
}
...
...
@@ -75,7 +75,7 @@ mpfr_fma_singular (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
if
(
MPFR_IS_ZERO
(
z
))
{
int
sign_p
;
sign_p
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
)
,
MPFR_SIGN
(
y
)
);
sign_p
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
),
MPFR_SIGN
(
y
));
MPFR_SET_SIGN
(
s
,
(
rnd_mode
!=
MPFR_RNDD
?
(
MPFR_IS_NEG_SIGN
(
sign_p
)
&&
MPFR_IS_NEG
(
z
)
?
MPFR_SIGN_NEG
:
MPFR_SIGN_POS
)
:
...
...
@@ -146,7 +146,7 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_PREC
(
u
)
=
MPFR_PREC
(
zz
)
=
2
*
precx
;
MPFR_MANT
(
u
)
=
umant
;
MPFR_MANT
(
zz
)
=
zmant
;
MPFR_SIGN
(
u
)
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
)
,
MPFR_SIGN
(
y
)
);
MPFR_SIGN
(
u
)
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
),
MPFR_SIGN
(
y
));
MPFR_SIGN
(
zz
)
=
MPFR_SIGN
(
z
);
MPFR_EXP
(
zz
)
=
MPFR_EXP
(
z
);
if
(
MPFR_PREC
(
zz
)
<=
GMP_NUMB_BITS
)
/* zz fits in one limb */
...
...
@@ -203,7 +203,7 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
}
else
MPFR_EXP
(
u
)
=
e
;
MPFR_SIGN
(
u
)
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
)
,
MPFR_SIGN
(
y
)
);
MPFR_SIGN
(
u
)
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
x
),
MPFR_SIGN
(
y
));
/* The above code does not generate any exception.
The exceptions will come only from mpfr_add. */
inexact
=
mpfr_add
(
s
,
u
,
z
,
rnd_mode
);
...
...
src/get_str.c
View file @
872651a5
...
...
@@ -2815,7 +2815,7 @@ mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x,
/* normalize a and truncate */
if
((
result
[
n
+
nx1
-
1
]
&
MPFR_LIMB_HIGHBIT
)
==
0
)
{
mpn_lshift
(
a
,
result
+
nx1
,
n
,
1
);
mpn_lshift
(
a
,
result
+
nx1
,
n
,
1
);
a
[
0
]
|=
result
[
nx1
-
1
]
>>
(
GMP_NUMB_BITS
-
1
);
exp_a
--
;
}
...
...
src/mul.c
View file @
872651a5
...
...
@@ -51,7 +51,7 @@ mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
MPFR_SET_NAN
(
a
);
MPFR_RET_NAN
;
}
sign_product
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
b
)
,
MPFR_SIGN
(
c
)
);
sign_product
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
b
),
MPFR_SIGN
(
c
));
if
(
MPFR_IS_INF
(
b
))
{
if
(
MPFR_IS_INF
(
c
)
||
MPFR_NOTZERO
(
c
))
...
...
@@ -88,7 +88,7 @@ mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
MPFR_RET
(
0
);
/* 0 * 0 is exact */
}
}
sign_product
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
b
)
,
MPFR_SIGN
(
c
)
);
sign_product
=
MPFR_MULT_SIGN
(
MPFR_SIGN
(
b
),
MPFR_SIGN
(
c
));
ax
=
MPFR_GET_EXP
(
b
)
+
MPFR_GET_EXP
(
c
);
...
...
src/sinh.c
View file @
872651a5
...
...
@@ -112,7 +112,7 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
break
;
}
/* ti <- sinh(x/2):
,
error(ti) <= 1 ulp(ti)
/* ti <- sinh(x/2): error(ti) <= 1 ulp(ti)
cannot overflow because 0 < sinh(x) < cosh(x) when x > 0 */
mpfr_sinh
(
ti
,
ti
,
MPFR_RNDD
);
...
...
src/subnormal.c
View file @
872651a5
...
...
@@ -72,7 +72,7 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mpfr_rnd_t rnd)
if
(
rnd
==
MPFR_RNDN
||
rnd
==
MPFR_RNDNA
)
{
mp_limb_t
*
mant
,
rb
,
sb
;
mp_limb_t
*
mant
,
rb
,
sb
;
mp_size_t
s
;
/* We need the rounding bit and the sticky bit. Read them
and use the previous table to conclude. */
...
...
src/tanh.c
View file @
872651a5
...
...
@@ -24,7 +24,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-impl.h"
int
mpfr_tanh
(
mpfr_ptr
y
,
mpfr_srcptr
xt
,
mpfr_rnd_t
rnd_mode
)
mpfr_tanh
(
mpfr_ptr
y
,
mpfr_srcptr
xt
,
mpfr_rnd_t
rnd_mode
)
{
/****** Declaration ******/
mpfr_t
x
;
...
...
ZIMMERMANN Paul
@zimmerma
mentioned in commit
6d13a91e
·
Dec 26, 2021
mentioned in commit
6d13a91e
mentioned in commit 6d13a91e2800c7bc4dcd57d2d2c3bce9d55d7afb
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment