1177668d1SDavid Schultz.\" Copyright (c) 2008-2010 David Schultz <das@FreeBSD.org> 255265516SDavid Schultz.\" All rights reserved. 355265516SDavid Schultz.\" 455265516SDavid Schultz.\" Redistribution and use in source and binary forms, with or without 555265516SDavid Schultz.\" modification, are permitted provided that the following conditions 655265516SDavid Schultz.\" are met: 755265516SDavid Schultz.\" 1. Redistributions of source code must retain the above copyright 855265516SDavid Schultz.\" notice, this list of conditions and the following disclaimer. 955265516SDavid Schultz.\" 2. Redistributions in binary form must reproduce the above copyright 1055265516SDavid Schultz.\" notice, this list of conditions and the following disclaimer in the 1155265516SDavid Schultz.\" documentation and/or other materials provided with the distribution. 1255265516SDavid Schultz.\" 1355265516SDavid Schultz.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1455265516SDavid Schultz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1555265516SDavid Schultz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1655265516SDavid Schultz.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1755265516SDavid Schultz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1855265516SDavid Schultz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1955265516SDavid Schultz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2055265516SDavid Schultz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2155265516SDavid Schultz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2255265516SDavid Schultz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2355265516SDavid Schultz.\" SUCH DAMAGE. 2455265516SDavid Schultz.\" 25*8e76d790SSergio Carlavilla Delgado.Dd March 22, 2020 2655265516SDavid Schultz.Dt LOG 3 2755265516SDavid Schultz.Os 2855265516SDavid Schultz.Sh NAME 2955265516SDavid Schultz.Nm log , 3055265516SDavid Schultz.Nm logf , 3155265516SDavid Schultz.Nm logl , 3255265516SDavid Schultz.Nm log10 , 3355265516SDavid Schultz.Nm log10f , 3425a4d6bfSDavid Schultz.Nm log10l , 35177668d1SDavid Schultz.Nm log2 , 36177668d1SDavid Schultz.Nm log2f , 3725a4d6bfSDavid Schultz.Nm log2l , 3855265516SDavid Schultz.Nm log1p , 3925a4d6bfSDavid Schultz.Nm log1pf , 4025a4d6bfSDavid Schultz.Nm log1pl 4155265516SDavid Schultz.Nd logarithm functions 4255265516SDavid Schultz.Sh LIBRARY 4355265516SDavid Schultz.Lb libm 4455265516SDavid Schultz.Sh SYNOPSIS 4555265516SDavid Schultz.In math.h 4655265516SDavid Schultz.Ft double 4755265516SDavid Schultz.Fn log "double x" 4855265516SDavid Schultz.Ft float 4955265516SDavid Schultz.Fn logf "float x" 5025a4d6bfSDavid Schultz.Ft long double 5125a4d6bfSDavid Schultz.Fn logl "long double x" 5255265516SDavid Schultz.Ft double 5355265516SDavid Schultz.Fn log10 "double x" 5455265516SDavid Schultz.Ft float 5555265516SDavid Schultz.Fn log10f "float x" 5625a4d6bfSDavid Schultz.Ft long double 5725a4d6bfSDavid Schultz.Fn log10l "long double x" 5855265516SDavid Schultz.Ft double 59177668d1SDavid Schultz.Fn log2 "double x" 60177668d1SDavid Schultz.Ft float 61177668d1SDavid Schultz.Fn log2f "float x" 6225a4d6bfSDavid Schultz.Ft long double 6325a4d6bfSDavid Schultz.Fn log2l "long double x" 64177668d1SDavid Schultz.Ft double 6555265516SDavid Schultz.Fn log1p "double x" 6655265516SDavid Schultz.Ft float 6755265516SDavid Schultz.Fn log1pf "float x" 6825a4d6bfSDavid Schultz.Ft long double 6925a4d6bfSDavid Schultz.Fn log1pl "long double x" 7055265516SDavid Schultz.Sh DESCRIPTION 7155265516SDavid SchultzThe 7225a4d6bfSDavid Schultz.Fn log , 7325a4d6bfSDavid Schultz.Fn logf , 7455265516SDavid Schultzand 7525a4d6bfSDavid Schultz.Fn logl 7655265516SDavid Schultzfunctions compute the natural logarithm of 7755265516SDavid Schultz.Fa x . 7855265516SDavid Schultz.Pp 7955265516SDavid SchultzThe 8025a4d6bfSDavid Schultz.Fn log10 , 8125a4d6bfSDavid Schultz.Fn log10f , 8255265516SDavid Schultzand 8325a4d6bfSDavid Schultz.Fn log10l 8455265516SDavid Schultzfunctions compute the logarithm base 10 of 85177668d1SDavid Schultz.Fa x , 86177668d1SDavid Schultzwhile 8725a4d6bfSDavid Schultz.Fn log2 , 8825a4d6bfSDavid Schultz.Fn log2f , 89177668d1SDavid Schultzand 9025a4d6bfSDavid Schultz.Fn log2l 91177668d1SDavid Schultzcompute the logarithm base 2 of 9255265516SDavid Schultz.Fa x . 9355265516SDavid Schultz.Pp 9455265516SDavid SchultzThe 9525a4d6bfSDavid Schultz.Fn log1p , 9625a4d6bfSDavid Schultz.Fn log1pf , 9755265516SDavid Schultzand 9825a4d6bfSDavid Schultz.Fn log1pl 9955265516SDavid Schultzfunctions compute the natural logarithm of 10055265516SDavid Schultz.No "1 + x" . 10155265516SDavid SchultzComputing the natural logarithm as 10255265516SDavid Schultz.Li log1p(x) 10355265516SDavid Schultzis more accurate than computing it as 10455265516SDavid Schultz.Li log(1 + x) 10555265516SDavid Schultzwhen 10655265516SDavid Schultz.Fa x 10755265516SDavid Schultzis close to zero. 10855265516SDavid Schultz.Sh RETURN VALUES 10955265516SDavid SchultzThese functions return the requested logarithm; the logarithm of 1 is +0. 11055265516SDavid SchultzAn attempt to take the logarithm of \*(Pm0 results in a divide-by-zero 11155265516SDavid Schultzexception, and -\*(If is returned. 11255265516SDavid SchultzOtherwise, attempting to take the logarithm of a negative number 11355265516SDavid Schultzresults in an invalid exception and a return value of \*(Na. 11455265516SDavid Schultz.Sh SEE ALSO 11555265516SDavid Schultz.Xr exp 3 , 11655265516SDavid Schultz.Xr ilogb 3 , 11755265516SDavid Schultz.Xr math 3 , 11855265516SDavid Schultz.Xr pow 3 11955265516SDavid Schultz.Sh STANDARDS 12055265516SDavid SchultzThe 12155265516SDavid Schultz.Fn log , 12255265516SDavid Schultz.Fn logf , 12325a4d6bfSDavid Schultz.Fn logl , 12455265516SDavid Schultz.Fn log10 , 12555265516SDavid Schultz.Fn log10f , 12625a4d6bfSDavid Schultz.Fn log10l , 127177668d1SDavid Schultz.Fn log2 , 128177668d1SDavid Schultz.Fn log2f , 12925a4d6bfSDavid Schultz.Fn log2l , 13055265516SDavid Schultz.Fn log1p , 13125a4d6bfSDavid Schultz.Fn log1pf , 13255265516SDavid Schultzand 13325a4d6bfSDavid Schultz.Fn log1pl 13455265516SDavid Schultzfunctions conform to 13555265516SDavid Schultz.St -isoC-99 . 136*8e76d790SSergio Carlavilla Delgado.Sh HISTORY 137*8e76d790SSergio Carlavilla DelgadoThe 138*8e76d790SSergio Carlavilla Delgado.Fn log 139*8e76d790SSergio Carlavilla Delgadofunction first appeared in 140*8e76d790SSergio Carlavilla Delgado.At v1 ; 141*8e76d790SSergio Carlavilla Delgado.Fn log10 142*8e76d790SSergio Carlavilla Delgadoin 143*8e76d790SSergio Carlavilla Delgado.At v7 ; 144*8e76d790SSergio Carlavilla Delgado.Fn log1p 145*8e76d790SSergio Carlavilla Delgadoin 146*8e76d790SSergio Carlavilla Delgado.Bx 4.3 . 147