Jmat.Real.lambertw, estimator

Percentage Accurate: 24.6% → 73.8%
Time: 2.9s
Alternatives: 7
Speedup: 1.1×

Specification

?
\[\log x - \log \log x \]
(FPCore (x)
  :precision binary64
  (- (log x) (log (log x))))
double code(double x) {
	return log(x) - log(log(x));
}
real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = log(x) - log(log(x))
end function
public static double code(double x) {
	return Math.log(x) - Math.log(Math.log(x));
}
def code(x):
	return math.log(x) - math.log(math.log(x))
function code(x)
	return Float64(log(x) - log(log(x)))
end
function tmp = code(x)
	tmp = log(x) - log(log(x));
end
code[x_] := N[(N[Log[x], $MachinePrecision] - N[Log[N[Log[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\log x - \log \log x

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 24.6% accurate, 1.0× speedup?

\[\log x - \log \log x \]
(FPCore (x)
  :precision binary64
  (- (log x) (log (log x))))
double code(double x) {
	return log(x) - log(log(x));
}
real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = log(x) - log(log(x))
end function
public static double code(double x) {
	return Math.log(x) - Math.log(Math.log(x));
}
def code(x):
	return math.log(x) - math.log(math.log(x))
function code(x)
	return Float64(log(x) - log(log(x)))
end
function tmp = code(x)
	tmp = log(x) - log(log(x));
end
code[x_] := N[(N[Log[x], $MachinePrecision] - N[Log[N[Log[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\log x - \log \log x

Alternative 1: 73.8% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \log \left(\left|x\right|\right)\\ t_1 := \left|t\_0 \cdot \left|x\right|\right|\\ t_2 := \log \left(\left|t\_0\right|\right)\\ \mathbf{if}\;\left|x\right| \leq 7.4 \cdot 10^{+133}:\\ \;\;\;\;\frac{{\log \left(\left|\left|x\right|\right|\right)}^{3} - {t\_2}^{3}}{\mathsf{fma}\left(\log \left(\left|\left|x\right| \cdot t\_0\right|\right), t\_2, \log \left({\left(\left|x\right|\right)}^{t\_0}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\log \left({t\_1}^{\left(\frac{\log \left(\left|\frac{\left|x\right|}{t\_0}\right|\right)}{\log t\_1}\right)}\right)\\ \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (log (fabs x)))
       (t_1 (fabs (* t_0 (fabs x))))
       (t_2 (log (fabs t_0))))
  (if (<= (fabs x) 7.4e+133)
    (/
     (- (pow (log (fabs (fabs x))) 3.0) (pow t_2 3.0))
     (fma (log (fabs (* (fabs x) t_0))) t_2 (log (pow (fabs x) t_0))))
    (log (pow t_1 (/ (log (fabs (/ (fabs x) t_0))) (log t_1)))))))
double code(double x) {
	double t_0 = log(fabs(x));
	double t_1 = fabs((t_0 * fabs(x)));
	double t_2 = log(fabs(t_0));
	double tmp;
	if (fabs(x) <= 7.4e+133) {
		tmp = (pow(log(fabs(fabs(x))), 3.0) - pow(t_2, 3.0)) / fma(log(fabs((fabs(x) * t_0))), t_2, log(pow(fabs(x), t_0)));
	} else {
		tmp = log(pow(t_1, (log(fabs((fabs(x) / t_0))) / log(t_1))));
	}
	return tmp;
}
function code(x)
	t_0 = log(abs(x))
	t_1 = abs(Float64(t_0 * abs(x)))
	t_2 = log(abs(t_0))
	tmp = 0.0
	if (abs(x) <= 7.4e+133)
		tmp = Float64(Float64((log(abs(abs(x))) ^ 3.0) - (t_2 ^ 3.0)) / fma(log(abs(Float64(abs(x) * t_0))), t_2, log((abs(x) ^ t_0))));
	else
		tmp = log((t_1 ^ Float64(log(abs(Float64(abs(x) / t_0))) / log(t_1))));
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Abs[t$95$0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 7.4e+133], N[(N[(N[Power[N[Log[N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[Log[N[Abs[N[(N[Abs[x], $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$2 + N[Log[N[Power[N[Abs[x], $MachinePrecision], t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[Power[t$95$1, N[(N[Log[N[Abs[N[(N[Abs[x], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Log[t$95$1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \log \left(\left|x\right|\right)\\
t_1 := \left|t\_0 \cdot \left|x\right|\right|\\
t_2 := \log \left(\left|t\_0\right|\right)\\
\mathbf{if}\;\left|x\right| \leq 7.4 \cdot 10^{+133}:\\
\;\;\;\;\frac{{\log \left(\left|\left|x\right|\right|\right)}^{3} - {t\_2}^{3}}{\mathsf{fma}\left(\log \left(\left|\left|x\right| \cdot t\_0\right|\right), t\_2, \log \left({\left(\left|x\right|\right)}^{t\_0}\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\log \left({t\_1}^{\left(\frac{\log \left(\left|\frac{\left|x\right|}{t\_0}\right|\right)}{\log t\_1}\right)}\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 7.4000000000000005e133

    1. Initial program 24.6%

      \[\log x - \log \log x \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\log x - \log \log x} \]
      2. lift-log.f64N/A

        \[\leadsto \color{blue}{\log x} - \log \log x \]
      3. lift-log.f64N/A

        \[\leadsto \log x - \color{blue}{\log \log x} \]
      4. diff-logN/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      6. lower-/.f6424.7%

        \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
    3. Applied rewrites24.7%

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    4. Applied rewrites25.1%

      \[\leadsto \color{blue}{\frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \color{blue}{\log x \cdot \log x}\right)} \]
      2. lift-log.f64N/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \color{blue}{\log x}\right)} \]
      3. log-pow-revN/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \color{blue}{\log \left({x}^{\log x}\right)}\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \color{blue}{\log \left({x}^{\log x}\right)}\right)} \]
      5. lower-pow.f6425.8%

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log \color{blue}{\left({x}^{\log x}\right)}\right)} \]
    6. Applied rewrites25.8%

      \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \color{blue}{\log \left({x}^{\log x}\right)}\right)} \]

    if 7.4000000000000005e133 < x

    1. Initial program 24.6%

      \[\log x - \log \log x \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\log x - \log \log x} \]
      2. lift-log.f64N/A

        \[\leadsto \color{blue}{\log x} - \log \log x \]
      3. lift-log.f64N/A

        \[\leadsto \log x - \color{blue}{\log \log x} \]
      4. diff-logN/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      6. lower-/.f6424.7%

        \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
    3. Applied rewrites24.7%

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    4. Applied rewrites25.1%

      \[\leadsto \color{blue}{\frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)}} \]
    5. Applied rewrites25.2%

      \[\leadsto \color{blue}{\frac{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}}{\log \left(\left|\log x \cdot x\right|\right)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{\log \left(\left|\log x \cdot x\right|\right) \cdot \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\log x \cdot x\right|\right)} \]
      5. lift-log.f64N/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \color{blue}{\log \left(\left|\log x \cdot x\right|\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{\log x \cdot x}\right|\right) \]
      7. *-commutativeN/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{x \cdot \log x}\right|\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{x \cdot \log x}\right|\right) \]
      9. log-pow-revN/A

        \[\leadsto \color{blue}{\log \left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
      10. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
      11. lower-pow.f64N/A

        \[\leadsto \log \color{blue}{\left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
    7. Applied rewrites25.2%

      \[\leadsto \color{blue}{\log \left({\left(\left|\log x \cdot x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 72.9% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \log \left(\left|x\right|\right)\\ t_1 := \left|t\_0 \cdot \left|x\right|\right|\\ t_2 := \log \left(\left|t\_0\right|\right)\\ \mathbf{if}\;\left|x\right| \leq 7.4 \cdot 10^{+133}:\\ \;\;\;\;\frac{{\log \left(\left|\left|x\right|\right|\right)}^{3} - {t\_2}^{3}}{\mathsf{fma}\left(\log \left(\left|\log \left({\left(\left|x\right|\right)}^{\left(\left|x\right|\right)}\right)\right|\right), t\_2, t\_0 \cdot t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\log \left({t\_1}^{\left(\frac{\log \left(\left|\frac{\left|x\right|}{t\_0}\right|\right)}{\log t\_1}\right)}\right)\\ \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (log (fabs x)))
       (t_1 (fabs (* t_0 (fabs x))))
       (t_2 (log (fabs t_0))))
  (if (<= (fabs x) 7.4e+133)
    (/
     (- (pow (log (fabs (fabs x))) 3.0) (pow t_2 3.0))
     (fma (log (fabs (log (pow (fabs x) (fabs x))))) t_2 (* t_0 t_0)))
    (log (pow t_1 (/ (log (fabs (/ (fabs x) t_0))) (log t_1)))))))
double code(double x) {
	double t_0 = log(fabs(x));
	double t_1 = fabs((t_0 * fabs(x)));
	double t_2 = log(fabs(t_0));
	double tmp;
	if (fabs(x) <= 7.4e+133) {
		tmp = (pow(log(fabs(fabs(x))), 3.0) - pow(t_2, 3.0)) / fma(log(fabs(log(pow(fabs(x), fabs(x))))), t_2, (t_0 * t_0));
	} else {
		tmp = log(pow(t_1, (log(fabs((fabs(x) / t_0))) / log(t_1))));
	}
	return tmp;
}
function code(x)
	t_0 = log(abs(x))
	t_1 = abs(Float64(t_0 * abs(x)))
	t_2 = log(abs(t_0))
	tmp = 0.0
	if (abs(x) <= 7.4e+133)
		tmp = Float64(Float64((log(abs(abs(x))) ^ 3.0) - (t_2 ^ 3.0)) / fma(log(abs(log((abs(x) ^ abs(x))))), t_2, Float64(t_0 * t_0)));
	else
		tmp = log((t_1 ^ Float64(log(abs(Float64(abs(x) / t_0))) / log(t_1))));
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Abs[t$95$0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 7.4e+133], N[(N[(N[Power[N[Log[N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[Log[N[Abs[N[Log[N[Power[N[Abs[x], $MachinePrecision], N[Abs[x], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$2 + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[Power[t$95$1, N[(N[Log[N[Abs[N[(N[Abs[x], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Log[t$95$1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \log \left(\left|x\right|\right)\\
t_1 := \left|t\_0 \cdot \left|x\right|\right|\\
t_2 := \log \left(\left|t\_0\right|\right)\\
\mathbf{if}\;\left|x\right| \leq 7.4 \cdot 10^{+133}:\\
\;\;\;\;\frac{{\log \left(\left|\left|x\right|\right|\right)}^{3} - {t\_2}^{3}}{\mathsf{fma}\left(\log \left(\left|\log \left({\left(\left|x\right|\right)}^{\left(\left|x\right|\right)}\right)\right|\right), t\_2, t\_0 \cdot t\_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\log \left({t\_1}^{\left(\frac{\log \left(\left|\frac{\left|x\right|}{t\_0}\right|\right)}{\log t\_1}\right)}\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 7.4000000000000005e133

    1. Initial program 24.6%

      \[\log x - \log \log x \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\log x - \log \log x} \]
      2. lift-log.f64N/A

        \[\leadsto \color{blue}{\log x} - \log \log x \]
      3. lift-log.f64N/A

        \[\leadsto \log x - \color{blue}{\log \log x} \]
      4. diff-logN/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      6. lower-/.f6424.7%

        \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
    3. Applied rewrites24.7%

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    4. Applied rewrites25.1%

      \[\leadsto \color{blue}{\frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|\color{blue}{x \cdot \log x}\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)} \]
      2. lift-log.f64N/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \color{blue}{\log x}\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)} \]
      3. log-pow-revN/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|\color{blue}{\log \left({x}^{x}\right)}\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|\color{blue}{\log \left({x}^{x}\right)}\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)} \]
      5. lower-pow.f6424.7%

        \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|\log \color{blue}{\left({x}^{x}\right)}\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)} \]
    6. Applied rewrites24.7%

      \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|\color{blue}{\log \left({x}^{x}\right)}\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)} \]

    if 7.4000000000000005e133 < x

    1. Initial program 24.6%

      \[\log x - \log \log x \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\log x - \log \log x} \]
      2. lift-log.f64N/A

        \[\leadsto \color{blue}{\log x} - \log \log x \]
      3. lift-log.f64N/A

        \[\leadsto \log x - \color{blue}{\log \log x} \]
      4. diff-logN/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      6. lower-/.f6424.7%

        \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
    3. Applied rewrites24.7%

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    4. Applied rewrites25.1%

      \[\leadsto \color{blue}{\frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)}} \]
    5. Applied rewrites25.2%

      \[\leadsto \color{blue}{\frac{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}}{\log \left(\left|\log x \cdot x\right|\right)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{\log \left(\left|\log x \cdot x\right|\right) \cdot \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\log x \cdot x\right|\right)} \]
      5. lift-log.f64N/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \color{blue}{\log \left(\left|\log x \cdot x\right|\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{\log x \cdot x}\right|\right) \]
      7. *-commutativeN/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{x \cdot \log x}\right|\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{x \cdot \log x}\right|\right) \]
      9. log-pow-revN/A

        \[\leadsto \color{blue}{\log \left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
      10. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
      11. lower-pow.f64N/A

        \[\leadsto \log \color{blue}{\left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
    7. Applied rewrites25.2%

      \[\leadsto \color{blue}{\log \left({\left(\left|\log x \cdot x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 50.7% accurate, 0.1× speedup?

\[\begin{array}{l} t_0 := \log \left(\left|x\right|\right)\\ t_1 := \log \left(\left|t\_0\right|\right)\\ t_2 := \left|\left|x\right|\right|\\ \mathbf{if}\;t\_0 - \log t\_0 \leq 654:\\ \;\;\;\;\log \left(\frac{\left|x\right|}{t\_0}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\log t\_2}^{3} - {t\_1}^{3}}{\mathsf{fma}\left(\log \left(\sqrt{t\_2}\right), \log \left(\left|x\right| \cdot \left|x\right|\right), \log \left(\left|t\_0 \cdot \left|x\right|\right|\right) \cdot t\_1\right)}\\ \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (log (fabs x)))
       (t_1 (log (fabs t_0)))
       (t_2 (fabs (fabs x))))
  (if (<= (- t_0 (log t_0)) 654.0)
    (log (/ (fabs x) t_0))
    (/
     (- (pow (log t_2) 3.0) (pow t_1 3.0))
     (fma
      (log (sqrt t_2))
      (log (* (fabs x) (fabs x)))
      (* (log (fabs (* t_0 (fabs x)))) t_1))))))
double code(double x) {
	double t_0 = log(fabs(x));
	double t_1 = log(fabs(t_0));
	double t_2 = fabs(fabs(x));
	double tmp;
	if ((t_0 - log(t_0)) <= 654.0) {
		tmp = log((fabs(x) / t_0));
	} else {
		tmp = (pow(log(t_2), 3.0) - pow(t_1, 3.0)) / fma(log(sqrt(t_2)), log((fabs(x) * fabs(x))), (log(fabs((t_0 * fabs(x)))) * t_1));
	}
	return tmp;
}
function code(x)
	t_0 = log(abs(x))
	t_1 = log(abs(t_0))
	t_2 = abs(abs(x))
	tmp = 0.0
	if (Float64(t_0 - log(t_0)) <= 654.0)
		tmp = log(Float64(abs(x) / t_0));
	else
		tmp = Float64(Float64((log(t_2) ^ 3.0) - (t_1 ^ 3.0)) / fma(log(sqrt(t_2)), log(Float64(abs(x) * abs(x))), Float64(log(abs(Float64(t_0 * abs(x)))) * t_1)));
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Abs[t$95$0], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Log[t$95$0], $MachinePrecision]), $MachinePrecision], 654.0], N[Log[N[(N[Abs[x], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision], N[(N[(N[Power[N[Log[t$95$2], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[Log[N[Sqrt[t$95$2], $MachinePrecision]], $MachinePrecision] * N[Log[N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[N[Abs[N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \log \left(\left|x\right|\right)\\
t_1 := \log \left(\left|t\_0\right|\right)\\
t_2 := \left|\left|x\right|\right|\\
\mathbf{if}\;t\_0 - \log t\_0 \leq 654:\\
\;\;\;\;\log \left(\frac{\left|x\right|}{t\_0}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{{\log t\_2}^{3} - {t\_1}^{3}}{\mathsf{fma}\left(\log \left(\sqrt{t\_2}\right), \log \left(\left|x\right| \cdot \left|x\right|\right), \log \left(\left|t\_0 \cdot \left|x\right|\right|\right) \cdot t\_1\right)}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (log.f64 x) (log.f64 (log.f64 x))) < 654

    1. Initial program 24.6%

      \[\log x - \log \log x \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\log x - \log \log x} \]
      2. lift-log.f64N/A

        \[\leadsto \color{blue}{\log x} - \log \log x \]
      3. lift-log.f64N/A

        \[\leadsto \log x - \color{blue}{\log \log x} \]
      4. diff-logN/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      6. lower-/.f6424.7%

        \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
    3. Applied rewrites24.7%

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]

    if 654 < (-.f64 (log.f64 x) (log.f64 (log.f64 x)))

    1. Initial program 24.6%

      \[\log x - \log \log x \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\log x - \log \log x} \]
      2. lift-log.f64N/A

        \[\leadsto \color{blue}{\log x} - \log \log x \]
      3. lift-log.f64N/A

        \[\leadsto \log x - \color{blue}{\log \log x} \]
      4. diff-logN/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
      6. lower-/.f6424.7%

        \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
    3. Applied rewrites24.7%

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    4. Applied rewrites25.1%

      \[\leadsto \color{blue}{\frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)}} \]
    5. Applied rewrites25.0%

      \[\leadsto \frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\color{blue}{\mathsf{fma}\left(\log \left(\sqrt{\left|x\right|}\right), \log \left(x \cdot x\right), \log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\log x\right|\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 27.0% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \log \left(\left|x\right|\right)\\ t_1 := \left|t\_0 \cdot \left|x\right|\right|\\ \log \left({t\_1}^{\left(\frac{\log \left(\left|\frac{\left|x\right|}{t\_0}\right|\right)}{\log t\_1}\right)}\right) \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (log (fabs x))) (t_1 (fabs (* t_0 (fabs x)))))
  (log (pow t_1 (/ (log (fabs (/ (fabs x) t_0))) (log t_1))))))
double code(double x) {
	double t_0 = log(fabs(x));
	double t_1 = fabs((t_0 * fabs(x)));
	return log(pow(t_1, (log(fabs((fabs(x) / t_0))) / log(t_1))));
}
real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    t_0 = log(abs(x))
    t_1 = abs((t_0 * abs(x)))
    code = log((t_1 ** (log(abs((abs(x) / t_0))) / log(t_1))))
end function
public static double code(double x) {
	double t_0 = Math.log(Math.abs(x));
	double t_1 = Math.abs((t_0 * Math.abs(x)));
	return Math.log(Math.pow(t_1, (Math.log(Math.abs((Math.abs(x) / t_0))) / Math.log(t_1))));
}
def code(x):
	t_0 = math.log(math.fabs(x))
	t_1 = math.fabs((t_0 * math.fabs(x)))
	return math.log(math.pow(t_1, (math.log(math.fabs((math.fabs(x) / t_0))) / math.log(t_1))))
function code(x)
	t_0 = log(abs(x))
	t_1 = abs(Float64(t_0 * abs(x)))
	return log((t_1 ^ Float64(log(abs(Float64(abs(x) / t_0))) / log(t_1))))
end
function tmp = code(x)
	t_0 = log(abs(x));
	t_1 = abs((t_0 * abs(x)));
	tmp = log((t_1 ^ (log(abs((abs(x) / t_0))) / log(t_1))));
end
code[x_] := Block[{t$95$0 = N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Log[N[Power[t$95$1, N[(N[Log[N[Abs[N[(N[Abs[x], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Log[t$95$1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_0 := \log \left(\left|x\right|\right)\\
t_1 := \left|t\_0 \cdot \left|x\right|\right|\\
\log \left({t\_1}^{\left(\frac{\log \left(\left|\frac{\left|x\right|}{t\_0}\right|\right)}{\log t\_1}\right)}\right)
\end{array}
Derivation
  1. Initial program 24.6%

    \[\log x - \log \log x \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\log x - \log \log x} \]
    2. lift-log.f64N/A

      \[\leadsto \color{blue}{\log x} - \log \log x \]
    3. lift-log.f64N/A

      \[\leadsto \log x - \color{blue}{\log \log x} \]
    4. diff-logN/A

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    5. lower-log.f64N/A

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    6. lower-/.f6424.7%

      \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
  3. Applied rewrites24.7%

    \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
  4. Applied rewrites25.1%

    \[\leadsto \color{blue}{\frac{{\log \left(\left|x\right|\right)}^{3} - {\log \left(\left|\log x\right|\right)}^{3}}{\mathsf{fma}\left(\log \left(\left|x \cdot \log x\right|\right), \log \left(\left|\log x\right|\right), \log x \cdot \log x\right)}} \]
  5. Applied rewrites25.2%

    \[\leadsto \color{blue}{\frac{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\log \left(\left|\log x \cdot x\right|\right) \cdot \log \left(\left|\frac{x}{\log x}\right|\right)}}{\log \left(\left|\log x \cdot x\right|\right)} \]
    3. associate-/l*N/A

      \[\leadsto \color{blue}{\log \left(\left|\log x \cdot x\right|\right) \cdot \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\log x \cdot x\right|\right)} \]
    5. lift-log.f64N/A

      \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \color{blue}{\log \left(\left|\log x \cdot x\right|\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{\log x \cdot x}\right|\right) \]
    7. *-commutativeN/A

      \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{x \cdot \log x}\right|\right) \]
    8. lift-*.f64N/A

      \[\leadsto \frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)} \cdot \log \left(\left|\color{blue}{x \cdot \log x}\right|\right) \]
    9. log-pow-revN/A

      \[\leadsto \color{blue}{\log \left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
    10. lower-log.f64N/A

      \[\leadsto \color{blue}{\log \left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
    11. lower-pow.f64N/A

      \[\leadsto \log \color{blue}{\left({\left(\left|x \cdot \log x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
  7. Applied rewrites25.2%

    \[\leadsto \color{blue}{\log \left({\left(\left|\log x \cdot x\right|\right)}^{\left(\frac{\log \left(\left|\frac{x}{\log x}\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}\right)}\right)} \]
  8. Add Preprocessing

Alternative 5: 27.0% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \log \left(\left|x\right|\right)\\ t_1 := \log \left(\left|t\_0\right|\right)\\ \frac{t\_0 \cdot t\_0 - t\_1 \cdot t\_1}{\log \left(\left|t\_0 \cdot \left|x\right|\right|\right)} \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (log (fabs x))) (t_1 (log (fabs t_0))))
  (/ (- (* t_0 t_0) (* t_1 t_1)) (log (fabs (* t_0 (fabs x)))))))
double code(double x) {
	double t_0 = log(fabs(x));
	double t_1 = log(fabs(t_0));
	return ((t_0 * t_0) - (t_1 * t_1)) / log(fabs((t_0 * fabs(x))));
}
real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    t_0 = log(abs(x))
    t_1 = log(abs(t_0))
    code = ((t_0 * t_0) - (t_1 * t_1)) / log(abs((t_0 * abs(x))))
end function
public static double code(double x) {
	double t_0 = Math.log(Math.abs(x));
	double t_1 = Math.log(Math.abs(t_0));
	return ((t_0 * t_0) - (t_1 * t_1)) / Math.log(Math.abs((t_0 * Math.abs(x))));
}
def code(x):
	t_0 = math.log(math.fabs(x))
	t_1 = math.log(math.fabs(t_0))
	return ((t_0 * t_0) - (t_1 * t_1)) / math.log(math.fabs((t_0 * math.fabs(x))))
function code(x)
	t_0 = log(abs(x))
	t_1 = log(abs(t_0))
	return Float64(Float64(Float64(t_0 * t_0) - Float64(t_1 * t_1)) / log(abs(Float64(t_0 * abs(x)))))
end
function tmp = code(x)
	t_0 = log(abs(x));
	t_1 = log(abs(t_0));
	tmp = ((t_0 * t_0) - (t_1 * t_1)) / log(abs((t_0 * abs(x))));
end
code[x_] := Block[{t$95$0 = N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Abs[t$95$0], $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[Log[N[Abs[N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \log \left(\left|x\right|\right)\\
t_1 := \log \left(\left|t\_0\right|\right)\\
\frac{t\_0 \cdot t\_0 - t\_1 \cdot t\_1}{\log \left(\left|t\_0 \cdot \left|x\right|\right|\right)}
\end{array}
Derivation
  1. Initial program 24.6%

    \[\log x - \log \log x \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\log x - \log \log x} \]
    2. lift-log.f64N/A

      \[\leadsto \color{blue}{\log x} - \log \log x \]
    3. lift-log.f64N/A

      \[\leadsto \log x - \color{blue}{\log \log x} \]
    4. diff-logN/A

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    5. log-divN/A

      \[\leadsto \color{blue}{\log \left(\left|x\right|\right) - \log \left(\left|\log x\right|\right)} \]
    6. diff-logN/A

      \[\leadsto \color{blue}{\log \left(\frac{\left|x\right|}{\left|\log x\right|}\right)} \]
    7. lower-log.f64N/A

      \[\leadsto \color{blue}{\log \left(\frac{\left|x\right|}{\left|\log x\right|}\right)} \]
    8. div-fabsN/A

      \[\leadsto \log \color{blue}{\left(\left|\frac{x}{\log x}\right|\right)} \]
    9. lower-fabs.f64N/A

      \[\leadsto \log \color{blue}{\left(\left|\frac{x}{\log x}\right|\right)} \]
    10. lower-/.f6425.5%

      \[\leadsto \log \left(\left|\color{blue}{\frac{x}{\log x}}\right|\right) \]
  3. Applied rewrites25.5%

    \[\leadsto \color{blue}{\log \left(\left|\frac{x}{\log x}\right|\right)} \]
  4. Step-by-step derivation
    1. lift-log.f64N/A

      \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log x}}\right|\right) \]
    2. *-rgt-identityN/A

      \[\leadsto \log \left(\left|\frac{x}{\log \color{blue}{\left(x \cdot 1\right)}}\right|\right) \]
    3. log-prodN/A

      \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right) + \log \left(\left|1\right|\right)}}\right|\right) \]
    4. lift-fabs.f64N/A

      \[\leadsto \log \left(\left|\frac{x}{\log \color{blue}{\left(\left|x\right|\right)} + \log \left(\left|1\right|\right)}\right|\right) \]
    5. lift-log.f64N/A

      \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right)} + \log \left(\left|1\right|\right)}\right|\right) \]
    6. metadata-evalN/A

      \[\leadsto \log \left(\left|\frac{x}{\log \left(\left|x\right|\right) + \log \color{blue}{1}}\right|\right) \]
    7. metadata-evalN/A

      \[\leadsto \log \left(\left|\frac{x}{\log \left(\left|x\right|\right) + \color{blue}{0}}\right|\right) \]
    8. lower-+.f6427.0%

      \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right) + 0}}\right|\right) \]
  5. Applied rewrites27.0%

    \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right) + 0}}\right|\right) \]
  6. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right) + 0}}\right|\right) \]
    2. +-rgt-identity27.0%

      \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right)}}\right|\right) \]
  7. Applied rewrites27.0%

    \[\leadsto \log \left(\left|\frac{x}{\color{blue}{\log \left(\left|x\right|\right)}}\right|\right) \]
  8. Applied rewrites25.0%

    \[\leadsto \color{blue}{\frac{\log x \cdot \log x - \log \left(\left|\log x\right|\right) \cdot \log \left(\left|\log x\right|\right)}{\log \left(\left|\log x \cdot x\right|\right)}} \]
  9. Add Preprocessing

Alternative 6: 26.8% accurate, 1.1× speedup?

\[\log \left(\left|\frac{\left|x\right|}{\log \left(\left|x\right|\right)}\right|\right) \]
(FPCore (x)
  :precision binary64
  (log (fabs (/ (fabs x) (log (fabs x))))))
double code(double x) {
	return log(fabs((fabs(x) / log(fabs(x)))));
}
real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = log(abs((abs(x) / log(abs(x)))))
end function
public static double code(double x) {
	return Math.log(Math.abs((Math.abs(x) / Math.log(Math.abs(x)))));
}
def code(x):
	return math.log(math.fabs((math.fabs(x) / math.log(math.fabs(x)))))
function code(x)
	return log(abs(Float64(abs(x) / log(abs(x)))))
end
function tmp = code(x)
	tmp = log(abs((abs(x) / log(abs(x)))));
end
code[x_] := N[Log[N[Abs[N[(N[Abs[x], $MachinePrecision] / N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\log \left(\left|\frac{\left|x\right|}{\log \left(\left|x\right|\right)}\right|\right)
Derivation
  1. Initial program 24.6%

    \[\log x - \log \log x \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\log x - \log \log x} \]
    2. lift-log.f64N/A

      \[\leadsto \color{blue}{\log x} - \log \log x \]
    3. lift-log.f64N/A

      \[\leadsto \log x - \color{blue}{\log \log x} \]
    4. diff-logN/A

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    5. log-divN/A

      \[\leadsto \color{blue}{\log \left(\left|x\right|\right) - \log \left(\left|\log x\right|\right)} \]
    6. diff-logN/A

      \[\leadsto \color{blue}{\log \left(\frac{\left|x\right|}{\left|\log x\right|}\right)} \]
    7. lower-log.f64N/A

      \[\leadsto \color{blue}{\log \left(\frac{\left|x\right|}{\left|\log x\right|}\right)} \]
    8. div-fabsN/A

      \[\leadsto \log \color{blue}{\left(\left|\frac{x}{\log x}\right|\right)} \]
    9. lower-fabs.f64N/A

      \[\leadsto \log \color{blue}{\left(\left|\frac{x}{\log x}\right|\right)} \]
    10. lower-/.f6425.5%

      \[\leadsto \log \left(\left|\color{blue}{\frac{x}{\log x}}\right|\right) \]
  3. Applied rewrites25.5%

    \[\leadsto \color{blue}{\log \left(\left|\frac{x}{\log x}\right|\right)} \]
  4. Add Preprocessing

Alternative 7: 25.4% accurate, 1.1× speedup?

\[\log \left(\frac{\left|x\right|}{\log \left(\left|x\right|\right)}\right) \]
(FPCore (x)
  :precision binary64
  (log (/ (fabs x) (log (fabs x)))))
double code(double x) {
	return log((fabs(x) / log(fabs(x))));
}
real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = log((abs(x) / log(abs(x))))
end function
public static double code(double x) {
	return Math.log((Math.abs(x) / Math.log(Math.abs(x))));
}
def code(x):
	return math.log((math.fabs(x) / math.log(math.fabs(x))))
function code(x)
	return log(Float64(abs(x) / log(abs(x))))
end
function tmp = code(x)
	tmp = log((abs(x) / log(abs(x))));
end
code[x_] := N[Log[N[(N[Abs[x], $MachinePrecision] / N[Log[N[Abs[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(\frac{\left|x\right|}{\log \left(\left|x\right|\right)}\right)
Derivation
  1. Initial program 24.6%

    \[\log x - \log \log x \]
  2. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{\log x - \log \log x} \]
    2. lift-log.f64N/A

      \[\leadsto \color{blue}{\log x} - \log \log x \]
    3. lift-log.f64N/A

      \[\leadsto \log x - \color{blue}{\log \log x} \]
    4. diff-logN/A

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    5. lower-log.f64N/A

      \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
    6. lower-/.f6424.7%

      \[\leadsto \log \color{blue}{\left(\frac{x}{\log x}\right)} \]
  3. Applied rewrites24.7%

    \[\leadsto \color{blue}{\log \left(\frac{x}{\log x}\right)} \]
  4. Add Preprocessing

Reproduce

?
herbie shell --seed 2025313 -o setup:search
(FPCore (x)
  :name "Jmat.Real.lambertw, estimator"
  :precision binary64
  (- (log x) (log (log x))))