1*11f8ac70Sjruoho.\" $NetBSD: scalbn.3,v 1.2 2011/09/18 05:33:14 jruoho Exp $ 2c19246b8Sjruoho.\" 3c19246b8Sjruoho.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi> 4c19246b8Sjruoho.\" All rights reserved. 5c19246b8Sjruoho.\" 6c19246b8Sjruoho.\" Redistribution and use in source and binary forms, with or without 7c19246b8Sjruoho.\" modification, are permitted provided that the following conditions 8c19246b8Sjruoho.\" are met: 9c19246b8Sjruoho.\" 1. Redistributions of source code must retain the above copyright 10c19246b8Sjruoho.\" notice, this list of conditions and the following disclaimer. 11c19246b8Sjruoho.\" 2. Redistributions in binary form must reproduce the above copyright 12c19246b8Sjruoho.\" notice, this list of conditions and the following disclaimer in the 13c19246b8Sjruoho.\" documentation and/or other materials provided with the distribution. 14c19246b8Sjruoho.\" 15c19246b8Sjruoho.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16c19246b8Sjruoho.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17c19246b8Sjruoho.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18c19246b8Sjruoho.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19c19246b8Sjruoho.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20c19246b8Sjruoho.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21c19246b8Sjruoho.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22c19246b8Sjruoho.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23c19246b8Sjruoho.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24c19246b8Sjruoho.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25c19246b8Sjruoho.\" POSSIBILITY OF SUCH DAMAGE. 26c19246b8Sjruoho.\" 27*11f8ac70Sjruoho.Dd September 18, 2011 28c19246b8Sjruoho.Dt SCALBN 3 29c19246b8Sjruoho.Os 30c19246b8Sjruoho.Sh NAME 31c19246b8Sjruoho.Nm scalbn , 32c19246b8Sjruoho.Nm scalbnf , 33c19246b8Sjruoho.Nm scalbnl 34c19246b8Sjruoho.Nd exponent using FLT_RADIX 35c19246b8Sjruoho.Sh LIBRARY 36c19246b8Sjruoho.Lb libm 37c19246b8Sjruoho.Sh SYNOPSIS 38c19246b8Sjruoho.In math.h 39c19246b8Sjruoho.Ft double 40c19246b8Sjruoho.Fn scalbn "double x" "int n" 41c19246b8Sjruoho.Ft float 42c19246b8Sjruoho.Fn scalbnf "float x" "int n" 43c19246b8Sjruoho.Ft long double 44c19246b8Sjruoho.Fn scalbnl "long double x" "int n" 45c19246b8Sjruoho.Sh DESCRIPTION 46c19246b8SjruohoThe 47c19246b8Sjruoho.Fn scalbn , 48c19246b8Sjruoho.Fn scalbnf , 49c19246b8Sjruohoand 50c19246b8Sjruoho.Fn scalbnl 51c19246b8Sjruohofunctions compute 52c19246b8Sjruoho.Fa x 53c19246b8Sjruoho* 54c19246b8Sjruoho.Fa r^n , 55c19246b8Sjruohowhere 56c19246b8Sjruoho.Fa r 57c19246b8Sjruohois the radix of the machine's floating point arithmetic, defined by the 58c19246b8Sjruoho.Dv FLT_RADIX 59c19246b8Sjruohoconstant in 60c19246b8Sjruoho.In float.h . 61c19246b8SjruohoThe rationale is efficiency; 62c19246b8Sjruoho.Fa r^n 63c19246b8Sjruohois not computed explicitly. 64c19246b8Sjruoho.Sh RETURN VALUES 65c19246b8SjruohoAs described above, upon successful completion, the described functions return 66c19246b8Sjruohothe exponent computed using 67c19246b8Sjruoho.Dv FLT_RADIX . 68c19246b8SjruohoOtherwise the following may occur: 69c19246b8Sjruoho.Pp 70c19246b8Sjruoho.Bl -enum -offset indent 71c19246b8Sjruoho.It 72c19246b8SjruohoWhen the result would cause an overflow, a range error occurs and 73c19246b8Sjruoho.Dv \*(Pm\*HHUGE_VAL , 74c19246b8Sjruoho.Dv \*(Pm\*HHUGE_VALF , 75c19246b8Sjruohoor 76c19246b8Sjruoho.Dv \*(Pm\*HHUGE_VALL 77c19246b8Sjruohois returned according to the sign of 78c19246b8Sjruoho.Fa x 79c19246b8Sjruohoand the return type of the corresponding function. 80c19246b8Sjruoho.It 81c19246b8SjruohoWhen the correct value would cause an underflow 82c19246b8Sjruohoand it is not representable, a range error occurs and 83c19246b8Sjruohoeither 0.0 or an implementation-defined value is returned. 84c19246b8SjruohoWhen an underflow occurs but the correct value is representable, 85c19246b8Sjruohoa range error occurs but the correct value is returned. 86c19246b8Sjruoho.It 87c19246b8SjruohoIf 88c19246b8Sjruoho.Fa x 89c19246b8Sjruohois \*(Pm0 or \*(Pm\Inf, 90c19246b8Sjruoho.Fa x 91c19246b8Sjruohois returned. 92c19246b8SjruohoLikewise, if 93c19246b8Sjruoho.Fa n 94c19246b8Sjruohois zero, 95c19246b8Sjruoho.Fa x 96c19246b8Sjruohois returned. 97c19246b8SjruohoIf 98c19246b8Sjruoho.Fa x 99c19246b8Sjruohois \*(Na, \*(Na is returned. 100c19246b8Sjruoho.El 101c19246b8Sjruoho.Sh SEE ALSO 102c19246b8Sjruoho.Xr exp 3 , 103c19246b8Sjruoho.Xr frexp 3 , 104c19246b8Sjruoho.Xr ldexp 3 , 105c19246b8Sjruoho.Xr math 3 106c19246b8Sjruoho.Sh STANDARDS 107c19246b8SjruohoThe described functions conform to 108c19246b8Sjruoho.St -isoC-99 . 109