Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Nov 2015 23:03:45 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Garrett Cooper <ngie@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r290605 - in head/lib/msun: . man
Message-ID:  <20151109223117.Y2340@besplex.bde.org>
In-Reply-To: <201511091040.tA9AeG0B038056@repo.freebsd.org>
References:  <201511091040.tA9AeG0B038056@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 9 Nov 2015, Garrett Cooper wrote:

> Log:
>  Document powl(3)

powl was garbage that was intentionally undocumented.  At least, I
intentionally ignored its non-documentation together with it.

> Modified: head/lib/msun/man/exp.3
> ==============================================================================
> --- head/lib/msun/man/exp.3	Mon Nov  9 10:35:33 2015	(r290604)
> +++ head/lib/msun/man/exp.3	Mon Nov  9 10:40:16 2015	(r290605)
> @@ -99,9 +102,10 @@ functions compute the value exp(x)\-1 ac
> .Fa x .
> .Pp
> The
> -.Fn pow
> +.Fn pow ,
> +.Fn powf ,
> and the
> -.Fn powf
> +.Fn powl
> functions compute the value
> of
> .Ar x

powl doesn't compute the value of .Ar x to the exponent .Ar y.  It computes
the value of (double)(.Ar x) to the exponent (double)(.Ar y), converted to
double.

> @@ -122,9 +126,10 @@ Otherwise the error in these functions i
> These functions will return the appropriate computation unless an error
> occurs or an argument is out of range.

powl() almost never returns the appropriate computation.  Its bugs are
most obvious when an argument is too large for double but not out of range.

> The functions
> -.Fn pow x y
> +.Fn pow x y ,
> +.Fn powf x y ,
> and
> -.Fn powf x y
> +.Fn powl x y
> raise an invalid exception and return an \*(Na if
> .Fa x
> < 0 and

I doubt that the rest of this section (about exception handling) is
correct for powl().

The section on errors wasn't changed since it uses generic pow().  It
claims that the error is generally less than 1 ulp.  But for powl(),
the error is generally more that 4096 ulps.  Much more when the
error exponentiates.  powf() and pow() do well to avoid exponentiation
of roundoff errors.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151109223117.Y2340>