about summary refs log tree commit diff
path: root/manual
diff options
context:
space:
mode:
Diffstat (limited to 'manual')
-rw-r--r--manual/arith.texi81
-rwxr-xr-xmanual/libm-err-tab.pl5
2 files changed, 84 insertions, 2 deletions
diff --git a/manual/arith.texi b/manual/arith.texi
index f35c3cd9f8..dec12a06ae 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -1495,6 +1495,37 @@ result can actually be represented as an @code{int}---for very large
 numbers, this is impossible.  The functions listed here return the
 result as a @code{double} instead to get around this problem.
 
+The @code{fromfp} functions use the following macros, from TS
+18661-1:2014, to specify the direction of rounding.  These correspond
+to the rounding directions defined in IEEE 754-2008.
+
+@vtable @code
+@comment math.h
+@comment ISO
+@item FP_INT_UPWARD
+Round toward @math{+@infinity{}}.
+
+@comment math.h
+@comment ISO
+@item FP_INT_DOWNWARD
+Round toward @math{-@infinity{}}.
+
+@comment math.h
+@comment ISO
+@item FP_INT_TOWARDZERO
+Round toward zero.
+
+@comment math.h
+@comment ISO
+@item FP_INT_TONEARESTFROMZERO
+Round to nearest, ties round away from zero.
+
+@comment math.h
+@comment ISO
+@item FP_INT_TONEAREST
+Round to nearest, ties round to even.
+@end vtable
+
 @comment math.h
 @comment ISO
 @deftypefun double ceil (double @var{x})
@@ -1660,6 +1691,56 @@ These functions are just like @code{round}, but they return a
 @code{long long int} instead of a floating-point number.
 @end deftypefun
 
+@comment math.h
+@comment ISO
+@deftypefun intmax_t fromfp (double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx intmax_t fromfpf (float @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx intmax_t fromfpl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx uintmax_t ufromfp (double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx uintmax_t ufromfpf (float @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx uintmax_t ufromfpl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx intmax_t fromfpx (double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx intmax_t fromfpxf (float @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx intmax_t fromfpxl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx uintmax_t ufromfpx (double @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx uintmax_t ufromfpxf (float @var{x}, int @var{round}, unsigned int @var{width})
+@comment math.h
+@comment ISO
+@deftypefunx uintmax_t ufromfpxl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+These functions, from TS 18661-1:2014, convert a floating-point number
+to an integer according to the rounding direction @var{round} (one of
+the @code{FP_INT_*} macros).  If the integer is outside the range of a
+signed or unsigned (depending on the return type of the function) type
+of width @var{width} bits (or outside the range of the return type, if
+@var{width} is larger), or if @var{x} is infinite or NaN, or if
+@var{width} is zero, a domain error occurs and an unspecified value is
+returned.  The functions with an @samp{x} in their names raise the
+inexact exception when a domain error does not occur and the argument
+is not an integer; the other functions do not raise the inexact
+exception.
+@end deftypefun
+
 
 @comment math.h
 @comment ISO
diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl
index 9b8aa664ae..fc6fd30bdf 100755
--- a/manual/libm-err-tab.pl
+++ b/manual/libm-err-tab.pl
@@ -57,13 +57,14 @@ use vars qw (%results @all_floats %suffices @all_functions);
     "clog", "clog10", "conj", "copysign", "cos", "cosh", "cpow", "cproj",
     "creal", "csin", "csinh", "csqrt", "ctan", "ctanh", "erf", "erfc",
     "exp", "exp10", "exp2", "expm1", "fabs", "fdim", "floor", "fma",
-    "fmax", "fmaxmag", "fmin", "fminmag", "fmod", "frexp", "gamma", "hypot",
+    "fmax", "fmaxmag", "fmin", "fminmag", "fmod", "frexp", "fromfp", "fromfpx",
+    "gamma", "hypot",
     "ilogb", "j0", "j1", "jn", "lgamma", "llogb", "lrint",
     "llrint", "log", "log10", "log1p", "log2", "logb", "lround",
     "llround", "modf", "nearbyint", "nextafter", "nextdown", "nexttoward",
     "nextup", "pow", "remainder", "remquo", "rint", "round", "roundeven",
     "scalb", "scalbn", "sin", "sincos", "sinh", "sqrt", "tan", "tanh",
-    "tgamma", "trunc", "y0", "y1", "yn" );
+    "tgamma", "trunc", "ufromfp", "ufromfpx", "y0", "y1", "yn" );
 # canonicalize, fpclassify, getpayload, iscanonical, isnormal,
 # isfinite, isinf, isnan, issignaling, issubnormal, iszero, signbit,
 # iseqsig, isgreater, isgreaterequal, isless, islessequal,