nexttoward.3   [plain text]


.\" Copyright (c) 2008 Apple Inc.
.\" 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.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
.\"
.\"     from: @(#)nexttoward.3	1.0 2008/07/02
.\"
.Dd July 02, 2008
.Dt NEXTTOWARD 3
.Os
.Sh NAME
.Nm nexttoward
.Sh SYNOPSIS
.Fd #include <math.h>
.Ft double 
.Fn nexttoward "double x" "long double y"
.Ft long double 
.Fn nexttowardl "long double x" "long double y"
.Ft float
.Fn nexttoward "float x" "long double y"
.Sh DESCRIPTION
The
.Fn nexttoward 
functions return the next machine representable number from 
.Fa x
in direction of
.Fa y .
It is identical to
.Fn nextafter
except that the second parameter has type long double, and the function returns
.Fa y
converted to the type of the function if
.Fa x
and
.Fa y
are equal.
.Sh SPECIAL VALUES
.Fn nexttoward "x" "y"
raises the "overflow" and "inexact" floating-point exceptions for x finite and the function value infinite.
.Pp
.Fn nexttoward "x" "y"
raises the "underflow" and "inexact" floating-point exceptions for the function value subnormal or zero and x not equal to y.
.Sh SEE ALSO
.Xr nextafter 3
.Xr math 3
.Sh STANDARDS
The
.Fn nexttoward
functions conform to ISO/IEC 9899:1999(E).