logN

Retrieves the exponent part on the result of pow().

double
logN
(
double x
,
double y
)

Parameters

x
Type: double

The first pow() argument.

y
Type: double

The pow() result.

Return Value

Type: double

The exponent N that verifies y = pow(x, N).

Examples

1 import std.math;
2 double[] exps = [3, 1.4, 2.2, 0.0001, 0.9999];
3 foreach(e; exps)
4 {
5     double y = pow(0.5, e);
6     double n = logN(0.5, y);
7     assert(n.approxEqual(e));
8 }

Meta