mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
1997-04-21 13:25 Ulrich Drepper <drepper@cygnus.com> * manual/arith.texi: Add description for INFINITY, _Imaginary_I, fpclassify & friends, and complex number operations. Update various other math functions for ISO C 9X. * manual/math.texi: Update various entries for ISO C 9X. Add description for complex number functions. Add description of rand48 function family. * manual/string.h: Add description of a64l and l64a. * math/cmathcalls.h: Fix typo. * stdlib/a64l.c: Pretty printing. * stdlib/seed48_r.c: Also reset `a' and `c' to default values. * stdlib/srand48_r.c: Likewise. * stdlib/stdlib.h: Pretty printing. * sysdeps/i386/fpu/__math.h: Fix typo. * sysdeps/libm-ieee754/s_nearbyintf.c: Correctly name function. * sysdeps/libm-ieee754/s_nearbyintl.c: Likewise. 1997-04-19 22:16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/e_pow.c: Rewrite handling of integral exponent. 1997-04-18 19:34 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/__math.h: Define optimized versions of isgreater, isgreaterequal, isless, islessequal, islessgreater, and isunordered. 1997-04-20 01:28 Richard Henderson <rth@tamu.edu> * rellns-sh: Handle files in the same directory correctly. 1997-04-20 11:22 Ulrich Drepper <drepper@cygnus.com> * csu/initfini.c: Place ALIGN instruction at correct positions. Patch by Richard Henderson <richard@twiddle.rth.home>. 1997-04-19 17:12 Ulrich Drepper <drepper@cygnus.com> * Make-dist: Don't automatically ignore .c files if the .S or .s file is ignored. * csu/Makefile (distribute): Add defs.awk. 1997-04-19 15:39 Ulrich Drepper <drepper@cygnus.com> * sysdeps/stub/shmat.c: Update to XPG4.2 interface. * sysdeps/stub/shmdt.c: Likewise. Reported by Thomas Bushnell, n/BSG. 1997-04-19 13:22 Ulrich Drepper <drepper@cygnus.com> * manual/stdio.texi: Add description of printf_size and printf_size_info. Partly based on the documentation by Larry McVoy. 1997-04-19 02:21 Ulrich Drepper <drepper@cygnus.com> * stdio-common/printf_size.c (printf_size): Correct values for `units'. Report by Larry McVoy <lm@neteng.engr.sgi.com>. * stdio-common/tst-printfsz.c: New file. * stdio-common/Makefile (tests): Add tst-printfsz.c. (CFLAGS-tst-printfsz.c): Define to prevent warnings about format strings. 1997-04-18 15:48 Ulrich Drepper <drepper@cygnus.com> * login/utmp.h: Add prototype for updwtmp. * login/logwtmp.c: Add new function updwtmp which allows to write a complete record to the wtmp file. Patch by Miquel van Smoorenburg <miquels@cistron.nl>. 1997-04-17 17:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * math/Makefile (headers): Add mathbits.h. 1997-04-16 21:20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/__math.h: Add inlined sincos{,l,f}. * sysdeps/m68k/fpu/s_sincos.c: New file. * sysdeps/m68k/fpu/s_sincosf.c: New file. * sysdeps/m68k/fpu/s_sincosl.c: New file. * sysdeps/libm-ieee754/e_scalb.c: Use internal names of the functions. * sysdeps/libm-ieee754/e_scalbl.c: Likewise. * sysdeps/libm-ieee754/s_ctanh.c: Use isfinite instead of finite. * sysdeps/libm-ieee754/s_ctanhf.c: Likewise. * sysdeps/libm-ieee754/s_ctanhl.c: Likewise. * sysdeps/libm-ieee754/s_ctan.c: Likewise. * sysdeps/libm-ieee754/s_ctanf.c: Likewise. * sysdeps/libm-ieee754/s_ctanl.c: Likewise. Fix type of `res'. 1997-04-18 11:21 Ulrich Drepper <drepper@cygnus.com> * shadow/fgetspent_r.c: Set *RESULT to NULL before returning error. Patch by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>.
This commit is contained in:
104
ChangeLog
104
ChangeLog
@ -1,3 +1,107 @@
|
|||||||
|
1997-04-21 13:25 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* manual/arith.texi: Add description for INFINITY, _Imaginary_I,
|
||||||
|
fpclassify & friends, and complex number operations.
|
||||||
|
Update various other math functions for ISO C 9X.
|
||||||
|
* manual/math.texi: Update various entries for ISO C 9X.
|
||||||
|
Add description for complex number functions.
|
||||||
|
Add description of rand48 function family.
|
||||||
|
* manual/string.h: Add description of a64l and l64a.
|
||||||
|
|
||||||
|
* math/cmathcalls.h: Fix typo.
|
||||||
|
|
||||||
|
* stdlib/a64l.c: Pretty printing.
|
||||||
|
|
||||||
|
* stdlib/seed48_r.c: Also reset `a' and `c' to default values.
|
||||||
|
* stdlib/srand48_r.c: Likewise.
|
||||||
|
* stdlib/stdlib.h: Pretty printing.
|
||||||
|
|
||||||
|
* sysdeps/i386/fpu/__math.h: Fix typo.
|
||||||
|
|
||||||
|
* sysdeps/libm-ieee754/s_nearbyintf.c: Correctly name function.
|
||||||
|
* sysdeps/libm-ieee754/s_nearbyintl.c: Likewise.
|
||||||
|
|
||||||
|
1997-04-19 22:16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* sysdeps/m68k/fpu/e_pow.c: Rewrite handling of integral exponent.
|
||||||
|
|
||||||
|
1997-04-18 19:34 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* sysdeps/m68k/fpu/__math.h: Define optimized versions of
|
||||||
|
isgreater, isgreaterequal, isless, islessequal, islessgreater, and
|
||||||
|
isunordered.
|
||||||
|
|
||||||
|
1997-04-20 01:28 Richard Henderson <rth@tamu.edu>
|
||||||
|
|
||||||
|
* rellns-sh: Handle files in the same directory correctly.
|
||||||
|
|
||||||
|
1997-04-20 11:22 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* csu/initfini.c: Place ALIGN instruction at correct positions.
|
||||||
|
Patch by Richard Henderson <richard@twiddle.rth.home>.
|
||||||
|
|
||||||
|
1997-04-19 17:12 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* Make-dist: Don't automatically ignore .c files if the .S or .s file
|
||||||
|
is ignored.
|
||||||
|
|
||||||
|
* csu/Makefile (distribute): Add defs.awk.
|
||||||
|
|
||||||
|
1997-04-19 15:39 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* sysdeps/stub/shmat.c: Update to XPG4.2 interface.
|
||||||
|
* sysdeps/stub/shmdt.c: Likewise.
|
||||||
|
Reported by Thomas Bushnell, n/BSG.
|
||||||
|
|
||||||
|
1997-04-19 13:22 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* manual/stdio.texi: Add description of printf_size and
|
||||||
|
printf_size_info. Partly based on the documentation by Larry McVoy.
|
||||||
|
|
||||||
|
1997-04-19 02:21 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* stdio-common/printf_size.c (printf_size): Correct values for
|
||||||
|
`units'.
|
||||||
|
Report by Larry McVoy <lm@neteng.engr.sgi.com>.
|
||||||
|
* stdio-common/tst-printfsz.c: New file.
|
||||||
|
* stdio-common/Makefile (tests): Add tst-printfsz.c.
|
||||||
|
(CFLAGS-tst-printfsz.c): Define to prevent warnings about format
|
||||||
|
strings.
|
||||||
|
|
||||||
|
1997-04-18 15:48 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* login/utmp.h: Add prototype for updwtmp.
|
||||||
|
* login/logwtmp.c: Add new function updwtmp which allows to write
|
||||||
|
a complete record to the wtmp file.
|
||||||
|
Patch by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||||
|
|
||||||
|
1997-04-17 17:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* math/Makefile (headers): Add mathbits.h.
|
||||||
|
|
||||||
|
1997-04-16 21:20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* sysdeps/m68k/fpu/__math.h: Add inlined sincos{,l,f}.
|
||||||
|
* sysdeps/m68k/fpu/s_sincos.c: New file.
|
||||||
|
* sysdeps/m68k/fpu/s_sincosf.c: New file.
|
||||||
|
* sysdeps/m68k/fpu/s_sincosl.c: New file.
|
||||||
|
|
||||||
|
* sysdeps/libm-ieee754/e_scalb.c: Use internal names of the
|
||||||
|
functions.
|
||||||
|
* sysdeps/libm-ieee754/e_scalbl.c: Likewise.
|
||||||
|
|
||||||
|
* sysdeps/libm-ieee754/s_ctanh.c: Use isfinite instead of finite.
|
||||||
|
* sysdeps/libm-ieee754/s_ctanhf.c: Likewise.
|
||||||
|
* sysdeps/libm-ieee754/s_ctanhl.c: Likewise.
|
||||||
|
* sysdeps/libm-ieee754/s_ctan.c: Likewise.
|
||||||
|
* sysdeps/libm-ieee754/s_ctanf.c: Likewise.
|
||||||
|
* sysdeps/libm-ieee754/s_ctanl.c: Likewise. Fix type of `res'.
|
||||||
|
|
||||||
|
1997-04-18 11:21 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* shadow/fgetspent_r.c: Set *RESULT to NULL before returning error.
|
||||||
|
Patch by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>.
|
||||||
|
|
||||||
1997-04-18 02:18 Ulrich Drepper <drepper@cygnus.com>
|
1997-04-18 02:18 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* csu/initfini.c: Rewrite by Zack Weinberg
|
* csu/initfini.c: Rewrite by Zack Weinberg
|
||||||
|
@ -118,8 +118,8 @@ foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
|
|||||||
$(+sysdeps)
|
$(+sysdeps)
|
||||||
foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
|
foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
|
||||||
foo:=$(shell echo generated='$(generated)' >&2)
|
foo:=$(shell echo generated='$(generated)' >&2)
|
||||||
generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
|
#generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
|
||||||
foo:=$(shell echo now generated='$(generated)' >&2)
|
#foo:=$(shell echo now generated='$(generated)' >&2)
|
||||||
+tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
|
+tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
|
||||||
foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
|
foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
|
||||||
foo:=$(shell echo foobie, dammit! >&2)
|
foo:=$(shell echo foobie, dammit! >&2)
|
||||||
|
16
config.guess
vendored
16
config.guess
vendored
@ -70,17 +70,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
amiga:OpenBSD:*:*)
|
amiga:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
arc:OpenBSD:*:*)
|
arc64:OpenBSD:*:*)
|
||||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
laguna:OpenBSD:*:*)
|
arc:OpenBSD:*:*)
|
||||||
echo mips64-unknown-openbsd${UNAME_RELEASE}
|
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
hkmips:OpenBSD:*:*)
|
||||||
|
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
pmax:OpenBSD:*:*)
|
pmax:OpenBSD:*:*)
|
||||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
sgi:OpenBSD:*:*)
|
||||||
|
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
wgrisc:OpenBSD:*:*)
|
wgrisc:OpenBSD:*:*)
|
||||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||||
|
@ -76,12 +76,12 @@ _init (void)
|
|||||||
if (__gmon_start__)
|
if (__gmon_start__)
|
||||||
__gmon_start__ ();
|
__gmon_start__ ();
|
||||||
|
|
||||||
|
asm ("ALIGN");
|
||||||
asm("END_INIT");
|
asm("END_INIT");
|
||||||
/* Now the epilog. */
|
/* Now the epilog. */
|
||||||
asm ("\n/*@_init_PROLOG_ENDS*/");
|
asm ("\n/*@_init_PROLOG_ENDS*/");
|
||||||
asm ("\n/*@_init_EPILOG_BEGINS*/");
|
asm ("\n/*@_init_EPILOG_BEGINS*/");
|
||||||
SECTION(".init");
|
SECTION(".init");
|
||||||
asm ("ALIGN");
|
|
||||||
}
|
}
|
||||||
asm ("END_INIT");
|
asm ("END_INIT");
|
||||||
|
|
||||||
@ -95,6 +95,7 @@ _fini (void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* End of the _fini prolog. */
|
/* End of the _fini prolog. */
|
||||||
|
asm ("ALIGN");
|
||||||
asm ("END_FINI");
|
asm ("END_FINI");
|
||||||
asm ("\n/*@_fini_PROLOG_ENDS*/");
|
asm ("\n/*@_fini_PROLOG_ENDS*/");
|
||||||
|
|
||||||
@ -109,7 +110,6 @@ _fini (void)
|
|||||||
/* Beginning of the _fini epilog. */
|
/* Beginning of the _fini epilog. */
|
||||||
asm ("\n/*@_fini_EPILOG_BEGINS*/");
|
asm ("\n/*@_fini_EPILOG_BEGINS*/");
|
||||||
SECTION (".fini");
|
SECTION (".fini");
|
||||||
asm ("ALIGN");
|
|
||||||
}
|
}
|
||||||
asm ("END_FINI");
|
asm ("END_FINI");
|
||||||
|
|
||||||
@ -117,6 +117,5 @@ asm ("END_FINI");
|
|||||||
is shared between both crt files. */
|
is shared between both crt files. */
|
||||||
asm ("\n/*@_fini_EPILOG_ENDS*/");
|
asm ("\n/*@_fini_EPILOG_ENDS*/");
|
||||||
asm ("\n/*@TRAILER_BEGINS*/");
|
asm ("\n/*@TRAILER_BEGINS*/");
|
||||||
asm ("ALIGN");
|
|
||||||
|
|
||||||
/* End of file. */
|
/* End of file. */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -25,18 +25,51 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
logwtmp (const char *line, const char *name, const char *host)
|
updwtmp (const char *wtmp_file, const struct utmp *ut)
|
||||||
{
|
{
|
||||||
struct utmp ut;
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
size_t written;
|
size_t written;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* Open WTMP file. */
|
/* Open WTMP file. */
|
||||||
fd = __open (_PATH_WTMP, O_WRONLY | O_APPEND);
|
fd = __open (wtmp_file, O_WRONLY | O_APPEND);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Try to lock the file. */
|
||||||
|
if (__flock (fd, LOCK_EX | LOCK_NB) < 0 && errno != ENOSYS)
|
||||||
|
{
|
||||||
|
/* Oh, oh. The file is already locked. Wait a bit and try again. */
|
||||||
|
sleep (1);
|
||||||
|
|
||||||
|
/* This time we ignore the error. */
|
||||||
|
__flock (fd, LOCK_EX | LOCK_NB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remember original size of log file: */
|
||||||
|
if (__fstat (fd, &st) < 0)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
/* Write the entry. If we can't write all the bytes, reset the file
|
||||||
|
size back to the original size. That way, no partial entries
|
||||||
|
will remain. */
|
||||||
|
written = __write (fd, ut, sizeof (struct utmp));
|
||||||
|
if (written > 0 && written != sizeof (struct utmp))
|
||||||
|
ftruncate (fd, st.st_size);
|
||||||
|
|
||||||
|
done:
|
||||||
|
/* And unlock the file. */
|
||||||
|
__flock (fd, LOCK_UN);
|
||||||
|
|
||||||
|
/* Close WTMP file. */
|
||||||
|
__close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
logwtmp (const char *line, const char *name, const char *host)
|
||||||
|
{
|
||||||
|
struct utmp ut;
|
||||||
|
|
||||||
/* Set information in new entry. */
|
/* Set information in new entry. */
|
||||||
memset (&ut, 0, sizeof (ut));
|
memset (&ut, 0, sizeof (ut));
|
||||||
#if _HAVE_UT_PID - 0
|
#if _HAVE_UT_PID - 0
|
||||||
@ -57,31 +90,5 @@ logwtmp (const char *line, const char *name, const char *host)
|
|||||||
time (&ut.ut_time);
|
time (&ut.ut_time);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Try to lock the file. */
|
updwtmp(_PATH_WTMP, &ut);
|
||||||
if (__flock (fd, LOCK_EX | LOCK_NB) < 0 && errno != ENOSYS)
|
|
||||||
{
|
|
||||||
/* Oh, oh. The file is already locked. Wait a bit and try again. */
|
|
||||||
sleep (1);
|
|
||||||
|
|
||||||
/* This time we ignore the error. */
|
|
||||||
__flock (fd, LOCK_EX | LOCK_NB);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remember original size of log file: */
|
|
||||||
if (__fstat (fd, &st) < 0)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
/* Write the entry. If we can't write all the bytes, reset the file
|
|
||||||
size back to the original size. That way, no partial entries
|
|
||||||
will remain. */
|
|
||||||
written = __write (fd, &ut, sizeof (ut));
|
|
||||||
if (written > 0 && written != sizeof (ut))
|
|
||||||
ftruncate (fd, st.st_size);
|
|
||||||
|
|
||||||
done:
|
|
||||||
/* And unlock the file. */
|
|
||||||
__flock (fd, LOCK_UN);
|
|
||||||
|
|
||||||
/* Close WTMP file. */
|
|
||||||
__close (fd);
|
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,10 @@ extern void login __P ((__const struct utmp *__entry));
|
|||||||
/* Write the utmp entry to say the user on UT_LINE has logged out. */
|
/* Write the utmp entry to say the user on UT_LINE has logged out. */
|
||||||
extern int logout __P ((__const char *__ut_line));
|
extern int logout __P ((__const char *__ut_line));
|
||||||
|
|
||||||
|
/* Append the given entry to a wtmp file. */
|
||||||
|
extern void updwtmp __P ((__const char *__wtmp_file,
|
||||||
|
__const struct utmp *__entry));
|
||||||
|
|
||||||
/* Append to wtmp an entry for the current time and the given info. */
|
/* Append to wtmp an entry for the current time and the given info. */
|
||||||
extern void logwtmp __P ((__const char *__ut_line, __const char *__ut_name,
|
extern void logwtmp __P ((__const char *__ut_line, __const char *__ut_name,
|
||||||
__const char *__ut_host));
|
__const char *__ut_host));
|
||||||
|
@ -3,12 +3,17 @@
|
|||||||
|
|
||||||
This chapter contains information about functions for doing basic
|
This chapter contains information about functions for doing basic
|
||||||
arithmetic operations, such as splitting a float into its integer and
|
arithmetic operations, such as splitting a float into its integer and
|
||||||
fractional parts. These functions are declared in the header file
|
fractional parts or retrieving the imaginary part of a complex value.
|
||||||
@file{math.h}.
|
These functions are declared in the header files @file{math.h} and
|
||||||
|
@file{complex.h}.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
|
* Infinity:: What is Infinity and how to test for it.
|
||||||
* Not a Number:: Making NaNs and testing for NaNs.
|
* Not a Number:: Making NaNs and testing for NaNs.
|
||||||
|
* Imaginary Unit:: Constructing complex Numbers.
|
||||||
* Predicates on Floats:: Testing for infinity and for NaNs.
|
* Predicates on Floats:: Testing for infinity and for NaNs.
|
||||||
|
* Floating-Point Classes:: Classifiy floating-point numbers.
|
||||||
|
* Operations on Complex:: Projections, Conjugates, and Decomposing.
|
||||||
* Absolute Value:: Absolute value functions.
|
* Absolute Value:: Absolute value functions.
|
||||||
* Normalization Functions:: Hacks for radix-2 representations.
|
* Normalization Functions:: Hacks for radix-2 representations.
|
||||||
* Rounding and Remainders:: Determining the integer and
|
* Rounding and Remainders:: Determining the integer and
|
||||||
@ -19,6 +24,44 @@ fractional parts. These functions are declared in the header file
|
|||||||
from strings.
|
from strings.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
@node Infinity
|
||||||
|
@section Infinity Values
|
||||||
|
@cindex Infinity
|
||||||
|
@cindex IEEE floating point
|
||||||
|
|
||||||
|
Mathematical operations easily can produce as the result values which
|
||||||
|
are not representable by the floating-point format. The functions in
|
||||||
|
the mathematics library also have this problem. The situation is
|
||||||
|
generally solved by raising an overflow exception and by returning a
|
||||||
|
huge value.
|
||||||
|
|
||||||
|
The @w{IEEE 754} floating-point defines a special value to be used in
|
||||||
|
these situations. There is a special value for infinity.
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypevr Macro float_t INFINITY
|
||||||
|
A expression representing the inifite value. @code{INFINITY} values are
|
||||||
|
produce by mathematical operations like @code{1.0 / 0.0}. It is
|
||||||
|
possible to continue the computations with this value since the basic
|
||||||
|
operations as well as the mathematical library functions are prepared to
|
||||||
|
handle values like this.
|
||||||
|
|
||||||
|
Beside @code{INFINITY} also the value @code{-INIFITY} is representable
|
||||||
|
and it is handled differently if needed. It is possible to test a
|
||||||
|
variables for infinite value using a simple comparison but the
|
||||||
|
recommended way is to use the the @code{isinf} function.
|
||||||
|
|
||||||
|
This macro was introduced in the @w{ISO C 9X} standard.
|
||||||
|
@end deftypevr
|
||||||
|
|
||||||
|
@vindex HUGE_VAL
|
||||||
|
The macros @code{HUGE_VAL}, @code{HUGE_VALF} and @code{HUGE_VALL} are
|
||||||
|
defined in a similar way but they are not required to represent the
|
||||||
|
infinite value, only a very large value (@pxref{Domain and Range Errors}).
|
||||||
|
If actually infinity is wanted, @code{INFINITY} should be used.
|
||||||
|
|
||||||
|
|
||||||
@node Not a Number
|
@node Not a Number
|
||||||
@section ``Not a Number'' Values
|
@section ``Not a Number'' Values
|
||||||
@cindex NaN
|
@cindex NaN
|
||||||
@ -54,6 +97,46 @@ such as by defining @code{_GNU_SOURCE}, and then you must include
|
|||||||
@file{math.h}.)
|
@file{math.h}.)
|
||||||
@end deftypevr
|
@end deftypevr
|
||||||
|
|
||||||
|
@node Imaginary Unit
|
||||||
|
@section Constructing complex Numbers
|
||||||
|
|
||||||
|
@pindex complex.h
|
||||||
|
To construct complex numbers it is necessary have a way to express the
|
||||||
|
imaginary part of the numbers. In mathematics one uses the symbol ``i''
|
||||||
|
to mark a number as imaginary. For convenienve the @file{complex.h}
|
||||||
|
header defines two macros which allow to use a similar easy notation.
|
||||||
|
|
||||||
|
@deftypevr Macro float_t _Imaginary_I
|
||||||
|
This macro is a (compiler specific) representation of the value ``1i''.
|
||||||
|
I.e., it is the value for which
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
_Imaginary_I * _Imaginary_I = -1
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
One can use it to easily construct complex number like in
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
3.0 - _Imaginary_I * 4.0
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
which results in the complex number with a real part of 3.0 and a
|
||||||
|
imaginary part -4.0.
|
||||||
|
@end deftypevr
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
A more intuitive approach is to use the following macro.
|
||||||
|
|
||||||
|
@deftypevr Macro float_t I
|
||||||
|
This macro has exactly the same value as @code{_Imaginary_I}. The
|
||||||
|
problem is that the name @code{I} very easily can clash with macros or
|
||||||
|
variables in programs and so it might be a good idea to avoid this name
|
||||||
|
and stay at the safe side by using @code{_Imaginary_I}.
|
||||||
|
@end deftypevr
|
||||||
|
|
||||||
|
|
||||||
@node Predicates on Floats
|
@node Predicates on Floats
|
||||||
@section Predicates on Floats
|
@section Predicates on Floats
|
||||||
|
|
||||||
@ -66,6 +149,10 @@ functions, and thus are available if you define @code{_BSD_SOURCE} or
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun int isinf (double @var{x})
|
@deftypefun int isinf (double @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun int isinff (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun int isinfl (long double @var{x})
|
||||||
This function returns @code{-1} if @var{x} represents negative infinity,
|
This function returns @code{-1} if @var{x} represents negative infinity,
|
||||||
@code{1} if @var{x} represents positive infinity, and @code{0} otherwise.
|
@code{1} if @var{x} represents positive infinity, and @code{0} otherwise.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
@ -73,6 +160,10 @@ This function returns @code{-1} if @var{x} represents negative infinity,
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun int isnan (double @var{x})
|
@deftypefun int isnan (double @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun int isnanf (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun int isnanl (long double @var{x})
|
||||||
This function returns a nonzero value if @var{x} is a ``not a number''
|
This function returns a nonzero value if @var{x} is a ``not a number''
|
||||||
value, and zero otherwise. (You can just as well use @code{@var{x} !=
|
value, and zero otherwise. (You can just as well use @code{@var{x} !=
|
||||||
@var{x}} to get the same result).
|
@var{x}} to get the same result).
|
||||||
@ -81,6 +172,10 @@ value, and zero otherwise. (You can just as well use @code{@var{x} !=
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun int finite (double @var{x})
|
@deftypefun int finite (double @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun int finitef (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun int finitel (long double @var{x})
|
||||||
This function returns a nonzero value if @var{x} is finite or a ``not a
|
This function returns a nonzero value if @var{x} is finite or a ``not a
|
||||||
number'' value, and zero otherwise.
|
number'' value, and zero otherwise.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
@ -103,6 +198,189 @@ does not fit the @w{ISO C} specification.
|
|||||||
@strong{Portability Note:} The functions listed in this section are BSD
|
@strong{Portability Note:} The functions listed in this section are BSD
|
||||||
extensions.
|
extensions.
|
||||||
|
|
||||||
|
@node Floating-Point Classes
|
||||||
|
@section Floating-Point Number Classification Functions
|
||||||
|
|
||||||
|
Instead of using the BSD specific functions from the last section it is
|
||||||
|
better to use those in this section will are introduced in the @w{ISO C
|
||||||
|
9X} standard and are therefore widely available.
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun int fpclassify (@emph{float-type} @var{x})
|
||||||
|
This is a generic macro which works on all floating-point types and
|
||||||
|
which returns a value of type @code{int}. The possible values are:
|
||||||
|
|
||||||
|
@vtable @code
|
||||||
|
@item FP_NAN
|
||||||
|
The floating-point number @var{x} is ``Not a Number'' (@pxref{Not a Number})
|
||||||
|
@item FP_INFINITE
|
||||||
|
The value of @var{x} is either plus or minus infinity (@pxref{Infinity})
|
||||||
|
@item FP_ZERO
|
||||||
|
The value of @var{x} is zero. In floating-point formats like @w{IEEE
|
||||||
|
754} where the zero value can be signed this value is also returned if
|
||||||
|
@var{x} is minus zero.
|
||||||
|
@item FP_SUBNORMAL
|
||||||
|
Some floating-point formats (such as @w{IEEE 754}) allow floating-point
|
||||||
|
numbers to be represented in a denormalized format. This happens if the
|
||||||
|
absolute value of the number is too small to be represented in the
|
||||||
|
normal format. @code{FP_SUBNORMAL} is returned for such values of @var{x}.
|
||||||
|
@item FP_NORMAL
|
||||||
|
This value is returned for all other cases which means the number is a
|
||||||
|
plain floating-point number without special meaning.
|
||||||
|
@end vtable
|
||||||
|
|
||||||
|
This macro is useful if more than property of a number must be
|
||||||
|
tested. If one only has to test for, e.g., a NaN value, there are
|
||||||
|
function which are faster.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
The remainder of this section introduces some more specific functions.
|
||||||
|
They might be implemented faster than the call to @code{fpclassify} and
|
||||||
|
if the actual need in the program is covered be these functions they
|
||||||
|
should be used (and not @code{fpclassify}).
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun int isfinite (@emph{float-type} @var{x})
|
||||||
|
The value returned by this macro is nonzero if the value of @var{x} is
|
||||||
|
not plus or minus infinity and not NaN. I.e., it could be implemented as
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
(fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE)
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
@code{isfinite} is also implemented as a macro which can handle all
|
||||||
|
floating-point types. Programs should use this function instead of
|
||||||
|
@var{finite} (@pxref{Predicates on Floats}).
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun int isnormal (@emph{float-type} @var{x})
|
||||||
|
If @code{isnormal} returns a nonzero value the value or @var{x} is
|
||||||
|
neither a NaN, infinity, zero, nor a denormalized number. I.e., it
|
||||||
|
could be implemented as
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
(fpclassify (x) == FP_NORMAL)
|
||||||
|
@end smallexample
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun int isnan (@emph{float-type} @var{x})
|
||||||
|
The situation with this macro is a bit complicated. Here @code{isnan}
|
||||||
|
is a macro which can handle all kinds of floating-point types. It
|
||||||
|
returns a nonzero value is @var{x} does not represent a NaN value and
|
||||||
|
could be written like this
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
(fpclassify (x) == FP_NAN)
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
The complication is that there is a function of the same name and the
|
||||||
|
same semantic defined for compatibility with BSD (@pxref{Predicates on
|
||||||
|
Floats}). Fortunately this should not yield to problems in most cases
|
||||||
|
since the macro and the function have the same semantic. Should in a
|
||||||
|
situation the function be absolutely necessary one can use
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
(isnan) (x)
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
to avoid the macro expansion. Using the macro has two big adavantages:
|
||||||
|
it is more portable and one does not have to choose the right function
|
||||||
|
among @code{isnan}, @code{isnanf}, and @code{isnanl}.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
|
||||||
|
@node Operations on Complex
|
||||||
|
@section Projections, Conjugates, and Decomposing of Complex Numbers
|
||||||
|
@cindex project complex numbers
|
||||||
|
@cindex conjugate complex numbers
|
||||||
|
@cindex decompose complex numbers
|
||||||
|
|
||||||
|
This section lists functions performing some of the simple mathematical
|
||||||
|
operations on complex numbers. Using any of the function requries that
|
||||||
|
the C compiler understands the @code{complex} keyword, introduced to the
|
||||||
|
C language in the @w{ISO C 9X} standard.
|
||||||
|
|
||||||
|
@pindex complex.h
|
||||||
|
The prototypes for all functions in this section can be found in
|
||||||
|
@file{complex.h}. All functions are available in three variants, one
|
||||||
|
for each of the three floating-point types.
|
||||||
|
|
||||||
|
The easiest operation on complex numbers is the decomposition in the
|
||||||
|
real part and the imaginary part. This is done by the next two
|
||||||
|
functions.
|
||||||
|
|
||||||
|
@comment complex.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun double creal (complex double @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun float crealf (complex float @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} creall (complex long double @var{z})
|
||||||
|
These functions return the real part of the complex number @var{z}.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment complex.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun double cimag (complex double @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun float cimagf (complex float @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} cimagl (complex long double @var{z})
|
||||||
|
These functions return the imaginary part of the complex number @var{z}.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
|
||||||
|
The conjugate complex value of a given complex number has the same value
|
||||||
|
for the real part but the complex part is negated.
|
||||||
|
|
||||||
|
@comment complex.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun {complex double} conj (complex double @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {complex float} conjf (complex float @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {complex long double} conjl (complex long double @var{z})
|
||||||
|
These functions return the conjugate complex value of the complex number
|
||||||
|
@var{z}.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment complex.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun double carg (complex double @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun float cargf (complex float @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} cargl (complex long double @var{z})
|
||||||
|
These functions return argument of the complex number @var{z}.
|
||||||
|
|
||||||
|
Mathematically, the argument is the phase angle of @var{z} with a branch
|
||||||
|
cut along the negative real axis.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment complex.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun {complex double} cproj (complex double @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {complex float} cprojf (complex float @var{z})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {complex long double} cprojl (complex long double @var{z})
|
||||||
|
Return the projection of the complex value @var{z} on the Riemann
|
||||||
|
sphere. Values with a infinite complex part (even if the real part
|
||||||
|
is NaN) are projected to positive infinte on the real axis. If the real part is infinite, the result is equivalent to
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
INFINITY + I * copysign (0.0, cimag (z))
|
||||||
|
@end smallexample
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
|
||||||
@node Absolute Value
|
@node Absolute Value
|
||||||
@section Absolute Value
|
@section Absolute Value
|
||||||
@cindex absolute value functions
|
@cindex absolute value functions
|
||||||
@ -117,7 +395,8 @@ whose imaginary part is @var{y}, the absolute value is @w{@code{sqrt
|
|||||||
@pindex math.h
|
@pindex math.h
|
||||||
@pindex stdlib.h
|
@pindex stdlib.h
|
||||||
Prototypes for @code{abs} and @code{labs} are in @file{stdlib.h};
|
Prototypes for @code{abs} and @code{labs} are in @file{stdlib.h};
|
||||||
@code{fabs} and @code{cabs} are declared in @file{math.h}.
|
@code{fabs}, @code{fabsf} and @code{fabsl} are declared in @file{math.h};
|
||||||
|
@code{cabs}, @code{cabsf} and @code{cabsl} are declared in @file{complex.h}.
|
||||||
|
|
||||||
@comment stdlib.h
|
@comment stdlib.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@ -139,20 +418,28 @@ are of type @code{long int} rather than @code{int}.
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double fabs (double @var{number})
|
@deftypefun double fabs (double @var{number})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun float fabsf (float @var{number})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} fabsl (long double @var{number})
|
||||||
This function returns the absolute value of the floating-point number
|
This function returns the absolute value of the floating-point number
|
||||||
@var{number}.
|
@var{number}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@comment math.h
|
@comment complex.h
|
||||||
@comment BSD
|
@comment ISO
|
||||||
@deftypefun double cabs (struct @{ double real, imag; @} @var{z})
|
@deftypefun double cabs (complex double @var{z})
|
||||||
The @code{cabs} function returns the absolute value of the complex
|
@end deftypefun
|
||||||
number @var{z}, whose real part is @code{@var{z}.real} and whose
|
@deftypefun float cabsf (complex float @var{z})
|
||||||
imaginary part is @code{@var{z}.imag}. (See also the function
|
@end deftypefun
|
||||||
@code{hypot} in @ref{Exponents and Logarithms}.) The value is:
|
@deftypefun {long double} cabsl (complex long double @var{z})
|
||||||
|
These functions return the absolute value of the complex number @var{z}.
|
||||||
|
The compiler must support complex numbers to use these functions. (See
|
||||||
|
also the function @code{hypot} in @ref{Exponents and Logarithms}.) The
|
||||||
|
value is:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
sqrt (@var{z}.real*@var{z}.real + @var{z}.imag*@var{z}.imag)
|
sqrt (creal (@var{z}) * creal (@var{z}) + cimag (@var{z}) * cimag (@var{z}))
|
||||||
@end smallexample
|
@end smallexample
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@ -174,7 +461,11 @@ All these functions are declared in @file{math.h}.
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double frexp (double @var{value}, int *@var{exponent})
|
@deftypefun double frexp (double @var{value}, int *@var{exponent})
|
||||||
The @code{frexp} function is used to split the number @var{value}
|
@end deftypefun
|
||||||
|
@deftypefun float frexpf (float @var{value}, int *@var{exponent})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} frexpl (long double @var{value}, int *@var{exponent})
|
||||||
|
These functions are used to split the number @var{value}
|
||||||
into a normalized fraction and an exponent.
|
into a normalized fraction and an exponent.
|
||||||
|
|
||||||
If the argument @var{value} is not zero, the return value is @var{value}
|
If the argument @var{value} is not zero, the return value is @var{value}
|
||||||
@ -193,7 +484,11 @@ zero is stored in @code{*@var{exponent}}.
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double ldexp (double @var{value}, int @var{exponent})
|
@deftypefun double ldexp (double @var{value}, int @var{exponent})
|
||||||
This function returns the result of multiplying the floating-point
|
@end deftypefun
|
||||||
|
@deftypefun float ldexpf (float @var{value}, int @var{exponent})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} ldexpl (long double @var{value}, int @var{exponent})
|
||||||
|
These functions return the result of multiplying the floating-point
|
||||||
number @var{value} by 2 raised to the power @var{exponent}. (It can
|
number @var{value} by 2 raised to the power @var{exponent}. (It can
|
||||||
be used to reassemble floating-point numbers that were taken apart
|
be used to reassemble floating-point numbers that were taken apart
|
||||||
by @code{frexp}.)
|
by @code{frexp}.)
|
||||||
@ -207,13 +502,21 @@ equivalent to those of @code{ldexp} and @code{frexp}:
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun double scalb (double @var{value}, int @var{exponent})
|
@deftypefun double scalb (double @var{value}, int @var{exponent})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun float scalbf (float @var{value}, int @var{exponent})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} scalbl (long double @var{value}, int @var{exponent})
|
||||||
The @code{scalb} function is the BSD name for @code{ldexp}.
|
The @code{scalb} function is the BSD name for @code{ldexp}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun double logb (double @var{x})
|
@deftypefun double logb (double @var{x})
|
||||||
This BSD function returns the integer part of the base-2 logarithm of
|
@end deftypefun
|
||||||
|
@deftypefun float logbf (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} logbl (long double @var{x})
|
||||||
|
These BSD functions return the integer part of the base-2 logarithm of
|
||||||
@var{x}, an integer value represented in type @code{double}. This is
|
@var{x}, an integer value represented in type @code{double}. This is
|
||||||
the highest integer power of @code{2} contained in @var{x}. The sign of
|
the highest integer power of @code{2} contained in @var{x}. The sign of
|
||||||
@var{x} is ignored. For example, @code{logb (3.5)} is @code{1.0} and
|
@var{x} is ignored. For example, @code{logb (3.5)} is @code{1.0} and
|
||||||
@ -231,11 +534,28 @@ The value returned by @code{logb} is one less than the value that
|
|||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment ISO
|
||||||
@deftypefun double copysign (double @var{value}, double @var{sign})
|
@deftypefun double copysign (double @var{value}, double @var{sign})
|
||||||
The @code{copysign} function returns a value whose absolute value is the
|
@end deftypefun
|
||||||
|
@deftypefun float copysignf (float @var{value}, float @var{sign})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} copysignl (long double @var{value}, long double @var{sign})
|
||||||
|
These functions return a value whose absolute value is the
|
||||||
same as that of @var{value}, and whose sign matches that of @var{sign}.
|
same as that of @var{value}, and whose sign matches that of @var{sign}.
|
||||||
This is a BSD function.
|
This function appears in BSD and was standardized in @w{ISO C 9X}.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun int signbit (@emph{float-type} @var{x})
|
||||||
|
@code{signbit} is a generic macro which can work on all floating-point
|
||||||
|
types. It returns a nonzero value if the value of @var{x} has its sign
|
||||||
|
bit set.
|
||||||
|
|
||||||
|
This is not the same as @code{x < 0.0} since in some floating-point
|
||||||
|
formats (e.g., @w{IEEE 754}) the zero value is optionally signed. The
|
||||||
|
comparison @code{-0.0 < 0.0} will not be true while @code{signbit
|
||||||
|
(-0.0)} will return a nonzeri value.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Rounding and Remainders
|
@node Rounding and Remainders
|
||||||
@ -260,7 +580,11 @@ result as a @code{double} instead to get around this problem.
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double ceil (double @var{x})
|
@deftypefun double ceil (double @var{x})
|
||||||
The @code{ceil} function rounds @var{x} upwards to the nearest integer,
|
@end deftypefun
|
||||||
|
@deftypefun float ceilf (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} ceill (long double @var{x})
|
||||||
|
These functions round @var{x} upwards to the nearest integer,
|
||||||
returning that value as a @code{double}. Thus, @code{ceil (1.5)}
|
returning that value as a @code{double}. Thus, @code{ceil (1.5)}
|
||||||
is @code{2.0}.
|
is @code{2.0}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
@ -268,15 +592,23 @@ is @code{2.0}.
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double floor (double @var{x})
|
@deftypefun double floor (double @var{x})
|
||||||
The @code{ceil} function rounds @var{x} downwards to the nearest
|
@end deftypefun
|
||||||
|
@deftypefun float floorf (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} floorl (long double @var{x})
|
||||||
|
These functions round @var{x} downwards to the nearest
|
||||||
integer, returning that value as a @code{double}. Thus, @code{floor
|
integer, returning that value as a @code{double}. Thus, @code{floor
|
||||||
(1.5)} is @code{1.0} and @code{floor (-1.5)} is @code{-2.0}.
|
(1.5)} is @code{1.0} and @code{floor (-1.5)} is @code{-2.0}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment ISO
|
||||||
@deftypefun double rint (double @var{x})
|
@deftypefun double rint (double @var{x})
|
||||||
This function rounds @var{x} to an integer value according to the
|
@end deftypefun
|
||||||
|
@deftypefun float rintf (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} rintl (long double @var{x})
|
||||||
|
These functions round @var{x} to an integer value according to the
|
||||||
current rounding mode. @xref{Floating Point Parameters}, for
|
current rounding mode. @xref{Floating Point Parameters}, for
|
||||||
information about the various rounding modes. The default
|
information about the various rounding modes. The default
|
||||||
rounding mode is to round to the nearest integer; some machines
|
rounding mode is to round to the nearest integer; some machines
|
||||||
@ -284,10 +616,26 @@ support other modes, but round-to-nearest is always used unless
|
|||||||
you explicit select another.
|
you explicit select another.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefun double nearbyint (double @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun float nearbyintf (float @var{x})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} nearbyintl (long double @var{x})
|
||||||
|
These functions return the same value as the @code{rint} functions but
|
||||||
|
even some rounding actually takes place @code{nearbyint} does @emph{not}
|
||||||
|
raise the inexact exception.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double modf (double @var{value}, double *@var{integer-part})
|
@deftypefun double modf (double @var{value}, double *@var{integer-part})
|
||||||
This function breaks the argument @var{value} into an integer part and a
|
@end deftypefun
|
||||||
|
@deftypefun float modff (flaot @var{value}, float *@var{integer-part})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} modfl (long double @var{value}, long double *@var{integer-part})
|
||||||
|
These functions break the argument @var{value} into an integer part and a
|
||||||
fractional part (between @code{-1} and @code{1}, exclusive). Their sum
|
fractional part (between @code{-1} and @code{1}, exclusive). Their sum
|
||||||
equals @var{value}. Each of the parts has the same sign as @var{value},
|
equals @var{value}. Each of the parts has the same sign as @var{value},
|
||||||
so the rounding of the integer part is towards zero.
|
so the rounding of the integer part is towards zero.
|
||||||
@ -300,7 +648,11 @@ returns @code{0.5} and stores @code{2.0} into @code{intpart}.
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment ISO
|
@comment ISO
|
||||||
@deftypefun double fmod (double @var{numerator}, double @var{denominator})
|
@deftypefun double fmod (double @var{numerator}, double @var{denominator})
|
||||||
This function computes the remainder from the division of
|
@end deftypefun
|
||||||
|
@deftypefun float fmodf (float @var{numerator}, float @var{denominator})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} fmodl (long double @var{numerator}, long double @var{denominator})
|
||||||
|
These functions compute the remainder from the division of
|
||||||
@var{numerator} by @var{denominator}. Specifically, the return value is
|
@var{numerator} by @var{denominator}. Specifically, the return value is
|
||||||
@code{@var{numerator} - @w{@var{n} * @var{denominator}}}, where @var{n}
|
@code{@var{numerator} - @w{@var{n} * @var{denominator}}}, where @var{n}
|
||||||
is the quotient of @var{numerator} divided by @var{denominator}, rounded
|
is the quotient of @var{numerator} divided by @var{denominator}, rounded
|
||||||
@ -317,7 +669,11 @@ If @var{denominator} is zero, @code{fmod} fails and sets @code{errno} to
|
|||||||
@comment math.h
|
@comment math.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun double drem (double @var{numerator}, double @var{denominator})
|
@deftypefun double drem (double @var{numerator}, double @var{denominator})
|
||||||
The function @code{drem} is like @code{fmod} except that it rounds the
|
@end deftypefun
|
||||||
|
@deftypefun float dremf (float @var{numerator}, float @var{denominator})
|
||||||
|
@end deftypefun
|
||||||
|
@deftypefun {long double} dreml (long double @var{numerator}, long double @var{denominator})
|
||||||
|
These functions are like @code{fmod} etc except that it rounds the
|
||||||
internal quotient @var{n} to the nearest integer instead of towards zero
|
internal quotient @var{n} to the nearest integer instead of towards zero
|
||||||
to an integer. For example, @code{drem (6.5, 2.3)} returns @code{-0.4},
|
to an integer. For example, @code{drem (6.5, 2.3)} returns @code{-0.4},
|
||||||
which is @code{6.5} minus @code{6.9}.
|
which is @code{6.5} minus @code{6.9}.
|
||||||
|
840
manual/math.texi
840
manual/math.texi
File diff suppressed because it is too large
Load Diff
@ -32,9 +32,10 @@ too.
|
|||||||
* Search Functions:: Searching for a specific element or substring.
|
* Search Functions:: Searching for a specific element or substring.
|
||||||
* Finding Tokens in a String:: Splitting a string into tokens by looking
|
* Finding Tokens in a String:: Splitting a string into tokens by looking
|
||||||
for delimiters.
|
for delimiters.
|
||||||
|
* Encode Binary Data:: Encoding and Decoding of Binary Data.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Representation of Strings, String/Array Conventions, , String and Array Utilities
|
@node Representation of Strings
|
||||||
@section Representation of Strings
|
@section Representation of Strings
|
||||||
@cindex string, representation of
|
@cindex string, representation of
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ checks for overflowing the array. Many of the library functions
|
|||||||
an extra byte to hold the null character that marks the end of the
|
an extra byte to hold the null character that marks the end of the
|
||||||
string.
|
string.
|
||||||
|
|
||||||
@node String/Array Conventions, String Length, Representation of Strings, String and Array Utilities
|
@node String/Array Conventions
|
||||||
@section String and Array Conventions
|
@section String and Array Conventions
|
||||||
|
|
||||||
This chapter describes both functions that work on arbitrary arrays or
|
This chapter describes both functions that work on arbitrary arrays or
|
||||||
@ -132,7 +133,7 @@ other hand, when you are manipulating null-terminated strings it is
|
|||||||
usually more convenient to use the @samp{str} functions, unless you
|
usually more convenient to use the @samp{str} functions, unless you
|
||||||
already know the length of the string in advance.
|
already know the length of the string in advance.
|
||||||
|
|
||||||
@node String Length, Copying and Concatenation, String/Array Conventions, String and Array Utilities
|
@node String Length
|
||||||
@section String Length
|
@section String Length
|
||||||
|
|
||||||
You can get the length of a string using the @code{strlen} function.
|
You can get the length of a string using the @code{strlen} function.
|
||||||
@ -166,7 +167,7 @@ strlen (string)
|
|||||||
@end smallexample
|
@end smallexample
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Copying and Concatenation, String/Array Comparison, String Length, String and Array Utilities
|
@node Copying and Concatenation
|
||||||
@section Copying and Concatenation
|
@section Copying and Concatenation
|
||||||
|
|
||||||
You can use the functions described in this section to copy the contents
|
You can use the functions described in this section to copy the contents
|
||||||
@ -470,7 +471,7 @@ BSD. Note that it is not as general as @code{memset}, because the only
|
|||||||
value it can store is zero.
|
value it can store is zero.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node String/Array Comparison, Collation Functions, Copying and Concatenation, String and Array Utilities
|
@node String/Array Comparison
|
||||||
@section String/Array Comparison
|
@section String/Array Comparison
|
||||||
@cindex comparing strings and arrays
|
@cindex comparing strings and arrays
|
||||||
@cindex string comparison functions
|
@cindex string comparison functions
|
||||||
@ -613,7 +614,7 @@ strncmp ("hello, world", "hello, stupid world!!!", 5)
|
|||||||
This is an obsolete alias for @code{memcmp}, derived from BSD.
|
This is an obsolete alias for @code{memcmp}, derived from BSD.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Collation Functions, Search Functions, String/Array Comparison, String and Array Utilities
|
@node Collation Functions
|
||||||
@section Collation Functions
|
@section Collation Functions
|
||||||
|
|
||||||
@cindex collating strings
|
@cindex collating strings
|
||||||
@ -792,9 +793,9 @@ sort_strings_fast (char **array, int nstrings)
|
|||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@strong{Compatibility Note:} The string collation functions are a new
|
@strong{Compatibility Note:} The string collation functions are a new
|
||||||
feature of @w{ISO C}. Older C dialects have no equivalent feature.
|
feature of @w{ISO C 89}. Older C dialects have no equivalent feature.
|
||||||
|
|
||||||
@node Search Functions, Finding Tokens in a String, Collation Functions, String and Array Utilities
|
@node Search Functions
|
||||||
@section Search Functions
|
@section Search Functions
|
||||||
|
|
||||||
This section describes library functions which perform various kinds
|
This section describes library functions which perform various kinds
|
||||||
@ -940,7 +941,7 @@ strpbrk ("hello, world", " \t\n,.;!?")
|
|||||||
@c @end group
|
@c @end group
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Finding Tokens in a String, , Search Functions, String and Array Utilities
|
@node Finding Tokens in a String
|
||||||
@section Finding Tokens in a String
|
@section Finding Tokens in a String
|
||||||
|
|
||||||
@cindex tokenizing strings
|
@cindex tokenizing strings
|
||||||
@ -1087,3 +1088,65 @@ token = strsep (&running, delimiters); /* token => "and" */
|
|||||||
token = strsep (&running, delimiters); /* token => "punctuation" */
|
token = strsep (&running, delimiters); /* token => "punctuation" */
|
||||||
token = strsep (&running, delimiters); /* token => NULL */
|
token = strsep (&running, delimiters); /* token => NULL */
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
@node Encode Binary Data
|
||||||
|
@section Encode Binary Data
|
||||||
|
|
||||||
|
To store or transfer binary data in environments which only support text
|
||||||
|
one has to encode the binary data by mapping the input bytes to
|
||||||
|
characters in the range allowed for storing or transfering. SVID
|
||||||
|
systems (and nowadays XPG compliant systems) have such a function in the
|
||||||
|
C library.
|
||||||
|
|
||||||
|
@comment stdlib.h
|
||||||
|
@comment XPG
|
||||||
|
@deftypefun {char *} l64a (long int @var{n})
|
||||||
|
This function encodes an input value with 32 bits using characters from
|
||||||
|
the basic character set. Groups of 6 bits are encoded using the
|
||||||
|
following table:
|
||||||
|
|
||||||
|
@multitable {xxxxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx}
|
||||||
|
@item @tab 0 @tab 1 @tab 2 @tab 3 @tab 4 @tab 5 @tab 6 @tab 7
|
||||||
|
@item 0 @tab @code{.} @tab @code{/} @tab @code{0} @tab @code{1}
|
||||||
|
@tab @code{2} @tab @code{3} @tab @code{4} @tab @code{5}
|
||||||
|
@item 8 @tab @code{6} @tab @code{7} @tab @code{8} @tab @code{9}
|
||||||
|
@tab @code{A} @tab @code{B} @tab @code{C} @tab @code{D}
|
||||||
|
@item 16 @tab @code{E} @tab @code{F} @tab @code{G} @tab @code{H}
|
||||||
|
@tab @code{I} @tab @code{J} @tab @code{K} @tab @code{L}
|
||||||
|
@item 24 @tab @code{M} @tab @code{N} @tab @code{O} @tab @code{P}
|
||||||
|
@tab @code{Q} @tab @code{R} @tab @code{S} @tab @code{T}
|
||||||
|
@item 32 @tab @code{U} @tab @code{V} @tab @code{W} @tab @code{X}
|
||||||
|
@tab @code{Y} @tab @code{Z} @tab @code{a} @tab @code{b}
|
||||||
|
@item 40 @tab @code{c} @tab @code{d} @tab @code{e} @tab @code{f}
|
||||||
|
@tab @code{g} @tab @code{h} @tab @code{i} @tab @code{j}
|
||||||
|
@item 48 @tab @code{k} @tab @code{l} @tab @code{m} @tab @code{n}
|
||||||
|
@tab @code{o} @tab @code{p} @tab @code{q} @tab @code{r}
|
||||||
|
@item 56 @tab @code{s} @tab @code{t} @tab @code{u} @tab @code{v}
|
||||||
|
@tab @code{w} @tab @code{x} @tab @code{y} @tab @code{z}
|
||||||
|
@end multitable
|
||||||
|
|
||||||
|
The function returns a pointer to a static buffer which contains the
|
||||||
|
string representing of the encoding of @var{n}. To encoded a series of
|
||||||
|
bytes the use should append the new string to the destination buffer.
|
||||||
|
@emph{Warning:} Since a static buffer is used this function should not
|
||||||
|
be used in multi-threaded programs. There is no thread-safe alternatice
|
||||||
|
to this function in the C library.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
To decode data produced with @code{l64a} the following function should be
|
||||||
|
used.
|
||||||
|
|
||||||
|
@deftypefun {long int} a64l (const char *@var{string})
|
||||||
|
The parameter @var{string} should contain a string which was produced by
|
||||||
|
a call to @code{l64a}. The function processes the next 6 characters and
|
||||||
|
decodes the characters it finds according to the table above.
|
||||||
|
Characters not in the conversion table are simply ignored. This is
|
||||||
|
useful for breaking the information in lines in which case the end of
|
||||||
|
line characters are simply ignored.
|
||||||
|
|
||||||
|
The decoded number is returned at the end as a @code{long int} value.
|
||||||
|
Consecutive calls to this function are possible but the caller must make
|
||||||
|
sure the buffer pointer is update after each call to @code{a64l} since
|
||||||
|
this function does not modify the buffer pointer. Every call consumes 6
|
||||||
|
characters.
|
||||||
|
@end deftypefun
|
||||||
|
@ -23,7 +23,7 @@ subdir := math
|
|||||||
# Installed header files.
|
# Installed header files.
|
||||||
headers := math.h mathcalls.h __math.h huge_val.h nan.h \
|
headers := math.h mathcalls.h __math.h huge_val.h nan.h \
|
||||||
fpu_control.h complex.h cmathcalls.h fenv.h \
|
fpu_control.h complex.h cmathcalls.h fenv.h \
|
||||||
fenvbits.h
|
fenvbits.h mathbits.h
|
||||||
|
|
||||||
# Internal header files.
|
# Internal header files.
|
||||||
distribute := math_private.h machine/asm.h machine/endian.h
|
distribute := math_private.h machine/asm.h machine/endian.h
|
||||||
|
@ -100,7 +100,7 @@ __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
|
|||||||
__MATHCALL (csqrt, (_Mdouble_complex_ __z));
|
__MATHCALL (csqrt, (_Mdouble_complex_ __z));
|
||||||
|
|
||||||
|
|
||||||
/* Absolute value, projections, conjugates, and projection. */
|
/* Absolute value, conjugates, and projection. */
|
||||||
|
|
||||||
/* Absolute value of Z. */
|
/* Absolute value of Z. */
|
||||||
__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
|
__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
|
||||||
|
@ -27,7 +27,11 @@ if test -d $1; then
|
|||||||
to=`cd $1 && /bin/pwd`
|
to=`cd $1 && /bin/pwd`
|
||||||
else
|
else
|
||||||
temp=`echo $1 | sed 's%/*[^/]*$%%'`
|
temp=`echo $1 | sed 's%/*[^/]*$%%'`
|
||||||
to=`cd $temp && /bin/pwd`
|
if test -z "$temp"; then
|
||||||
|
to=`/bin/pwd`
|
||||||
|
else
|
||||||
|
to=`cd $temp && /bin/pwd`
|
||||||
|
fi
|
||||||
to="$to/`echo $1 | sed 's%.*/\([^/][^/]*\)$%\1%'`"
|
to="$to/`echo $1 | sed 's%.*/\([^/][^/]*\)$%\1%'`"
|
||||||
fi
|
fi
|
||||||
to=`echo $to | sed 's%^/%%'`
|
to=`echo $to | sed 's%^/%%'`
|
||||||
|
@ -42,7 +42,10 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
|
|||||||
{
|
{
|
||||||
p = fgets (buffer, buflen, stream);
|
p = fgets (buffer, buflen, stream);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return errno;
|
{
|
||||||
|
*result = NULL;
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
/* Skip leading blanks. */
|
/* Skip leading blanks. */
|
||||||
while (isspace (*p))
|
while (isspace (*p))
|
||||||
|
@ -42,7 +42,7 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
|
|||||||
temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
|
temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
|
||||||
xbug errnobug \
|
xbug errnobug \
|
||||||
bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \
|
bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \
|
||||||
tfformat tiformat tstdiomisc \
|
tfformat tiformat tstdiomisc tst-printfsz \
|
||||||
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10
|
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10
|
||||||
|
|
||||||
|
|
||||||
@ -54,6 +54,7 @@ CFLAGS-tst-printf.c = -Wno-format
|
|||||||
CFLAGS-tstdiomisc.c = -Wno-format
|
CFLAGS-tstdiomisc.c = -Wno-format
|
||||||
CFLAGS-scanf4.c = -Wno-format
|
CFLAGS-scanf4.c = -Wno-format
|
||||||
CFLAGS-scanf7.c = -Wno-format
|
CFLAGS-scanf7.c = -Wno-format
|
||||||
|
CFLAGS-tst-printfsz.c = -Wno-format
|
||||||
|
|
||||||
ifeq ($(stdio),libio)
|
ifeq ($(stdio),libio)
|
||||||
ifneq (,$(filter %REENTRANT, $(defines)))
|
ifneq (,$(filter %REENTRANT, $(defines)))
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
long
|
long int
|
||||||
a64l (string)
|
a64l (string)
|
||||||
const char *string;
|
const char *string;
|
||||||
{
|
{
|
||||||
int cnt;
|
size_t cnt;
|
||||||
long result = 0l;
|
long int result = 0l;
|
||||||
|
|
||||||
for (cnt = 0; cnt < 6; ++cnt)
|
for (cnt = 0; cnt < 6; ++cnt)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,25 @@ seed48_r (seed16v, buffer)
|
|||||||
memcpy (buffer->old_X, buffer->X, sizeof (buffer->X));
|
memcpy (buffer->old_X, buffer->X, sizeof (buffer->X));
|
||||||
|
|
||||||
/* Install new state. */
|
/* Install new state. */
|
||||||
memcpy (buffer->X, seed16v, sizeof (buffer->X));
|
#if USHRT_MAX == 0xffffU
|
||||||
|
buffer->X[2] = seed16v[2];
|
||||||
|
buffer->X[1] = seed16v[1];
|
||||||
|
buffer->X[0] = seed16v[0];
|
||||||
|
|
||||||
|
buffer->a[2] = 0x5;
|
||||||
|
buffer->a[1] = 0xdeec;
|
||||||
|
buffer->a[0] = 0xe66d;
|
||||||
|
#else
|
||||||
|
buffer->X[2] = (seed16v[2] << 16) | seed16v[1];
|
||||||
|
buffer->X[1] = seed16v[0] << 16;
|
||||||
|
buffer->X[0] = 0;
|
||||||
|
|
||||||
|
buffer->a[2] = 0x5deecUL;
|
||||||
|
buffer->a[1] = 0xe66d0000UL;
|
||||||
|
buffer->a[0] = 0;
|
||||||
|
#endif
|
||||||
|
buffer->c = 0xb;
|
||||||
|
buffer->init = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,22 +22,32 @@
|
|||||||
|
|
||||||
int
|
int
|
||||||
srand48_r (seedval, buffer)
|
srand48_r (seedval, buffer)
|
||||||
long seedval;
|
long int seedval;
|
||||||
struct drand48_data *buffer;
|
struct drand48_data *buffer;
|
||||||
{
|
{
|
||||||
/* The standards say we only have 32 bits. */
|
/* The standards say we only have 32 bits. */
|
||||||
if (sizeof (long) > 4)
|
if (sizeof (long int) > 4)
|
||||||
seedval &= 0xffffffffl;
|
seedval &= 0xffffffffl;
|
||||||
|
|
||||||
#if (USHRT_MAX == 0xffffU)
|
#if USHRT_MAX == 0xffffU
|
||||||
buffer->X[2] = seedval >> 16;
|
buffer->X[2] = seedval >> 16;
|
||||||
buffer->X[1] = seedval & 0xffffl;
|
buffer->X[1] = seedval & 0xffffl;
|
||||||
buffer->X[0] = 0x330e;
|
buffer->X[0] = 0x330e;
|
||||||
|
|
||||||
|
buffer->a[2] = 0x5;
|
||||||
|
buffer->a[1] = 0xdeec;
|
||||||
|
buffer->a[0] = 0xe66d;
|
||||||
#else
|
#else
|
||||||
buffer->X[2] = seedval;
|
buffer->X[2] = seedval;
|
||||||
buffer->X[1] = 0x330e0000UL;
|
buffer->X[1] = 0x330e0000UL;
|
||||||
buffer->X[0] = 0;
|
buffer->X[0] = 0;
|
||||||
|
|
||||||
|
buffer->a[2] = 0x5deecUL;
|
||||||
|
buffer->a[1] = 0xe66d0000UL;
|
||||||
|
buffer->a[0] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
buffer->c = 0xb;
|
||||||
|
buffer->init = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -310,15 +310,15 @@ extern double drand48 __P ((void));
|
|||||||
extern double erand48 __P ((unsigned short int __xsubi[3]));
|
extern double erand48 __P ((unsigned short int __xsubi[3]));
|
||||||
|
|
||||||
/* Return non-negative, long integer in [0,2^31). */
|
/* Return non-negative, long integer in [0,2^31). */
|
||||||
extern long lrand48 __P ((void));
|
extern long int lrand48 __P ((void));
|
||||||
extern long nrand48 __P ((unsigned short int __xsubi[3]));
|
extern long int nrand48 __P ((unsigned short int __xsubi[3]));
|
||||||
|
|
||||||
/* Return signed, long integers in [-2^31,2^31). */
|
/* Return signed, long integers in [-2^31,2^31). */
|
||||||
extern long mrand48 __P ((void));
|
extern long int mrand48 __P ((void));
|
||||||
extern long jrand48 __P ((unsigned short int __xsubi[3]));
|
extern long int jrand48 __P ((unsigned short int __xsubi[3]));
|
||||||
|
|
||||||
/* Seed random number generator. */
|
/* Seed random number generator. */
|
||||||
extern void srand48 __P ((long __seedval));
|
extern void srand48 __P ((long int __seedval));
|
||||||
extern unsigned short int *seed48 __P ((unsigned short int __seed16v[3]));
|
extern unsigned short int *seed48 __P ((unsigned short int __seed16v[3]));
|
||||||
extern void lcong48 __P ((unsigned short int __param[7]));
|
extern void lcong48 __P ((unsigned short int __param[7]));
|
||||||
|
|
||||||
@ -339,17 +339,17 @@ extern int erand48_r __P ((unsigned short int __xsubi[3],
|
|||||||
struct drand48_data *__buffer, double *__result));
|
struct drand48_data *__buffer, double *__result));
|
||||||
|
|
||||||
/* Return non-negative, long integer in [0,2^31). */
|
/* Return non-negative, long integer in [0,2^31). */
|
||||||
extern int lrand48_r __P ((struct drand48_data *__buffer, long *__result));
|
extern int lrand48_r __P ((struct drand48_data *__buffer, long int *__result));
|
||||||
extern int nrand48_r __P ((unsigned short int __xsubi[3],
|
extern int nrand48_r __P ((unsigned short int __xsubi[3],
|
||||||
struct drand48_data *__buffer, long *__result));
|
struct drand48_data *__buffer, long int *__result));
|
||||||
|
|
||||||
/* Return signed, long integers in [-2^31,2^31). */
|
/* Return signed, long integers in [-2^31,2^31). */
|
||||||
extern int mrand48_r __P ((struct drand48_data *__buffer, long *__result));
|
extern int mrand48_r __P ((struct drand48_data *__buffer, long int *__result));
|
||||||
extern int jrand48_r __P ((unsigned short int __xsubi[3],
|
extern int jrand48_r __P ((unsigned short int __xsubi[3],
|
||||||
struct drand48_data *__buffer, long *__result));
|
struct drand48_data *__buffer, long int *__result));
|
||||||
|
|
||||||
/* Seed random number generator. */
|
/* Seed random number generator. */
|
||||||
extern int srand48_r __P ((long __seedval, struct drand48_data *__buffer));
|
extern int srand48_r __P ((long int __seedval, struct drand48_data *__buffer));
|
||||||
extern int seed48_r __P ((unsigned short int __seed16v[3],
|
extern int seed48_r __P ((unsigned short int __seed16v[3],
|
||||||
struct drand48_data *__buffer));
|
struct drand48_data *__buffer));
|
||||||
extern int lcong48_r __P ((unsigned short int __param[7],
|
extern int lcong48_r __P ((unsigned short int __param[7],
|
||||||
|
@ -470,7 +470,7 @@ __finite (double __x)
|
|||||||
|
|
||||||
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
||||||
ix87 FPU supports this with special opcodes and we should use them.
|
ix87 FPU supports this with special opcodes and we should use them.
|
||||||
This must not be inline functions since we have to be able to handle
|
These must not be inline functions since we have to be able to handle
|
||||||
all floating-point types. */
|
all floating-point types. */
|
||||||
#undef isgreater
|
#undef isgreater
|
||||||
#define isgreater(x, y) \
|
#define isgreater(x, y) \
|
||||||
|
@ -40,16 +40,16 @@ static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $";
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _SCALB_INT
|
#ifdef _SCALB_INT
|
||||||
return scalbn(x,fn);
|
return __scalbn(x,fn);
|
||||||
#else
|
#else
|
||||||
if (isnan(x)||isnan(fn)) return x*fn;
|
if (__isnan(x)||__isnan(fn)) return x*fn;
|
||||||
if (!finite(fn)) {
|
if (!__finite(fn)) {
|
||||||
if(fn>0.0) return x*fn;
|
if(fn>0.0) return x*fn;
|
||||||
else return x/(-fn);
|
else return x/(-fn);
|
||||||
}
|
}
|
||||||
if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
|
if (__rint(fn)!=fn) return (fn-fn)/(fn-fn);
|
||||||
if ( fn > 65000.0) return scalbn(x, 65000);
|
if ( fn > 65000.0) return __scalbn(x, 65000);
|
||||||
if (-fn > 65000.0) return scalbn(x,-65000);
|
if (-fn > 65000.0) return __scalbn(x,-65000);
|
||||||
return scalbn(x,(int)fn);
|
return __scalbn(x,(int)fn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -44,16 +44,16 @@ static char rcsid[] = "$NetBSD: $";
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _SCALB_INT
|
#ifdef _SCALB_INT
|
||||||
return scalbnl(x,fn);
|
return __scalbnl(x,fn);
|
||||||
#else
|
#else
|
||||||
if (isnanl(x)||isnanl(fn)) return x*fn;
|
if (__isnanl(x)||__isnanl(fn)) return x*fn;
|
||||||
if (!finitel(fn)) {
|
if (!__finitel(fn)) {
|
||||||
if(fn>0.0) return x*fn;
|
if(fn>0.0) return x*fn;
|
||||||
else return x/(-fn);
|
else return x/(-fn);
|
||||||
}
|
}
|
||||||
if (rintl(fn)!=fn) return (fn-fn)/(fn-fn);
|
if (__rintl(fn)!=fn) return (fn-fn)/(fn-fn);
|
||||||
if ( fn > 65000.0) return scalbnl(x, 65000);
|
if ( fn > 65000.0) return __scalbnl(x, 65000);
|
||||||
if (-fn > 65000.0) return scalbnl(x,-65000);
|
if (-fn > 65000.0) return __scalbnl(x,-65000);
|
||||||
return scalbnl(x,(int)fn);
|
return __scalbnl(x,(int)fn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ __ctan (__complex__ double x)
|
|||||||
{
|
{
|
||||||
__complex__ double res;
|
__complex__ double res;
|
||||||
|
|
||||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
if (!isfinite (__real__ x) || !isfinite (__imag__ x))
|
||||||
{
|
{
|
||||||
if (__isinf (__imag__ x))
|
if (__isinf (__imag__ x))
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ __ctanf (__complex__ float x)
|
|||||||
{
|
{
|
||||||
__complex__ float res;
|
__complex__ float res;
|
||||||
|
|
||||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
if (!isfinite (__real__ x) || !isfinite (__imag__ x))
|
||||||
{
|
{
|
||||||
if (__isinff (__imag__ x))
|
if (__isinff (__imag__ x))
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ __ctanh (__complex__ double x)
|
|||||||
{
|
{
|
||||||
__complex__ double res;
|
__complex__ double res;
|
||||||
|
|
||||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
if (!isfinite (__real__ x) || !isfinite (__imag__ x))
|
||||||
{
|
{
|
||||||
if (__isinf (__real__ x))
|
if (__isinf (__real__ x))
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ __ctanhf (__complex__ float x)
|
|||||||
{
|
{
|
||||||
__complex__ float res;
|
__complex__ float res;
|
||||||
|
|
||||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
if (!isfinite (__real__ x) || !isfinite (__imag__ x))
|
||||||
{
|
{
|
||||||
if (__isinff (__real__ x))
|
if (__isinff (__real__ x))
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ __ctanhl (__complex__ long double x)
|
|||||||
{
|
{
|
||||||
__complex__ long double res;
|
__complex__ long double res;
|
||||||
|
|
||||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
if (!isfinite (__real__ x) || !isfinite (__imag__ x))
|
||||||
{
|
{
|
||||||
if (__isinfl (__real__ x))
|
if (__isinfl (__real__ x))
|
||||||
{
|
{
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
__complex__ long double
|
__complex__ long double
|
||||||
__ctanl (__complex__ long double x)
|
__ctanl (__complex__ long double x)
|
||||||
{
|
{
|
||||||
__complex__ double res;
|
__complex__ long double res;
|
||||||
|
|
||||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
if (!isfinite (__real__ x) || !isfinite (__imag__ x))
|
||||||
{
|
{
|
||||||
if (__isinfl (__imag__ x))
|
if (__isinfl (__imag__ x))
|
||||||
{
|
{
|
||||||
|
@ -14,9 +14,6 @@
|
|||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBM_SCCS) && !defined(lint)
|
|
||||||
static char rcsid[] = "$NetBSD: s_rintf.c,v 1.4 1995/05/10 20:48:06 jtc Exp $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
@ -33,9 +30,9 @@ TWO23[2]={
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
float __rintf(float x)
|
float __nearbyintf(float x)
|
||||||
#else
|
#else
|
||||||
float __rintf(x)
|
float __nearbyintf(x)
|
||||||
float x;
|
float x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -77,4 +74,4 @@ TWO23[2]={
|
|||||||
fesetenv (&env);
|
fesetenv (&env);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
weak_alias (__rintf, rintf)
|
weak_alias (__nearbyintf, nearbyintf)
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBM_SCCS) && !defined(lint)
|
|
||||||
static char rcsid[] = "$NetBSD: $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rintl(x)
|
* rintl(x)
|
||||||
* Return x rounded to integral value according to the prevailing
|
* Return x rounded to integral value according to the prevailing
|
||||||
@ -44,9 +40,9 @@ TWO63[2]={
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
long double __rintl(long double x)
|
long double __nearbyintl(long double x)
|
||||||
#else
|
#else
|
||||||
long double __rintl(x)
|
long double __nearbyintl(x)
|
||||||
long double x;
|
long double x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -101,4 +97,4 @@ TWO63[2]={
|
|||||||
fesetenv (&env);
|
fesetenv (&env);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
weak_alias (__rintl, rintl)
|
weak_alias (__nearbyintl, nearbyintl)
|
||||||
|
@ -274,6 +274,14 @@ __m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \
|
|||||||
__asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
|
__asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
|
||||||
: "dmi" (__ctrl_reg)); \
|
: "dmi" (__ctrl_reg)); \
|
||||||
return __result; \
|
return __result; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
__m81_inline void \
|
||||||
|
__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \
|
||||||
|
float_type *__cosx) \
|
||||||
|
{ \
|
||||||
|
__asm ("fsincos%.x %2,%1:%0" \
|
||||||
|
: "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This defines the three variants of the inline functions. */
|
/* This defines the three variants of the inline functions. */
|
||||||
@ -324,6 +332,10 @@ __inline_forward_c(int,ilogb, (double __value), (__value))
|
|||||||
#ifdef __USE_ISOC9X
|
#ifdef __USE_ISOC9X
|
||||||
__inline_forward_c(double,nearbyint, (double __value), (__value))
|
__inline_forward_c(double,nearbyint, (double __value), (__value))
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
__inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx),
|
||||||
|
(__x, __sinx, __cosx))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined __USE_MISC || defined __USE_ISOC9X
|
#if defined __USE_MISC || defined __USE_ISOC9X
|
||||||
|
|
||||||
@ -341,6 +353,10 @@ __inline_forward_c(int,ilogbf, (float __value), (__value))
|
|||||||
#ifdef __USE_ISOC9X
|
#ifdef __USE_ISOC9X
|
||||||
__inline_forward_c(float,nearbyintf, (float __value), (__value))
|
__inline_forward_c(float,nearbyintf, (float __value), (__value))
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
__inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx),
|
||||||
|
(__x, __sinx, __cosx))
|
||||||
|
#endif
|
||||||
|
|
||||||
__inline_forward(long double,frexpl, (long double __value, int *__expptr),
|
__inline_forward(long double,frexpl, (long double __value, int *__expptr),
|
||||||
(__value, __expptr))
|
(__value, __expptr))
|
||||||
@ -358,12 +374,72 @@ __inline_forward_c(int,ilogbl, (long double __value), (__value))
|
|||||||
__inline_forward_c(long double,nearbyintl, (long double __value), (__value))
|
__inline_forward_c(long double,nearbyintl, (long double __value), (__value))
|
||||||
__inline_forward_c(long int,rinttol, (long double __value), (__value))
|
__inline_forward_c(long int,rinttol, (long double __value), (__value))
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
__inline_forward(void,sincosl,
|
||||||
|
(long double __x, long double *__sinx, long double *__cosx),
|
||||||
|
(__x, __sinx, __cosx))
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* Use misc or ISO C9X */
|
#endif /* Use misc or ISO C9X */
|
||||||
|
|
||||||
#undef __inline_forward
|
#undef __inline_forward
|
||||||
#undef __inline_forward_c
|
#undef __inline_forward_c
|
||||||
|
|
||||||
|
#ifdef __USE_ISOC9X
|
||||||
|
|
||||||
|
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
||||||
|
m68k FPU supports this with special opcodes and we should use them.
|
||||||
|
These must not be inline functions since we have to be able to handle
|
||||||
|
all floating-point types. */
|
||||||
|
#undef isgreater
|
||||||
|
#define isgreater(x, y) \
|
||||||
|
__extension__ \
|
||||||
|
({ char __result; \
|
||||||
|
__asm__ ("fcmp %2,%1; fsogt %0" \
|
||||||
|
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||||
|
(int) __result; })
|
||||||
|
|
||||||
|
#undef isgreaterequal
|
||||||
|
#define isgreaterequal(x, y) \
|
||||||
|
__extension__ \
|
||||||
|
({ char __result; \
|
||||||
|
__asm__ ("fcmp %2,%1; fsoge %0" \
|
||||||
|
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||||
|
(int) __result; })
|
||||||
|
|
||||||
|
#undef isless
|
||||||
|
#define isless(x, y) \
|
||||||
|
__extension__ \
|
||||||
|
({ char __result; \
|
||||||
|
__asm__ ("fcmp %2,%1; fsolt %0" \
|
||||||
|
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||||
|
(int) __result; })
|
||||||
|
|
||||||
|
#undef islessequal
|
||||||
|
#define islessequal(x, y) \
|
||||||
|
__extension__ \
|
||||||
|
({ char __result; \
|
||||||
|
__asm__ ("fcmp %2,%1; fsole %0" \
|
||||||
|
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||||
|
(int) __result; })
|
||||||
|
|
||||||
|
#undef islessgreater
|
||||||
|
#define islessgreater(x, y) \
|
||||||
|
__extension__ \
|
||||||
|
({ char __result; \
|
||||||
|
__asm__ ("fcmp %2,%1; fsogl %0" \
|
||||||
|
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||||
|
(int) __result; })
|
||||||
|
|
||||||
|
#undef isunordered
|
||||||
|
#define isunordered(x, y) \
|
||||||
|
__extension__ \
|
||||||
|
({ char __result; \
|
||||||
|
__asm__ ("fcmp %2,%1; fsun %0" \
|
||||||
|
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||||
|
(int) __result; })
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
|
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
|
||||||
|
|
||||||
#endif /* GCC. */
|
#endif /* GCC. */
|
||||||
|
@ -80,51 +80,36 @@ s(__ieee754_pow) (float_type x, float_type y)
|
|||||||
z = 1 / z;
|
z = 1 / z;
|
||||||
if (m81(__signbit) (x))
|
if (m81(__signbit) (x))
|
||||||
{
|
{
|
||||||
float_type temp = m81(__rint) (y);
|
if (y != m81(__rint) (y))
|
||||||
if (y != temp)
|
|
||||||
{
|
{
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
z = 0.0/0.0;
|
z = 0.0/0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
goto maybe_negate;
|
||||||
if (sizeof (float_type) == sizeof (float))
|
|
||||||
{
|
|
||||||
long i = (long) y;
|
|
||||||
if (i & 1)
|
|
||||||
z = -z;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
long long i = (long long) y;
|
|
||||||
if ((float_type) i == y && i & 1)
|
|
||||||
z = -z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x < 0.0)
|
if (x < 0.0)
|
||||||
{
|
{
|
||||||
float_type temp = m81(__rint) (y);
|
if (y == m81(__rint) (y))
|
||||||
if (y == temp)
|
|
||||||
{
|
{
|
||||||
long long i = (long long) y;
|
|
||||||
z = m81(__ieee754_exp) (y * m81(__ieee754_log) (-x));
|
z = m81(__ieee754_exp) (y * m81(__ieee754_log) (-x));
|
||||||
if (sizeof (float_type) == sizeof (float))
|
maybe_negate:
|
||||||
{
|
/* We always use the long double format, since y is already in
|
||||||
long i = (long) y;
|
this format and rounding won't change the result. */
|
||||||
if (i & 1)
|
{
|
||||||
z = -z;
|
int32_t exponent;
|
||||||
}
|
u_int32_t i0, i1;
|
||||||
else
|
GET_LDOUBLE_WORDS (exponent, i0, i1, y);
|
||||||
{
|
exponent = (exponent & 0x7fff) - 0x3fff;
|
||||||
/* If the conversion to long long was inexact assume that y
|
if (exponent <= 31
|
||||||
is an even integer. */
|
? i0 & (1 << (31 - exponent))
|
||||||
if ((float_type) i == y && i & 1)
|
: (exponent <= 63
|
||||||
z = -z;
|
&& i1 & (1 << (63 - exponent))))
|
||||||
}
|
z = -z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
z = 0.0/0.0;
|
z = 0.0/0.0;
|
||||||
|
39
sysdeps/m68k/fpu/s_sincos.c
Normal file
39
sysdeps/m68k/fpu/s_sincos.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#define __LIBC_M81_MATH_INLINES
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#ifndef FUNC
|
||||||
|
#define FUNC sincos
|
||||||
|
#endif
|
||||||
|
#ifndef float_type
|
||||||
|
#define float_type double
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONCATX(a,b) __CONCAT(a,b)
|
||||||
|
|
||||||
|
void
|
||||||
|
CONCATX(__,FUNC) (x, sinx, cosx)
|
||||||
|
float_type x, *sinx, *cosx;
|
||||||
|
{
|
||||||
|
__m81_u(CONCATX(__,FUNC))(x, sinx, cosx);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define weak_aliasx(a,b) weak_alias(a,b)
|
||||||
|
weak_aliasx (CONCATX(__,FUNC), FUNC)
|
3
sysdeps/m68k/fpu/s_sincosf.c
Normal file
3
sysdeps/m68k/fpu/s_sincosf.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#define FUNC sincosf
|
||||||
|
#define float_type float
|
||||||
|
#include <s_sincos.c>
|
3
sysdeps/m68k/fpu/s_sincosl.c
Normal file
3
sysdeps/m68k/fpu/s_sincosl.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#define FUNC sincosl
|
||||||
|
#define float_type long double
|
||||||
|
#include <s_sincos.c>
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -24,14 +24,14 @@ Boston, MA 02111-1307, USA. */
|
|||||||
segment of the calling process. SHMADDR and SHMFLG determine how
|
segment of the calling process. SHMADDR and SHMFLG determine how
|
||||||
and where the segment is attached. */
|
and where the segment is attached. */
|
||||||
|
|
||||||
char *
|
void *
|
||||||
shmat (shmid, shmaddr, shmflg)
|
shmat (shmid, shmaddr, shmflg)
|
||||||
int shmid;
|
int shmid;
|
||||||
char *shmaddr;
|
const void *shmaddr;
|
||||||
int shmflg;
|
int shmflg;
|
||||||
{
|
{
|
||||||
__set_errno (ENOSYS);
|
__set_errno (ENOSYS);
|
||||||
return (char *) -1;
|
return (void *) -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stub_warning (shmat)
|
stub_warning (shmat)
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */
|
|||||||
|
|
||||||
int
|
int
|
||||||
shmdt (shmaddr)
|
shmdt (shmaddr)
|
||||||
char *shmaddr;
|
const void *shmaddr;
|
||||||
{
|
{
|
||||||
__set_errno (ENOSYS);
|
__set_errno (ENOSYS);
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user