mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-16 17:19:41 +00:00
* floatfns.c (Fisnan, Fcopysign, Ffrexp, Fldexp): New functions.
* configure.in: Add tests for `isnan' and `copysign'.
This commit is contained in:
parent
5b3a105e67
commit
15e12598e1
@ -1,3 +1,7 @@
|
|||||||
|
2010-05-07 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
|
* configure.in: Add tests for `isnan' and `copysign'.
|
||||||
|
|
||||||
2010-05-07 Eli Zaretskii <eliz@gnu.org>
|
2010-05-07 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* config.bat: Allow for 2 leading `#'s in comments in
|
* config.bat: Allow for 2 leading `#'s in comments in
|
||||||
|
@ -2491,7 +2491,7 @@ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
|
|||||||
sendto recvfrom getsockopt setsockopt getsockname getpeername \
|
sendto recvfrom getsockopt setsockopt getsockname getpeername \
|
||||||
gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
|
gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
|
||||||
memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
|
memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
|
||||||
cfmakeraw cfsetspeed)
|
cfmakeraw cfsetspeed isnan copysign)
|
||||||
|
|
||||||
AC_CHECK_HEADERS(sys/un.h)
|
AC_CHECK_HEADERS(sys/un.h)
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2010-05-07 Vincent Belaïche <vincent.belaiche@gmail.com>
|
||||||
|
Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
|
* floatfns.c (Fisnan, Fcopysign, Ffrexp, Fldexp): New functions.
|
||||||
|
|
||||||
2010-05-07 Eli Zaretskii <eliz@gnu.org>
|
2010-05-07 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* w32fns.c: Include w32.h.
|
* w32fns.c: Include w32.h.
|
||||||
|
@ -135,6 +135,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* Define to 1 if you have the <com_err.h> header file. */
|
/* Define to 1 if you have the <com_err.h> header file. */
|
||||||
#undef HAVE_COM_ERR_H
|
#undef HAVE_COM_ERR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `copysign' function. */
|
||||||
|
#undef HAVE_COPYSIGN
|
||||||
|
|
||||||
/* Define to 1 if using D-Bus. */
|
/* Define to 1 if using D-Bus. */
|
||||||
#undef HAVE_DBUS
|
#undef HAVE_DBUS
|
||||||
|
|
||||||
@ -300,6 +303,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `isnan' function. */
|
||||||
|
#undef HAVE_ISNAN
|
||||||
|
|
||||||
/* Define to 1 if you have the jpeg library (-ljpeg). */
|
/* Define to 1 if you have the jpeg library (-ljpeg). */
|
||||||
#undef HAVE_JPEG
|
#undef HAVE_JPEG
|
||||||
|
|
||||||
|
@ -288,6 +288,70 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0,
|
|||||||
IN_FLOAT (d = sin (d) / c, "tan", arg);
|
IN_FLOAT (d = sin (d) / c, "tan", arg);
|
||||||
return make_float (d);
|
return make_float (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
|
||||||
|
DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0,
|
||||||
|
doc: /* Return non nil iff argument X is a NaN. */)
|
||||||
|
(x)
|
||||||
|
Lisp_Object x;
|
||||||
|
{
|
||||||
|
CHECK_FLOAT (x);
|
||||||
|
return isnan (XFLOAT_DATA (x)) ? Qt : Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0,
|
||||||
|
doc: /* Copy sign of X2 to value of X1, and return the result.
|
||||||
|
Cause an error if X1 or X2 is not a float. */)
|
||||||
|
(x1, x2)
|
||||||
|
Lisp_Object x1, x2;
|
||||||
|
{
|
||||||
|
double f1, f2;
|
||||||
|
|
||||||
|
CHECK_FLOAT (x1);
|
||||||
|
CHECK_FLOAT (x2);
|
||||||
|
|
||||||
|
f1 = XFLOAT_DATA (x1);
|
||||||
|
f2 = XFLOAT_DATA (x2);
|
||||||
|
|
||||||
|
return make_float (copysign (f1, f2));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0,
|
||||||
|
doc: /* Get significand and exponent of a floating point number.
|
||||||
|
Breaks the floating point number X into its binary significand SGNFCAND
|
||||||
|
\(a floating point value between 0.5 (included) and 1.0 (excluded))
|
||||||
|
and an integral exponent EXP for 2, such that:
|
||||||
|
|
||||||
|
X = SGNFCAND * 2^EXP
|
||||||
|
|
||||||
|
The function returns the cons cell (SGNFCAND . EXP).
|
||||||
|
If X is zero, both parts (SGNFCAND and EXP) are zero. */)
|
||||||
|
(x)
|
||||||
|
Lisp_Object x;
|
||||||
|
{
|
||||||
|
double f = XFLOATINT (x);
|
||||||
|
|
||||||
|
if (f == 0.0)
|
||||||
|
return Fcons (make_float (0.0), make_number (0));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int exp;
|
||||||
|
double sgnfcand = frexp (f, &exp);
|
||||||
|
return Fcons (make_float (sgnfcand), make_number (exp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0,
|
||||||
|
doc: /* Construct number X from significand SGNFCAND and exponent EXP.
|
||||||
|
Returns the floating point value resulting from multiplying SGNFCAND
|
||||||
|
(the significand) by 2 raised to the power of EXP (the exponent). */)
|
||||||
|
(sgnfcand, exp)
|
||||||
|
Lisp_Object sgnfcand, exp;
|
||||||
|
{
|
||||||
|
CHECK_NUMBER (exp);
|
||||||
|
return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0 /* Leave these out unless we find there's a reason for them. */
|
#if 0 /* Leave these out unless we find there's a reason for them. */
|
||||||
|
|
||||||
@ -1017,6 +1081,12 @@ syms_of_floatfns ()
|
|||||||
defsubr (&Scos);
|
defsubr (&Scos);
|
||||||
defsubr (&Ssin);
|
defsubr (&Ssin);
|
||||||
defsubr (&Stan);
|
defsubr (&Stan);
|
||||||
|
#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
|
||||||
|
defsubr (&Sisnan);
|
||||||
|
defsubr (&Scopysign);
|
||||||
|
defsubr (&Sfrexp);
|
||||||
|
defsubr (&Sldexp);
|
||||||
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
defsubr (&Sacosh);
|
defsubr (&Sacosh);
|
||||||
defsubr (&Sasinh);
|
defsubr (&Sasinh);
|
||||||
|
Loading…
Reference in New Issue
Block a user