1\input texinfo @c -*-texinfo-*- 2 3@c %**start of header 4@setfilename libquadmath.info 5@settitle GCC libquadmath 6@c %**end of header 7 8@copying 9Copyright @copyright{} 2010-2018 Free Software Foundation, Inc. 10 11@quotation 12Permission is granted to copy, distribute and/or modify this document 13under the terms of the GNU Free Documentation License, Version 1.2 or 14any later version published by the Free Software Foundation; with no 15Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' 16and with the Back-Cover Texts as in (a) below. A copy of the 17license is included in the section entitled ``GNU Free Documentation 18License.'' 19 20(a) The FSF's Back-Cover Text is: ``You have the freedom to 21copy and modify this GNU manual. 22@end quotation 23@end copying 24 25@ifinfo 26@dircategory GNU Libraries 27@direntry 28* libquadmath: (libquadmath). GCC Quad-Precision Math Library 29@end direntry 30 31This manual documents the GCC Quad-Precision Math Library API. 32 33Published by the Free Software Foundation 3451 Franklin Street, Fifth Floor 35Boston, MA 02110-1301 USA 36 37@insertcopying 38@end ifinfo 39 40 41@setchapternewpage odd 42 43@titlepage 44@title The GCC Quad-Precision Math Library 45@page 46@vskip 0pt plus 1filll 47@comment For the @value{version-GCC} Version* 48@sp 1 49Published by the Free Software Foundation @* 5051 Franklin Street, Fifth Floor@* 51Boston, MA 02110-1301, USA@* 52@sp 1 53@insertcopying 54@end titlepage 55 56@summarycontents 57@contents 58@page 59 60 61@node Top 62@top Introduction 63@cindex Introduction 64 65This manual documents the usage of libquadmath, the GCC Quad-Precision 66Math Library Application Programming Interface (API). 67 68 69@comment 70@comment When you add a new menu item, please keep the right hand 71@comment aligned to the same column. Do not use tabs. This provides 72@comment better formatting. 73@comment 74@menu 75* Typedef and constants:: Defined data types and constants 76* Math Library Routines:: The Libquadmath math runtime application 77 programming interface. 78* I/O Library Routines:: The Libquadmath I/O runtime application 79 programming interface. 80* GNU Free Documentation License:: 81 How you can copy and share this manual. 82* Reporting Bugs:: How to report bugs in GCC Libquadmath. 83@c * Index:: Index of this documentation. 84@end menu 85 86 87@c --------------------------------------------------------------------- 88@c Defined macros 89@c --------------------------------------------------------------------- 90 91@node Typedef and constants 92@chapter Typedef and constants 93 94The following data type has been defined via @code{typedef}. 95 96@table @asis 97@item @code{__complex128}: @code{__float128}-based complex number 98@end table 99 100The following macros are defined, which give the numeric limits of the 101@code{__float128} data type. 102 103@table @asis 104@item @code{FLT128_MAX}: largest finite number 105@item @code{FLT128_MIN}: smallest positive number with full precision 106@item @code{FLT128_EPSILON}: difference between 1 and the next larger 107 representable number 108@item @code{FLT128_DENORM_MIN}: smallest positive denormalized number 109@item @code{FLT128_MANT_DIG}: number of digits in the mantissa (bit precision) 110@item @code{FLT128_MIN_EXP}: maximal negative exponent 111@item @code{FLT128_MAX_EXP}: maximal positive exponent 112@item @code{FLT128_DIG}: number of decimal digits in the mantissa 113@item @code{FLT128_MIN_10_EXP}: maximal negative decimal exponent 114@item @code{FLT128_MAX_10_EXP}: maximal positive decimal exponent 115@end table 116 117The following mathematical constants of type @code{__float128} are defined. 118 119@table @asis 120@item @code{M_Eq}: the constant e (Euler's number) 121@item @code{M_LOG2Eq}: binary logarithm of 2 122@item @code{M_LOG10Eq}: common, decimal logarithm of 2 123@item @code{M_LN2q}: natural logarithm of 2 124@item @code{M_LN10q}: natural logarithm of 10 125@item @code{M_PIq}: pi 126@item @code{M_PI_2q}: pi divided by two 127@item @code{M_PI_4q}: pi divided by four 128@item @code{M_1_PIq}: one over pi 129@item @code{M_2_PIq}: one over two pi 130@item @code{M_2_SQRTPIq}: two over square root of pi 131@item @code{M_SQRT2q}: square root of 2 132@item @code{M_SQRT1_2q}: one over square root of 2 133@end table 134 135 136@c --------------------------------------------------------------------- 137@c Math routines 138@c --------------------------------------------------------------------- 139 140@node Math Library Routines 141@chapter Math Library Routines 142 143The following mathematical functions are available: 144 145@table @asis 146@item @code{acosq}: arc cosine function 147@item @code{acoshq}: inverse hyperbolic cosine function 148@item @code{asinq}: arc sine function 149@item @code{asinhq}: inverse hyperbolic sine function 150@item @code{atanq}: arc tangent function 151@item @code{atanhq}: inverse hyperbolic tangent function 152@item @code{atan2q}: arc tangent function 153@item @code{cbrtq}: cube root function 154@item @code{ceilq}: ceiling value function 155@item @code{copysignq}: copy sign of a number 156@item @code{coshq}: hyperbolic cosine function 157@item @code{cosq}: cosine function 158@item @code{erfq}: error function 159@item @code{erfcq}: complementary error function 160@item @code{expq}: exponential function 161@item @code{expm1q}: exponential minus 1 function 162@need 800 163@item @code{fabsq}: absolute value function 164@item @code{fdimq}: positive difference function 165@item @code{finiteq}: check finiteness of value 166@item @code{floorq}: floor value function 167@item @code{fmaq}: fused multiply and add 168@item @code{fmaxq}: determine maximum of two values 169@item @code{fminq}: determine minimum of two values 170@item @code{fmodq}: remainder value function 171@item @code{frexpq}: extract mantissa and exponent 172@item @code{hypotq}: Eucledian distance function 173@item @code{ilogbq}: get exponent of the value 174@item @code{isinfq}: check for infinity 175@item @code{isnanq}: check for not a number 176@item @code{j0q}: Bessel function of the first kind, first order 177@item @code{j1q}: Bessel function of the first kind, second order 178@item @code{jnq}: Bessel function of the first kind, @var{n}-th order 179@item @code{ldexpq}: load exponent of the value 180@item @code{lgammaq}: logarithmic gamma function 181@item @code{llrintq}: round to nearest integer value 182@item @code{llroundq}: round to nearest integer value away from zero 183@item @code{logbq}: get exponent of the value 184@item @code{logq}: natural logarithm function 185@item @code{log10q}: base 10 logarithm function 186@item @code{log1pq}: compute natural logarithm of the value plus one 187@item @code{log2q}: base 2 logarithm function 188@need 800 189@item @code{lrintq}: round to nearest integer value 190@item @code{lroundq}: round to nearest integer value away from zero 191@item @code{modfq}: decompose the floating-point number 192@item @code{nanq}: return quiet NaN 193@item @code{nearbyintq}: round to nearest integer 194@item @code{nextafterq}: next representable floating-point number 195@item @code{powq}: power function 196@item @code{remainderq}: remainder function 197@item @code{remquoq}: remainder and part of quotient 198@item @code{rintq}: round-to-nearest integral value 199@item @code{roundq}: round-to-nearest integral value, return @code{__float128} 200@item @code{scalblnq}: compute exponent using @code{FLT_RADIX} 201@item @code{scalbnq}: compute exponent using @code{FLT_RADIX} 202@item @code{signbitq}: return sign bit 203@item @code{sincosq}: calculate sine and cosine simultaneously 204@item @code{sinhq}: hyperbolic sine function 205@item @code{sinq}: sine function 206@item @code{sqrtq}: square root function 207@item @code{tanq}: tangent function 208@item @code{tanhq}: hyperbolic tangent function 209@need 800 210@item @code{tgammaq}: true gamma function 211@item @code{truncq}: round to integer, towards zero 212@item @code{y0q}: Bessel function of the second kind, first order 213@item @code{y1q}: Bessel function of the second kind, second order 214@item @code{ynq}: Bessel function of the second kind, @var{n}-th order 215@item @code{cabsq} complex absolute value function 216@item @code{cargq}: calculate the argument 217@item @code{cimagq} imaginary part of complex number 218@item @code{crealq}: real part of complex number 219@item @code{cacoshq}: complex arc hyperbolic cosine function 220@item @code{cacosq}: complex arc cosine function 221@item @code{casinhq}: complex arc hyperbolic sine function 222@item @code{casinq}: complex arc sine function 223@item @code{catanhq}: complex arc hyperbolic tangent function 224@item @code{catanq}: complex arc tangent function 225@item @code{ccosq} complex cosine function: 226@item @code{ccoshq}: complex hyperbolic cosine function 227@item @code{cexpq}: complex exponential function 228@need 800 229@item @code{cexpiq}: computes the exponential function of ``i'' times a 230 real value 231@item @code{clogq}: complex natural logarithm 232@item @code{clog10q}: complex base 10 logarithm 233@item @code{conjq}: complex conjugate function 234@item @code{cpowq}: complex power function 235@item @code{cprojq}: project into Riemann Sphere 236@item @code{csinq}: complex sine function 237@item @code{csinhq}: complex hyperbolic sine function 238@item @code{csqrtq}: complex square root 239@item @code{ctanq}: complex tangent function 240@item @code{ctanhq}: complex hyperbolic tangent function 241@end table 242 243 244@c --------------------------------------------------------------------- 245@c I/O routines 246@c --------------------------------------------------------------------- 247 248@node I/O Library Routines 249@chapter I/O Library Routines 250 251@menu 252* @code{strtoflt128}: strtoflt128, Convert from string 253* @code{quadmath_snprintf}: quadmath_snprintf, Convert to string 254@end menu 255 256 257@node strtoflt128 258@section @code{strtoflt128} --- Convert from string 259 260The function @code{strtoflt128} converts a string into a 261@code{__float128} number. 262 263@table @asis 264@item Syntax 265@code{__float128 strtoflt128 (const char *s, char **sp)} 266 267@item @emph{Arguments}: 268@multitable @columnfractions .15 .70 269@item @var{s} @tab input string 270@item @var{sp} @tab the address of the next character in the string 271@end multitable 272 273The argument @var{sp} contains, if not @code{NULL}, the address of the 274next character following the parts of the string, which have been read. 275 276@item Example 277@smallexample 278#include <quadmath.h> 279 280int main () 281@{ 282 __float128 r; 283 284 r = strtoflt128 ("1.2345678", NULL); 285 286 return 0; 287@} 288@end smallexample 289@end table 290 291 292@node quadmath_snprintf 293@section @code{quadmath_snprintf} --- Convert to string 294 295The function @code{quadmath_snprintf} converts a @code{__float128} floating-point 296number into a string. It is a specialized alternative to @code{snprintf}, where 297the format string is restricted to a single conversion specifier with @code{Q} 298modifier and conversion specifier @code{e}, @code{E}, @code{f}, @code{F}, @code{g}, 299@code{G}, @code{a} or @code{A}, with no extra characters before or after the 300conversion specifier. The @code{%m$} or @code{*m$} style must not be used in 301the format. 302 303@table @asis 304@item Syntax 305@code{int quadmath_snprintf (char *s, size_t size, const char *format, ...)} 306 307@item @emph{Arguments}: 308@multitable @columnfractions .15 .70 309@item @var{s} @tab output string 310@item @var{size} @tab byte size of the string, including tailing NUL 311@item @var{format} @tab conversion specifier string 312@end multitable 313 314@item Note 315On some targets when supported by the C library hooks are installed 316for @code{printf} family of functions, so that @code{printf ("%Qe", 1.2Q);} 317etc.@: works too. 318 319@item Example 320@smallexample 321#include <quadmath.h> 322#include <stdlib.h> 323#include <stdio.h> 324 325int main () 326@{ 327 __float128 r; 328 int prec = 20; 329 int width = 46; 330 char buf[128]; 331 332 r = 2.0q; 333 r = sqrtq (r); 334 int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r); 335 if ((size_t) n < sizeof buf) 336 printf ("%s\n", buf); 337 /* Prints: +1.41421356237309504880e+00 */ 338 quadmath_snprintf (buf, sizeof buf, "%Qa", r); 339 if ((size_t) n < sizeof buf) 340 printf ("%s\n", buf); 341 /* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */ 342 n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r); 343 if (n > -1) 344 @{ 345 char *str = malloc (n + 1); 346 if (str) 347 @{ 348 quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r); 349 printf ("%s\n", str); 350 /* Prints: +1.41421356237309504880e+00 */ 351 @} 352 free (str); 353 @} 354 return 0; 355@} 356@end smallexample 357 358@end table 359 360 361@c --------------------------------------------------------------------- 362@c GNU Free Documentation License 363@c --------------------------------------------------------------------- 364 365@include fdl.texi 366 367@c --------------------------------------------------------------------- 368@c Reporting Bugs 369@c --------------------------------------------------------------------- 370 371@c For BUGURL 372@include libquadmath-vers.texi 373 374@node Reporting Bugs 375@chapter Reporting Bugs 376 377Bugs in the GCC Quad-Precision Math Library implementation should be 378reported via @value{BUGURL}. 379 380 381@c --------------------------------------------------------------------- 382@c Index 383@c --------------------------------------------------------------------- 384 385@c @node Index 386@c @unnumbered Index 387@c 388@c @printindex cp 389 390@bye 391