1.\" $NetBSD: nextafter.3,v 1.4 2011/09/18 05:33:14 jruoho Exp $ 2.\" 3.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi> 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd $Mdocdate: February 9 2014 $ 28.Dt NEXTAFTER 3 29.Os 30.Sh NAME 31.Nm nextafter , 32.Nm nextafterf 33.Nd next representable floating-point number 34.Sh LIBRARY 35.Lb libm 36.Sh SYNOPSIS 37.In math.h 38.Ft double 39.Fn nextafter "double x" "double y" 40.Ft float 41.Fn nextafterf "float x" "float y" 42.Sh DESCRIPTION 43The 44.Fn nextafter 45and 46.Fn nextafterf 47functions return the next machine representable number from 48.Fa x 49in direction of 50.Fa y . 51In other words, if 52.Fa y 53is less than 54.Fa x , 55the functions return the largest representable floating-point number less than 56.Fa x . 57When 58.Fa x 59equals 60.Fa y , 61the value of 62.Fa y 63is returned. 64The three functions differ only in the type of the return value and 65.Fa x . 66.Sh RETURN VALUES 67Upon successful completion, the described functions return 68the next representable floating-point value as described above. 69If 70.Fa x 71is finite but an overflow would occur, 72a range error follows and the functions return 73.Dv \*(Pm\*HHUGE_VAL , 74.Dv \*(Pm\*HHUGE_VALF , 75or 76.Dv \*(Pm\*HHUGE_VALL 77with the same sign as 78.Fa x . 79When either 80.Fa x 81or 82.Fa y 83is \*(Na, a \*(Na is returned. 84When 85.Fa x 86is not 87.Fa y 88but the function value is subnormal, zero, or underflows, 89a range error occurs, and either 0.0 or the correct function 90value (if representable) is returned. 91.Sh SEE ALSO 92.Xr math 3 93.Sh STANDARDS 94The described functions conform to 95.St -isoC-99 . 96