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