[BACK]Return to tgmath.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man3

File: [cvs.NetBSD.org] / src / share / man / man3 / tgmath.3 (download)

Revision 1.9, Tue Mar 18 18:20:39 2014 UTC (10 years, 1 month ago) by riastradh
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, HEAD
Changes since 1.8: +1 -1 lines

Merge riastradh-drm2 to HEAD.

.\" $NetBSD: tgmath.3,v 1.9 2014/03/18 18:20:39 riastradh Exp $
.\"
.\" Copyright (c) 2004 Stefan Farfeleder
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man3/tgmath.3,v 1.3 2007/12/15 02:40:10 das Exp $
.\"
.Dd December 14, 2010
.Dt TGMATH 3
.Os
.Sh NAME
.Nm tgmath
.Nd "type-generic macros"
.Sh SYNOPSIS
.In tgmath.h
.Sh DESCRIPTION
The header
.In tgmath.h
provides type-generic macros
for
.In math.h
and
.In complex.h
functions that have
.Vt float
(suffixed with
.Sy f ) ,
.Vt double ,
and
.Vt "long double"
(suffixed with
.Sy l )
versions.
The arguments that vary across the three functions and have type
.Vt float , double ,
and
.Vt "long double" ,
respectively, are called
.Em "generic arguments" .
.Pp
The following rules describe which function is actually called if a
type-generic macro is invoked.
If any generic argument has type
.Vt "long double"
or
.Vt "long double complex" ,
the
.Vt "long double"
function is called.
Else, if any generic argument has type
.Vt double , "double complex" ,
or an integer type, the
.Vt double
version is invoked.
Otherwise, the macro expands to the
.Vt float
implementation.
.Pp
For the macros in the following table, both real and complex functions
exist.
The real functions are prototyped in
.In math.h
and the complex equivalents in
.In complex.h .
The complex function is called if any of the generic arguments is a
complex value.
Otherwise, the real equivalent is called.
.Bl -column -offset indent \
"COMPLEX FUNCTION" "COMPLEX FUNCTION" "COMPLEX FUNCTION"
.It Sy Macro Ta Sy Real function Ta Sy Complex function
.It Fn acos Ta Xr acos 3 Ta Xr cacos 3
.It Fn asin Ta Xr asin 3 Ta Xr casin 3
.It Fn atan Ta Xr atan 3 Ta Xr catan 3
.It Fn acosh Ta Xr acosh 3 Ta Xr cacosh 3
.It Fn asinh Ta Xr asinh 3 Ta Xr casinh 3
.It Fn atanh Ta Xr atanh 3 Ta Xr catanh 3
.It Fn cos Ta Xr cos 3 Ta Xr ccos 3
.It Fn sin Ta Xr sin 3 Ta Xr csin 3
.It Fn tan  Ta Xr tan 3 Ta Xr ctan 3
.It Fn cosh Ta Xr cosh 3 Ta Xr ccosh 3
.It Fn sinh Ta Xr sinh 3 Ta Xr csinh 3
.It Fn tanh Ta Xr tanh 3 Ta Xr ctanh 3
.It Fn exp Ta Xr exp 3 Ta Xr cexp 3
.It Fn log Ta Xr log 3 Ta Xr clog 3
.It Fn pow Ta Xr pow 3 Ta Xr cpow 3
.It Fn sqrt Ta Xr sqrt 3 Ta Xr csqrt 3
.It Fn fabs Ta Xr fabs 3 Ta Xr cabs 3
.El
.Pp
No complex functions exist for the following macros, so passing a
complex value to a generic argument invokes undefined behaviour:
.Bl -column -offset indent ".Fn nexttoward" ".Fn nexttoward" ".Fn nexttoward"
.It Xr atan2 3 Ta Fn fma Ta Fn llround Ta Xr remainder 3
.It Xr cbrt 3 Ta Xr fmax 3 Ta Xr log10 3 Ta Fn remquo
.It Xr ceil 3 Ta Xr fmin 3 Ta Xr log1p 3 Ta Xr rint 3
.It Xr copysign 3 Ta Xr fmod 3 Ta Xr log2 3 Ta Xr round 3
.It Xr erf 3 Ta Xr frexp 3 Ta Xr logb 3 Ta Xr scalbn 3
.It Xr erfc 3 Ta Xr hypot 3 Ta Xr lrint 3 Ta Fn tgamma
.It Xr exp2 3 Ta Xr ilogb 3 Ta Fn lround Ta Xr trunc 3
.It Xr expm1 3 Ta Xr ldexp 3 Ta Xr nextafter 3
.It Xr fdim 3 Ta Xr lgamma 3 Ta
.It Xr floor 3 Ta Xr llrint 3 Ta
.El
.Pp
The following macros always expand to a complex function:
.Bl -column -offset indent ".Fn cimag" ".Fn cimag" ".Fn cimag" ".Fn cimag" ".Fn cimag"
.It Xr carg 3 Ta Xr cimag 3 Ta Xr conj 3 Ta Fn cproj Ta Xr creal 3
.El
.Pp
This header includes
.In complex.h
and
.In math.h .
.Sh STANDARDS
The header
.In tgmath.h
conforms to
.St -isoC-99 .
.Sh AUTHORS
.An Matt Thomas Aq Mt matt@3am-software.com
.Sh BUGS
The header
.In tgmath.h
cannot be implemented with strictly conforming C code and needs
special compiler support.
The current implementation only works for
.Tn GCC .
.Pp
Many of the functions mentioned here are not prototyped in
.In math.h
or
.In complex.h
as they are not yet implemented.