mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-04-25 10:50:30 -07:00
RATIONAL works now more accurately with long-floats
This commit is contained in:
parent
13763bae70
commit
849302a89b
2 changed files with 9 additions and 6 deletions
|
|
@ -6,6 +6,8 @@ ECL 9.6.2:
|
|||
- EXT:OUTPUT-FLOAT-NAN and EXT:OUTPUT-FLOAT-INFINITY can be redefined to
|
||||
customized how NaNs and infinities are output.
|
||||
|
||||
- RATIONAL works now more accurately with long-floats
|
||||
|
||||
ECL 9.6:
|
||||
========
|
||||
|
||||
|
|
|
|||
|
|
@ -770,14 +770,15 @@ cl_rational(cl_object x)
|
|||
d = frexp(d, &e);
|
||||
e -= DBL_MANT_DIG;
|
||||
x = double_to_integer(ldexp(d, DBL_MANT_DIG));
|
||||
x = ecl_times(cl_expt(MAKE_FIXNUM(FLT_RADIX),
|
||||
MAKE_FIXNUM(e)),
|
||||
x);
|
||||
if (e != 0) {
|
||||
x = ecl_times(cl_expt(MAKE_FIXNUM(FLT_RADIX),
|
||||
MAKE_FIXNUM(e)),
|
||||
x);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef ECL_LONG_FLOAT
|
||||
case t_longfloat: {
|
||||
/* Fixme! We need a long double -> integer conversion! */
|
||||
long double d = ecl_long_float(x);
|
||||
if (d == 0) {
|
||||
x = MAKE_FIXNUM(0);
|
||||
|
|
@ -785,11 +786,11 @@ cl_rational(cl_object x)
|
|||
int e;
|
||||
d = frexpl(d, &e);
|
||||
e -= LDBL_MANT_DIG;
|
||||
x = double_to_integer(ldexp(d, LDBL_MANT_DIG));
|
||||
x = long_double_to_integer(ldexpl(d, LDBL_MANT_DIG));
|
||||
if (e != 0) {
|
||||
x = ecl_times(cl_expt(MAKE_FIXNUM(FLT_RADIX),
|
||||
MAKE_FIXNUM(e)),
|
||||
x);
|
||||
x);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue