1*c1c809edSmgorny.\" $NetBSD: nextafter.3,v 1.8 2019/05/02 15:08:35 mgorny Exp $ 29305ee0cSjruoho.\" 39305ee0cSjruoho.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi> 49305ee0cSjruoho.\" All rights reserved. 59305ee0cSjruoho.\" 69305ee0cSjruoho.\" Redistribution and use in source and binary forms, with or without 79305ee0cSjruoho.\" modification, are permitted provided that the following conditions 89305ee0cSjruoho.\" are met: 99305ee0cSjruoho.\" 1. Redistributions of source code must retain the above copyright 109305ee0cSjruoho.\" notice, this list of conditions and the following disclaimer. 119305ee0cSjruoho.\" 2. Redistributions in binary form must reproduce the above copyright 129305ee0cSjruoho.\" notice, this list of conditions and the following disclaimer in the 139305ee0cSjruoho.\" documentation and/or other materials provided with the distribution. 149305ee0cSjruoho.\" 159305ee0cSjruoho.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 169305ee0cSjruoho.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 179305ee0cSjruoho.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 189305ee0cSjruoho.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 199305ee0cSjruoho.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 209305ee0cSjruoho.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 219305ee0cSjruoho.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 229305ee0cSjruoho.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 239305ee0cSjruoho.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 249305ee0cSjruoho.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 259305ee0cSjruoho.\" POSSIBILITY OF SUCH DAMAGE. 269305ee0cSjruoho.\" 273c48f5cbShe.Dd September 13, 2015 289305ee0cSjruoho.Dt NEXTAFTER 3 299305ee0cSjruoho.Os 309305ee0cSjruoho.Sh NAME 319305ee0cSjruoho.Nm nextafter , 329305ee0cSjruoho.Nm nextafterf , 339305ee0cSjruoho.Nm nextafterl , 343c48f5cbShe.Nm nexttoward , 350c003f59Skamil.Nm nexttowardf , 360c003f59Skamil.Nm nexttowardl 379305ee0cSjruoho.Nd next representable floating-point number 389305ee0cSjruoho.Sh LIBRARY 399305ee0cSjruoho.Lb libm 409305ee0cSjruoho.Sh SYNOPSIS 419305ee0cSjruoho.In math.h 429305ee0cSjruoho.Ft double 439305ee0cSjruoho.Fn nextafter "double x" "double y" 449305ee0cSjruoho.Ft float 459305ee0cSjruoho.Fn nextafterf "float x" "float y" 469305ee0cSjruoho.Ft long double 479305ee0cSjruoho.Fn nextafterl "long double x" "long double y" 489305ee0cSjruoho.Ft double 499305ee0cSjruoho.Fn nexttoward "double x" "long double y" 503c48f5cbShe.Ft float 513c48f5cbShe.Fn nexttowardf "float x" "long double y" 520c003f59Skamil.Ft long double 530c003f59Skamil.Fn nexttowardl "long double x" "long double y" 549305ee0cSjruoho.Sh DESCRIPTION 559305ee0cSjruohoThe 569305ee0cSjruoho.Fn nextafter , 579305ee0cSjruoho.Fn nextafterf , 589305ee0cSjruohoand 599305ee0cSjruoho.Fn nextafterl 609305ee0cSjruohofunctions return the next machine representable number from 619305ee0cSjruoho.Fa x 629305ee0cSjruohoin direction of 639305ee0cSjruoho.Fa y . 649305ee0cSjruohoIn other words, if 659305ee0cSjruoho.Fa y 669305ee0cSjruohois less than 679305ee0cSjruoho.Fa x , 689305ee0cSjruohothe functions return the largest representable floating-point number less than 699305ee0cSjruoho.Fa x . 709305ee0cSjruohoWhen 719305ee0cSjruoho.Fa x 729305ee0cSjruohoequals 739305ee0cSjruoho.Fa y , 749305ee0cSjruohothe value of 759305ee0cSjruoho.Fa y 769305ee0cSjruohois returned. 779305ee0cSjruohoThe three functions differ only in the type of the return value and 789305ee0cSjruoho.Fa x . 799305ee0cSjruoho.Pp 809305ee0cSjruohoThe 81*c1c809edSmgorny.Fn nexttoward 820c003f59Skamiland 83*c1c809edSmgorny.Fn nexttowardf 843c48f5cbShefunctions are equivalent to the 859305ee0cSjruoho.Fn nextafter 869305ee0cSjruohofamily of functions with two exceptions: 879305ee0cSjruoho.Bl -enum -offset indent 889305ee0cSjruoho.It 899305ee0cSjruohoThe second parameter has a type 909305ee0cSjruoho.Vt long double . 919305ee0cSjruoho.It 929305ee0cSjruohoThe return value is 939305ee0cSjruoho.Fa y 949305ee0cSjruohoconverted to the type of the function, provided that 959305ee0cSjruoho.Fa x 969305ee0cSjruohoequals 979305ee0cSjruoho.Fa y . 985b8e5cb4Schristos.El 99*c1c809edSmgorny.Pp 100*c1c809edSmgorny.Fn nexttowardl 101*c1c809edSmgornyis equivalent to 102*c1c809edSmgorny.Fn nextafterl . 1039305ee0cSjruoho.Sh RETURN VALUES 1049305ee0cSjruohoUpon successful completion, the described functions return 1059305ee0cSjruohothe next representable floating-point value as described above. 1069305ee0cSjruohoIf 1079305ee0cSjruoho.Fa x 1089305ee0cSjruohois finite but an overflow would occur, 1099305ee0cSjruohoa range error follows and the functions return 1106d614447Swiz.Dv \*(PmHUGE_VAL , 1116d614447Swiz.Dv \*(PmHUGE_VALF , 1129305ee0cSjruohoor 1136d614447Swiz.Dv \*(PmHUGE_VALL 1149305ee0cSjruohowith the same sign as 1159305ee0cSjruoho.Fa x . 1169305ee0cSjruohoWhen either 1179305ee0cSjruoho.Fa x 1189305ee0cSjruohoor 1199305ee0cSjruoho.Fa y 1209305ee0cSjruohois \*(Na, a \*(Na is returned. 1219305ee0cSjruohoWhen 1229305ee0cSjruoho.Fa x 1239305ee0cSjruohois not 1249305ee0cSjruoho.Fa y 1259305ee0cSjruohobut the function value is subnormal, zero, or underflows, 1269305ee0cSjruohoa range error occurs, and either 0.0 or the correct function 1279305ee0cSjruohovalue (if representable) is returned. 1289305ee0cSjruoho.Sh SEE ALSO 1299305ee0cSjruoho.Xr math 3 1309305ee0cSjruoho.Sh STANDARDS 1319305ee0cSjruohoThe described functions conform to 1329305ee0cSjruoho.St -isoC-99 . 133