xref: /minix3/lib/libm/man/nextafter.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\" $NetBSD: nextafter.3,v 1.5 2015/09/13 10:58:30 he Exp $
284d9c625SLionel Sambuc.\"
384d9c625SLionel Sambuc.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi>
484d9c625SLionel Sambuc.\" All rights reserved.
584d9c625SLionel Sambuc.\"
684d9c625SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
784d9c625SLionel Sambuc.\" modification, are permitted provided that the following conditions
884d9c625SLionel Sambuc.\" are met:
984d9c625SLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
1084d9c625SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
1184d9c625SLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
1284d9c625SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
1384d9c625SLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
1484d9c625SLionel Sambuc.\"
1584d9c625SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1684d9c625SLionel Sambuc.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1784d9c625SLionel Sambuc.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1884d9c625SLionel Sambuc.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1984d9c625SLionel Sambuc.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2084d9c625SLionel Sambuc.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2184d9c625SLionel Sambuc.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2284d9c625SLionel Sambuc.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2384d9c625SLionel Sambuc.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2484d9c625SLionel Sambuc.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2584d9c625SLionel Sambuc.\" POSSIBILITY OF SUCH DAMAGE.
2684d9c625SLionel Sambuc.\"
27*0a6a1f1dSLionel Sambuc.Dd September 13, 2015
2884d9c625SLionel Sambuc.Dt NEXTAFTER 3
2984d9c625SLionel Sambuc.Os
3084d9c625SLionel Sambuc.Sh NAME
3184d9c625SLionel Sambuc.Nm nextafter ,
3284d9c625SLionel Sambuc.Nm nextafterf ,
3384d9c625SLionel Sambuc.Nm nextafterl ,
34*0a6a1f1dSLionel Sambuc.Nm nexttoward ,
35*0a6a1f1dSLionel Sambuc.Nm nexttowardf
3684d9c625SLionel Sambuc.\"
3784d9c625SLionel Sambuc.\" XXX: Not yet implemented.
3884d9c625SLionel Sambuc.\"
3984d9c625SLionel Sambuc.\" .Nm nexttowardl
4084d9c625SLionel Sambuc.\"
4184d9c625SLionel Sambuc.Nd next representable floating-point number
4284d9c625SLionel Sambuc.Sh LIBRARY
4384d9c625SLionel Sambuc.Lb libm
4484d9c625SLionel Sambuc.Sh SYNOPSIS
4584d9c625SLionel Sambuc.In math.h
4684d9c625SLionel Sambuc.Ft double
4784d9c625SLionel Sambuc.Fn nextafter "double x" "double y"
4884d9c625SLionel Sambuc.Ft float
4984d9c625SLionel Sambuc.Fn nextafterf "float x" "float y"
5084d9c625SLionel Sambuc.Ft long double
5184d9c625SLionel Sambuc.Fn nextafterl "long double x" "long double y"
5284d9c625SLionel Sambuc.Ft double
5384d9c625SLionel Sambuc.Fn nexttoward "double x" "long double y"
54*0a6a1f1dSLionel Sambuc.Ft float
55*0a6a1f1dSLionel Sambuc.Fn nexttowardf "float x" "long double y"
5684d9c625SLionel Sambuc.Sh DESCRIPTION
5784d9c625SLionel SambucThe
5884d9c625SLionel Sambuc.Fn nextafter ,
5984d9c625SLionel Sambuc.Fn nextafterf ,
6084d9c625SLionel Sambucand
6184d9c625SLionel Sambuc.Fn nextafterl
6284d9c625SLionel Sambucfunctions return the next machine representable number from
6384d9c625SLionel Sambuc.Fa x
6484d9c625SLionel Sambucin direction of
6584d9c625SLionel Sambuc.Fa y .
6684d9c625SLionel SambucIn other words, if
6784d9c625SLionel Sambuc.Fa y
6884d9c625SLionel Sambucis less than
6984d9c625SLionel Sambuc.Fa x ,
7084d9c625SLionel Sambucthe functions return the largest representable floating-point number less than
7184d9c625SLionel Sambuc.Fa x .
7284d9c625SLionel SambucWhen
7384d9c625SLionel Sambuc.Fa x
7484d9c625SLionel Sambucequals
7584d9c625SLionel Sambuc.Fa y ,
7684d9c625SLionel Sambucthe value of
7784d9c625SLionel Sambuc.Fa y
7884d9c625SLionel Sambucis returned.
7984d9c625SLionel SambucThe three functions differ only in the type of the return value and
8084d9c625SLionel Sambuc.Fa x .
8184d9c625SLionel Sambuc.Pp
8284d9c625SLionel SambucThe
8384d9c625SLionel Sambuc.Fn nexttoward
84*0a6a1f1dSLionel Sambucand
85*0a6a1f1dSLionel Sambuc.Fn nexttowardf
86*0a6a1f1dSLionel Sambucfunctions are equivalent to the
8784d9c625SLionel Sambuc.Fn nextafter
8884d9c625SLionel Sambucfamily of functions with two exceptions:
8984d9c625SLionel Sambuc.Bl -enum -offset indent
9084d9c625SLionel Sambuc.It
9184d9c625SLionel SambucThe second parameter has a type
9284d9c625SLionel Sambuc.Vt long double .
9384d9c625SLionel Sambuc.It
9484d9c625SLionel SambucThe return value is
9584d9c625SLionel Sambuc.Fa y
9684d9c625SLionel Sambucconverted to the type of the function, provided that
9784d9c625SLionel Sambuc.Fa x
9884d9c625SLionel Sambucequals
9984d9c625SLionel Sambuc.Fa y .
10084d9c625SLionel Sambuc.El
10184d9c625SLionel Sambuc.Sh RETURN VALUES
10284d9c625SLionel SambucUpon successful completion, the described functions return
10384d9c625SLionel Sambucthe next representable floating-point value as described above.
10484d9c625SLionel SambucIf
10584d9c625SLionel Sambuc.Fa x
10684d9c625SLionel Sambucis finite but an overflow would occur,
10784d9c625SLionel Sambuca range error follows and the functions return
10884d9c625SLionel Sambuc.Dv \*(Pm\*HHUGE_VAL ,
10984d9c625SLionel Sambuc.Dv  \*(Pm\*HHUGE_VALF ,
11084d9c625SLionel Sambucor
11184d9c625SLionel Sambuc.Dv  \*(Pm\*HHUGE_VALL
11284d9c625SLionel Sambucwith the same sign as
11384d9c625SLionel Sambuc.Fa x .
11484d9c625SLionel SambucWhen either
11584d9c625SLionel Sambuc.Fa x
11684d9c625SLionel Sambucor
11784d9c625SLionel Sambuc.Fa y
11884d9c625SLionel Sambucis \*(Na, a \*(Na is returned.
11984d9c625SLionel SambucWhen
12084d9c625SLionel Sambuc.Fa x
12184d9c625SLionel Sambucis not
12284d9c625SLionel Sambuc.Fa y
12384d9c625SLionel Sambucbut the function value is subnormal, zero, or underflows,
12484d9c625SLionel Sambuca range error occurs, and either 0.0 or the correct function
12584d9c625SLionel Sambucvalue (if representable) is returned.
12684d9c625SLionel Sambuc.Sh SEE ALSO
12784d9c625SLionel Sambuc.Xr math 3
12884d9c625SLionel Sambuc.Sh STANDARDS
12984d9c625SLionel SambucThe described functions conform to
13084d9c625SLionel Sambuc.St -isoC-99 .
131