1*226ab8c4Snros.\" $NetBSD: ldexp.3,v 1.5 2016/03/17 18:29:59 nros Exp $ 251086becSdrochner.\" 351086becSdrochner.\" Copyright (c) 1991, 1993 451086becSdrochner.\" The Regents of the University of California. All rights reserved. 551086becSdrochner.\" 651086becSdrochner.\" This code is derived from software contributed to Berkeley by 751086becSdrochner.\" the American National Standards Committee X3, on Information 851086becSdrochner.\" Processing Systems. 951086becSdrochner.\" 1051086becSdrochner.\" Redistribution and use in source and binary forms, with or without 1151086becSdrochner.\" modification, are permitted provided that the following conditions 1251086becSdrochner.\" are met: 1351086becSdrochner.\" 1. Redistributions of source code must retain the above copyright 1451086becSdrochner.\" notice, this list of conditions and the following disclaimer. 1551086becSdrochner.\" 2. Redistributions in binary form must reproduce the above copyright 1651086becSdrochner.\" notice, this list of conditions and the following disclaimer in the 1751086becSdrochner.\" documentation and/or other materials provided with the distribution. 1851086becSdrochner.\" 3. Neither the name of the University nor the names of its contributors 1951086becSdrochner.\" may be used to endorse or promote products derived from this software 2051086becSdrochner.\" without specific prior written permission. 2151086becSdrochner.\" 2251086becSdrochner.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2351086becSdrochner.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2451086becSdrochner.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2551086becSdrochner.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2651086becSdrochner.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2751086becSdrochner.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2851086becSdrochner.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2951086becSdrochner.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3051086becSdrochner.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3151086becSdrochner.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3251086becSdrochner.\" SUCH DAMAGE. 3351086becSdrochner.\" 3451086becSdrochner.\" @(#)ldexp.3 8.2 (Berkeley) 4/19/94 3551086becSdrochner.\" 36*226ab8c4Snros.Dd March 17, 2016 3751086becSdrochner.Dt LDEXP 3 3851086becSdrochner.Os 3951086becSdrochner.Sh NAME 40a697fe30Sjruoho.Nm ldexp , 41*226ab8c4Snros.Nm ldexpf , 42*226ab8c4Snros.Nm ldexpl 4351086becSdrochner.Nd multiply floating-point number by integral power of 2 4451086becSdrochner.Sh LIBRARY 4551086becSdrochner.Lb libm 4651086becSdrochner.Sh SYNOPSIS 4751086becSdrochner.In math.h 4851086becSdrochner.Ft double 4951086becSdrochner.Fn ldexp "double x" "int exp" 5051086becSdrochner.Ft float 5151086becSdrochner.Fn ldexpf "float x" "int exp" 52*226ab8c4Snros.Ft long double 53*226ab8c4Snros.Fn ldexpl "long double x" "int exp" 5451086becSdrochner.Sh DESCRIPTION 5551086becSdrochnerThe 5651086becSdrochner.Fn ldexp 57a697fe30Sjruohofamily of functions compute 58a697fe30Sjruoho.Bd -ragged -offset indent 59a697fe30Sjruoho.Va x 60a697fe30Sjruoho* 61a697fe30Sjruoho2^\fIexp\fR 62a697fe30Sjruoho.Ed 63a697fe30Sjruoho.Pp 64a697fe30Sjruohofor a real floating-point number 65a697fe30Sjruoho.Fa x . 6651086becSdrochner.Sh RETURN VALUES 67a697fe30SjruohoThe functions return the value of 6851086becSdrochner.Fa x 6951086becSdrochnertimes 2 raised to the power 7051086becSdrochner.Fa exp . 71a697fe30SjruohoOtherwise the following may occur: 72a697fe30Sjruoho.Bl -enum -offset indent 73a697fe30Sjruoho.It 74a697fe30SjruohoIf 75a697fe30Sjruoho.Fa x 76a697fe30Sjruohois \*(Na, a \*(Na is returned. 77a697fe30Sjruoho.It 78a697fe30SjruohoIf 79a697fe30Sjruoho.Fa exp 80a697fe30Sjruohois zero or 81a697fe30Sjruoho.Fa x 82f31614feSwizis either \*(Pm 0 or \*(Pm\[if], 83a697fe30Sjruoho.Fa x 84a697fe30Sjruohois returned. 85a697fe30Sjruoho.It 86a697fe30SjruohoIf the call would cause an overflow, a range error occurs and either 87a697fe30Sjruoho.Dv \*(Pm\*HHUGE_VAL , 88a697fe30Sjruoho.Dv \*(Pm\*HHUGE_VALF , 89a697fe30Sjruohoor 90a697fe30Sjruoho.Dv \*(Pm\*HHUGE_VALL 91a697fe30Sjruohois returned, depending on the sign of 92a697fe30Sjruoho.Fa x 93a697fe30Sjruohoand the type of the return value. 94a697fe30Sjruoho.It 95a697fe30SjruohoIf an underflow would be caused by the correct value, 96a697fe30Sjruohoand the value is not representable, either 0.0 or 97a697fe30Sjruohoan implementation-defined value is returned. 98a697fe30Sjruoho.El 9951086becSdrochner.Sh SEE ALSO 10051086becSdrochner.Xr frexp 3 , 10151086becSdrochner.Xr math 3 , 10251086becSdrochner.Xr modf 3 10351086becSdrochner.Sh STANDARDS 104a697fe30SjruohoThe described functions conform to 105a697fe30Sjruoho.St -isoC-99 . 106