bug500, discussion (missed optimization)

Percentage Accurate: 53.0% → 97.9%
Time: 7.2s
Alternatives: 9
Speedup: 19.3×

Specification

?
\[\begin{array}{l} \\ \log \left(\frac{\sinh x}{x}\right) \end{array} \]
(FPCore (x) :precision binary64 (log (/ (sinh x) x)))
double code(double x) {
	return log((sinh(x) / x));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = log((sinh(x) / x))
end function
public static double code(double x) {
	return Math.log((Math.sinh(x) / x));
}
def code(x):
	return math.log((math.sinh(x) / x))
function code(x)
	return log(Float64(sinh(x) / x))
end
function tmp = code(x)
	tmp = log((sinh(x) / x));
end
code[x_] := N[Log[N[(N[Sinh[x], $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\log \left(\frac{\sinh x}{x}\right)
\end{array}

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 9 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: 53.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \log \left(\frac{\sinh x}{x}\right) \end{array} \]
(FPCore (x) :precision binary64 (log (/ (sinh x) x)))
double code(double x) {
	return log((sinh(x) / x));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = log((sinh(x) / x))
end function
public static double code(double x) {
	return Math.log((Math.sinh(x) / x));
}
def code(x):
	return math.log((math.sinh(x) / x))
function code(x)
	return log(Float64(sinh(x) / x))
end
function tmp = code(x)
	tmp = log((sinh(x) / x));
end
code[x_] := N[Log[N[(N[Sinh[x], $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\log \left(\frac{\sinh x}{x}\right)
\end{array}

Alternative 1: 97.9% accurate, 0.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.086:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, -2.6455026455026456 \cdot 10^{-5}, 0.0003527336860670194\right) \cdot x\_m, x\_m, -0.005555555555555556\right) \cdot x\_m, x\_m, 0.16666666666666666\right) \cdot \left(x\_m \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{-1}{x\_m} \cdot \sinh \left(-x\_m\right)\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (if (<= x_m 0.086)
   (*
    (fma
     (*
      (fma
       (* (fma (* x_m x_m) -2.6455026455026456e-5 0.0003527336860670194) x_m)
       x_m
       -0.005555555555555556)
      x_m)
     x_m
     0.16666666666666666)
    (* x_m x_m))
   (log (* (/ -1.0 x_m) (sinh (- x_m))))))
x_m = fabs(x);
double code(double x_m) {
	double tmp;
	if (x_m <= 0.086) {
		tmp = fma((fma((fma((x_m * x_m), -2.6455026455026456e-5, 0.0003527336860670194) * x_m), x_m, -0.005555555555555556) * x_m), x_m, 0.16666666666666666) * (x_m * x_m);
	} else {
		tmp = log(((-1.0 / x_m) * sinh(-x_m)));
	}
	return tmp;
}
x_m = abs(x)
function code(x_m)
	tmp = 0.0
	if (x_m <= 0.086)
		tmp = Float64(fma(Float64(fma(Float64(fma(Float64(x_m * x_m), -2.6455026455026456e-5, 0.0003527336860670194) * x_m), x_m, -0.005555555555555556) * x_m), x_m, 0.16666666666666666) * Float64(x_m * x_m));
	else
		tmp = log(Float64(Float64(-1.0 / x_m) * sinh(Float64(-x_m))));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := If[LessEqual[x$95$m, 0.086], N[(N[(N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * -2.6455026455026456e-5 + 0.0003527336860670194), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m + -0.005555555555555556), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m + 0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], N[Log[N[(N[(-1.0 / x$95$m), $MachinePrecision] * N[Sinh[(-x$95$m)], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 0.086:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, -2.6455026455026456 \cdot 10^{-5}, 0.0003527336860670194\right) \cdot x\_m, x\_m, -0.005555555555555556\right) \cdot x\_m, x\_m, 0.16666666666666666\right) \cdot \left(x\_m \cdot x\_m\right)\\

\mathbf{else}:\\
\;\;\;\;\log \left(\frac{-1}{x\_m} \cdot \sinh \left(-x\_m\right)\right)\\


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

    1. Initial program 53.4%

      \[\log \left(\frac{\sinh x}{x}\right) \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
    4. Applied rewrites99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x \cdot x, 0.0003527336860670194\right) \cdot x\right) \cdot x - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot \left(x \cdot x\right)} \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(\frac{-1}{37800}, x \cdot x, \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      2. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(\frac{-1}{37800}, x \cdot x, \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(\frac{-1}{37800}, x \cdot x, \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      4. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      5. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot {x}^{2} + \frac{1}{6}\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
      9. pow2N/A

        \[\leadsto \left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      10. associate-*r*N/A

        \[\leadsto \left(\left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot x\right) \cdot x + \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      11. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot x, x, \frac{1}{6}\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
    6. Applied rewrites99.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -2.6455026455026456 \cdot 10^{-5}, 0.0003527336860670194\right) \cdot x, x, -0.005555555555555556\right) \cdot x, x, 0.16666666666666666\right) \cdot \left(\color{blue}{x} \cdot x\right) \]

    if 0.085999999999999993 < x

    1. Initial program 42.4%

      \[\log \left(\frac{\sinh x}{x}\right) \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{\log \left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right) + \log \left(\frac{-1}{x}\right)} \]
    3. Step-by-step derivation
      1. sum-logN/A

        \[\leadsto \log \left(\left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right) \cdot \frac{-1}{x}\right) \]
      2. lower-log.f64N/A

        \[\leadsto \log \left(\left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right) \cdot \frac{-1}{x}\right) \]
      3. *-commutativeN/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right)\right) \]
      5. lower-/.f64N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(e^{x} - \frac{1}{e^{x}}\right)\right)\right) \]
      7. rec-expN/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(e^{x} - e^{\mathsf{neg}\left(x\right)}\right)\right)\right) \]
      8. sinh-undefN/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(2 \cdot \sinh x\right)\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(2 \cdot \sinh x\right)\right)\right) \]
      10. lift-sinh.f6442.4

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(-0.5 \cdot \left(2 \cdot \sinh x\right)\right)\right) \]
    4. Applied rewrites42.4%

      \[\leadsto \color{blue}{\log \left(\frac{-1}{x} \cdot \left(-0.5 \cdot \left(2 \cdot \sinh x\right)\right)\right)} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(2 \cdot \sinh x\right)\right)\right) \]
      3. lift-sinh.f64N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\frac{-1}{2} \cdot \left(2 \cdot \sinh x\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\left(\frac{-1}{2} \cdot 2\right) \cdot \sinh x\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(-1 \cdot \sinh x\right)\right) \]
      6. mul-1-negN/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \left(\mathsf{neg}\left(\sinh x\right)\right)\right) \]
      7. sinh-neg-revN/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \sinh \left(\mathsf{neg}\left(x\right)\right)\right) \]
      8. lower-sinh.f64N/A

        \[\leadsto \log \left(\frac{-1}{x} \cdot \sinh \left(\mathsf{neg}\left(x\right)\right)\right) \]
      9. lower-neg.f6442.4

        \[\leadsto \log \left(\frac{-1}{x} \cdot \sinh \left(-x\right)\right) \]
    6. Applied rewrites42.4%

      \[\leadsto \log \left(\frac{-1}{x} \cdot \sinh \left(-x\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.9% accurate, 1.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.086:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, -2.6455026455026456 \cdot 10^{-5}, 0.0003527336860670194\right) \cdot x\_m, x\_m, -0.005555555555555556\right) \cdot x\_m, x\_m, 0.16666666666666666\right) \cdot \left(x\_m \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{\sinh x\_m}{x\_m}\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (if (<= x_m 0.086)
   (*
    (fma
     (*
      (fma
       (* (fma (* x_m x_m) -2.6455026455026456e-5 0.0003527336860670194) x_m)
       x_m
       -0.005555555555555556)
      x_m)
     x_m
     0.16666666666666666)
    (* x_m x_m))
   (log (/ (sinh x_m) x_m))))
x_m = fabs(x);
double code(double x_m) {
	double tmp;
	if (x_m <= 0.086) {
		tmp = fma((fma((fma((x_m * x_m), -2.6455026455026456e-5, 0.0003527336860670194) * x_m), x_m, -0.005555555555555556) * x_m), x_m, 0.16666666666666666) * (x_m * x_m);
	} else {
		tmp = log((sinh(x_m) / x_m));
	}
	return tmp;
}
x_m = abs(x)
function code(x_m)
	tmp = 0.0
	if (x_m <= 0.086)
		tmp = Float64(fma(Float64(fma(Float64(fma(Float64(x_m * x_m), -2.6455026455026456e-5, 0.0003527336860670194) * x_m), x_m, -0.005555555555555556) * x_m), x_m, 0.16666666666666666) * Float64(x_m * x_m));
	else
		tmp = log(Float64(sinh(x_m) / x_m));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := If[LessEqual[x$95$m, 0.086], N[(N[(N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * -2.6455026455026456e-5 + 0.0003527336860670194), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m + -0.005555555555555556), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m + 0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], N[Log[N[(N[Sinh[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 0.086:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, -2.6455026455026456 \cdot 10^{-5}, 0.0003527336860670194\right) \cdot x\_m, x\_m, -0.005555555555555556\right) \cdot x\_m, x\_m, 0.16666666666666666\right) \cdot \left(x\_m \cdot x\_m\right)\\

\mathbf{else}:\\
\;\;\;\;\log \left(\frac{\sinh x\_m}{x\_m}\right)\\


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

    1. Initial program 53.4%

      \[\log \left(\frac{\sinh x}{x}\right) \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
    4. Applied rewrites99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x \cdot x, 0.0003527336860670194\right) \cdot x\right) \cdot x - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot \left(x \cdot x\right)} \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(\frac{-1}{37800}, x \cdot x, \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      2. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(\frac{-1}{37800}, x \cdot x, \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(\frac{-1}{37800}, x \cdot x, \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      4. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      5. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot {x}^{2} + \frac{1}{6}\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
      9. pow2N/A

        \[\leadsto \left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      10. associate-*r*N/A

        \[\leadsto \left(\left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot x\right) \cdot x + \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
      11. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\left(\left(\frac{-1}{37800} \cdot \left(x \cdot x\right) + \frac{1}{2835}\right) \cdot x\right) \cdot x - \frac{1}{180}\right) \cdot x, x, \frac{1}{6}\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
    6. Applied rewrites99.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -2.6455026455026456 \cdot 10^{-5}, 0.0003527336860670194\right) \cdot x, x, -0.005555555555555556\right) \cdot x, x, 0.16666666666666666\right) \cdot \left(\color{blue}{x} \cdot x\right) \]

    if 0.085999999999999993 < x

    1. Initial program 42.4%

      \[\log \left(\frac{\sinh x}{x}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 97.1% accurate, 1.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\_m\\ \frac{\left({\left(t\_0 \cdot x\_m\right)}^{2} - 0.027777777777777776\right) \cdot x\_m}{\mathsf{fma}\left(t\_0, x\_m, -0.16666666666666666\right)} \cdot x\_m \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (let* ((t_0
         (*
          (fma (* x_m x_m) 0.0003527336860670194 -0.005555555555555556)
          x_m)))
   (*
    (/
     (* (- (pow (* t_0 x_m) 2.0) 0.027777777777777776) x_m)
     (fma t_0 x_m -0.16666666666666666))
    x_m)))
x_m = fabs(x);
double code(double x_m) {
	double t_0 = fma((x_m * x_m), 0.0003527336860670194, -0.005555555555555556) * x_m;
	return (((pow((t_0 * x_m), 2.0) - 0.027777777777777776) * x_m) / fma(t_0, x_m, -0.16666666666666666)) * x_m;
}
x_m = abs(x)
function code(x_m)
	t_0 = Float64(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556) * x_m)
	return Float64(Float64(Float64(Float64((Float64(t_0 * x_m) ^ 2.0) - 0.027777777777777776) * x_m) / fma(t_0, x_m, -0.16666666666666666)) * x_m)
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.0003527336860670194 + -0.005555555555555556), $MachinePrecision] * x$95$m), $MachinePrecision]}, N[(N[(N[(N[(N[Power[N[(t$95$0 * x$95$m), $MachinePrecision], 2.0], $MachinePrecision] - 0.027777777777777776), $MachinePrecision] * x$95$m), $MachinePrecision] / N[(t$95$0 * x$95$m + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\_m\\
\frac{\left({\left(t\_0 \cdot x\_m\right)}^{2} - 0.027777777777777776\right) \cdot x\_m}{\mathsf{fma}\left(t\_0, x\_m, -0.16666666666666666\right)} \cdot x\_m
\end{array}
\end{array}
Derivation
  1. Initial program 53.0%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)} \]
  3. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
    2. unpow2N/A

      \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
    3. associate-*r*N/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
    4. lower-*.f64N/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
    5. lower-*.f64N/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
    6. +-commutativeN/A

      \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    7. *-commutativeN/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2} + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    8. lower-fma.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    9. lower--.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    10. lower-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    11. unpow2N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    12. lower-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    13. unpow2N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    14. lower-*.f6497.0

      \[\leadsto \left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x \]
  4. Applied rewrites97.0%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    2. lift-fma.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    3. lift--.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    6. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    7. +-commutativeN/A

      \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x \]
    8. pow2N/A

      \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x \]
    9. pow2N/A

      \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2}\right) \cdot x\right) \cdot x \]
    10. *-commutativeN/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
    11. *-commutativeN/A

      \[\leadsto \left(x \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)\right) \cdot x \]
    12. +-commutativeN/A

      \[\leadsto \left(x \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right)\right) \cdot x \]
    13. distribute-rgt-inN/A

      \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x + \frac{1}{6} \cdot x\right) \cdot x \]
    14. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right), x, \frac{1}{6} \cdot x\right) \cdot x \]
  6. Applied rewrites97.0%

    \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x, x, 0.16666666666666666 \cdot x\right) \cdot x \]
  7. Applied rewrites97.1%

    \[\leadsto \frac{\left({\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x\right)}^{2} - 0.027777777777777776\right) \cdot x}{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x, x, -0.16666666666666666\right)} \cdot x \]
  8. Add Preprocessing

Alternative 4: 97.0% accurate, 3.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\_m\\ \frac{0.004629629629629629 \cdot x\_m}{\mathsf{fma}\left(t\_0 \cdot x\_m, \mathsf{fma}\left(t\_0, x\_m, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x\_m \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (let* ((t_0
         (*
          (fma (* x_m x_m) 0.0003527336860670194 -0.005555555555555556)
          x_m)))
   (*
    (/
     (* 0.004629629629629629 x_m)
     (fma (* t_0 x_m) (fma t_0 x_m -0.16666666666666666) 0.027777777777777776))
    x_m)))
x_m = fabs(x);
double code(double x_m) {
	double t_0 = fma((x_m * x_m), 0.0003527336860670194, -0.005555555555555556) * x_m;
	return ((0.004629629629629629 * x_m) / fma((t_0 * x_m), fma(t_0, x_m, -0.16666666666666666), 0.027777777777777776)) * x_m;
}
x_m = abs(x)
function code(x_m)
	t_0 = Float64(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556) * x_m)
	return Float64(Float64(Float64(0.004629629629629629 * x_m) / fma(Float64(t_0 * x_m), fma(t_0, x_m, -0.16666666666666666), 0.027777777777777776)) * x_m)
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.0003527336860670194 + -0.005555555555555556), $MachinePrecision] * x$95$m), $MachinePrecision]}, N[(N[(N[(0.004629629629629629 * x$95$m), $MachinePrecision] / N[(N[(t$95$0 * x$95$m), $MachinePrecision] * N[(t$95$0 * x$95$m + -0.16666666666666666), $MachinePrecision] + 0.027777777777777776), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\_m\\
\frac{0.004629629629629629 \cdot x\_m}{\mathsf{fma}\left(t\_0 \cdot x\_m, \mathsf{fma}\left(t\_0, x\_m, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x\_m
\end{array}
\end{array}
Derivation
  1. Initial program 53.0%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)} \]
  3. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
    2. unpow2N/A

      \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
    3. associate-*r*N/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
    4. lower-*.f64N/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
    5. lower-*.f64N/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
    6. +-commutativeN/A

      \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    7. *-commutativeN/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2} + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    8. lower-fma.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    9. lower--.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    10. lower-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    11. unpow2N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    12. lower-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    13. unpow2N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    14. lower-*.f6497.0

      \[\leadsto \left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x \]
  4. Applied rewrites97.0%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
    2. lift-fma.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    3. lift--.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    6. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
    7. +-commutativeN/A

      \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x \]
    8. pow2N/A

      \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x \]
    9. pow2N/A

      \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2}\right) \cdot x\right) \cdot x \]
    10. *-commutativeN/A

      \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
    11. *-commutativeN/A

      \[\leadsto \left(x \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)\right) \cdot x \]
    12. +-commutativeN/A

      \[\leadsto \left(x \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right)\right) \cdot x \]
    13. distribute-rgt-inN/A

      \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x + \frac{1}{6} \cdot x\right) \cdot x \]
    14. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right), x, \frac{1}{6} \cdot x\right) \cdot x \]
  6. Applied rewrites97.0%

    \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x, x, 0.16666666666666666 \cdot x\right) \cdot x \]
  7. Applied rewrites97.1%

    \[\leadsto \frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right)\right)}^{3}, {x}^{6}, 0.004629629629629629\right) \cdot x}{\mathsf{fma}\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x, x, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x \]
  8. Taylor expanded in x around 0

    \[\leadsto \frac{\frac{1}{216} \cdot x}{\mathsf{fma}\left(\left(\mathsf{fma}\left(x \cdot x, \frac{1}{2835}, \frac{-1}{180}\right) \cdot x\right) \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{1}{2835}, \frac{-1}{180}\right) \cdot x, x, \frac{-1}{6}\right), \frac{1}{36}\right)} \cdot x \]
  9. Step-by-step derivation
    1. Applied rewrites97.0%

      \[\leadsto \frac{0.004629629629629629 \cdot x}{\mathsf{fma}\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x, x, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x \]
    2. Add Preprocessing

    Alternative 5: 97.0% accurate, 5.6× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \mathsf{fma}\left(\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\_m\right) \cdot x\_m, x\_m, 0.16666666666666666 \cdot x\_m\right) \cdot x\_m \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (*
      (fma
       (*
        (* (fma (* x_m x_m) 0.0003527336860670194 -0.005555555555555556) x_m)
        x_m)
       x_m
       (* 0.16666666666666666 x_m))
      x_m))
    x_m = fabs(x);
    double code(double x_m) {
    	return fma(((fma((x_m * x_m), 0.0003527336860670194, -0.005555555555555556) * x_m) * x_m), x_m, (0.16666666666666666 * x_m)) * x_m;
    }
    
    x_m = abs(x)
    function code(x_m)
    	return Float64(fma(Float64(Float64(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556) * x_m) * x_m), x_m, Float64(0.16666666666666666 * x_m)) * x_m)
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := N[(N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.0003527336860670194 + -0.005555555555555556), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m + N[(0.16666666666666666 * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \mathsf{fma}\left(\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\_m\right) \cdot x\_m, x\_m, 0.16666666666666666 \cdot x\_m\right) \cdot x\_m
    \end{array}
    
    Derivation
    1. Initial program 53.0%

      \[\log \left(\frac{\sinh x}{x}\right) \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
      2. unpow2N/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
      6. +-commutativeN/A

        \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      7. *-commutativeN/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2} + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      8. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      9. lower--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      10. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      11. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      12. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      13. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      14. lower-*.f6497.0

        \[\leadsto \left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x \]
    4. Applied rewrites97.0%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      2. lift-fma.f64N/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      3. lift--.f64N/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      4. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      5. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      6. lift-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      7. +-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}\right) \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x \]
      8. pow2N/A

        \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x \]
      9. pow2N/A

        \[\leadsto \left(\left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2}\right) \cdot x\right) \cdot x \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
      11. *-commutativeN/A

        \[\leadsto \left(x \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)\right) \cdot x \]
      12. +-commutativeN/A

        \[\leadsto \left(x \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right)\right) \cdot x \]
      13. distribute-rgt-inN/A

        \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x + \frac{1}{6} \cdot x\right) \cdot x \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right), x, \frac{1}{6} \cdot x\right) \cdot x \]
    6. Applied rewrites97.0%

      \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x, x, 0.16666666666666666 \cdot x\right) \cdot x \]
    7. Add Preprocessing

    Alternative 6: 97.0% accurate, 6.4× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right), x\_m \cdot x\_m, 0.16666666666666666\right) \cdot x\_m\right) \cdot x\_m \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (*
      (*
       (fma
        (fma (* x_m x_m) 0.0003527336860670194 -0.005555555555555556)
        (* x_m x_m)
        0.16666666666666666)
       x_m)
      x_m))
    x_m = fabs(x);
    double code(double x_m) {
    	return (fma(fma((x_m * x_m), 0.0003527336860670194, -0.005555555555555556), (x_m * x_m), 0.16666666666666666) * x_m) * x_m;
    }
    
    x_m = abs(x)
    function code(x_m)
    	return Float64(Float64(fma(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556), Float64(x_m * x_m), 0.16666666666666666) * x_m) * x_m)
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.0003527336860670194 + -0.005555555555555556), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right), x\_m \cdot x\_m, 0.16666666666666666\right) \cdot x\_m\right) \cdot x\_m
    \end{array}
    
    Derivation
    1. Initial program 53.0%

      \[\log \left(\frac{\sinh x}{x}\right) \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
      2. unpow2N/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot \color{blue}{x} \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{6} + {x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
      6. +-commutativeN/A

        \[\leadsto \left(\left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      7. *-commutativeN/A

        \[\leadsto \left(\left(\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2} + \frac{1}{6}\right) \cdot x\right) \cdot x \]
      8. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      9. lower--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      10. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      11. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      12. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      13. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      14. lower-*.f6497.0

        \[\leadsto \left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x \]
    4. Applied rewrites97.0%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.0003527336860670194 \cdot \left(x \cdot x\right) - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x} \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      2. lift-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      3. lift-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot \left(x \cdot x\right) - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      4. pow2N/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      5. metadata-evalN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180} \cdot 1, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      6. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{1}{2835} \cdot {x}^{2} + \left(\mathsf{neg}\left(\frac{1}{180}\right)\right) \cdot 1, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      7. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left({x}^{2} \cdot \frac{1}{2835} + \left(\mathsf{neg}\left(\frac{1}{180}\right)\right) \cdot 1, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      8. metadata-evalN/A

        \[\leadsto \left(\mathsf{fma}\left({x}^{2} \cdot \frac{1}{2835} + \frac{-1}{180} \cdot 1, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{fma}\left({x}^{2} \cdot \frac{1}{2835} + \frac{-1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      10. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left({x}^{2}, \frac{1}{2835}, \frac{-1}{180}\right), x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      11. pow2N/A

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{1}{2835}, \frac{-1}{180}\right), x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
      12. lift-*.f6497.0

        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right), x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x \]
    6. Applied rewrites97.0%

      \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right), x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot \color{blue}{x} \]
    7. Add Preprocessing

    Alternative 7: 96.6% accurate, 9.6× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \mathsf{fma}\left(-0.005555555555555556, x\_m \cdot x\_m, 0.16666666666666666\right) \cdot \left(x\_m \cdot x\_m\right) \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (* (fma -0.005555555555555556 (* x_m x_m) 0.16666666666666666) (* x_m x_m)))
    x_m = fabs(x);
    double code(double x_m) {
    	return fma(-0.005555555555555556, (x_m * x_m), 0.16666666666666666) * (x_m * x_m);
    }
    
    x_m = abs(x)
    function code(x_m)
    	return Float64(fma(-0.005555555555555556, Float64(x_m * x_m), 0.16666666666666666) * Float64(x_m * x_m))
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := N[(N[(-0.005555555555555556 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \mathsf{fma}\left(-0.005555555555555556, x\_m \cdot x\_m, 0.16666666666666666\right) \cdot \left(x\_m \cdot x\_m\right)
    \end{array}
    
    Derivation
    1. Initial program 53.0%

      \[\log \left(\frac{\sinh x}{x}\right) \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{6} + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{2835} + \frac{-1}{37800} \cdot {x}^{2}\right) - \frac{1}{180}\right)\right) \cdot \color{blue}{{x}^{2}} \]
    4. Applied rewrites96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x \cdot x, 0.0003527336860670194\right) \cdot x\right) \cdot x - 0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot \left(x \cdot x\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{fma}\left(\frac{-1}{180}, x \cdot x, \frac{1}{6}\right) \cdot \left(x \cdot x\right) \]
    6. Step-by-step derivation
      1. Applied rewrites96.6%

        \[\leadsto \mathsf{fma}\left(-0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot \left(x \cdot x\right) \]
      2. Add Preprocessing

      Alternative 8: 96.7% accurate, 9.6× speedup?

      \[\begin{array}{l} x_m = \left|x\right| \\ \left(\mathsf{fma}\left(-0.005555555555555556, x\_m \cdot x\_m, 0.16666666666666666\right) \cdot x\_m\right) \cdot x\_m \end{array} \]
      x_m = (fabs.f64 x)
      (FPCore (x_m)
       :precision binary64
       (* (* (fma -0.005555555555555556 (* x_m x_m) 0.16666666666666666) x_m) x_m))
      x_m = fabs(x);
      double code(double x_m) {
      	return (fma(-0.005555555555555556, (x_m * x_m), 0.16666666666666666) * x_m) * x_m;
      }
      
      x_m = abs(x)
      function code(x_m)
      	return Float64(Float64(fma(-0.005555555555555556, Float64(x_m * x_m), 0.16666666666666666) * x_m) * x_m)
      end
      
      x_m = N[Abs[x], $MachinePrecision]
      code[x$95$m_] := N[(N[(N[(-0.005555555555555556 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]
      
      \begin{array}{l}
      x_m = \left|x\right|
      
      \\
      \left(\mathsf{fma}\left(-0.005555555555555556, x\_m \cdot x\_m, 0.16666666666666666\right) \cdot x\_m\right) \cdot x\_m
      \end{array}
      
      Derivation
      1. Initial program 53.0%

        \[\log \left(\frac{\sinh x}{x}\right) \]
      2. Taylor expanded in x around 0

        \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right)} \]
      3. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right) \cdot \color{blue}{{x}^{2}} \]
        2. unpow2N/A

          \[\leadsto \left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
        3. associate-*r*N/A

          \[\leadsto \left(\left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right) \cdot x\right) \cdot \color{blue}{x} \]
        4. lower-*.f64N/A

          \[\leadsto \left(\left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right) \cdot x\right) \cdot \color{blue}{x} \]
        5. lower-*.f64N/A

          \[\leadsto \left(\left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right) \cdot x\right) \cdot x \]
        6. +-commutativeN/A

          \[\leadsto \left(\left(\frac{-1}{180} \cdot {x}^{2} + \frac{1}{6}\right) \cdot x\right) \cdot x \]
        7. lower-fma.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{180}, {x}^{2}, \frac{1}{6}\right) \cdot x\right) \cdot x \]
        8. unpow2N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{180}, x \cdot x, \frac{1}{6}\right) \cdot x\right) \cdot x \]
        9. lower-*.f6496.7

          \[\leadsto \left(\mathsf{fma}\left(-0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x \]
      4. Applied rewrites96.7%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.005555555555555556, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot x} \]
      5. Add Preprocessing

      Alternative 9: 96.5% accurate, 19.3× speedup?

      \[\begin{array}{l} x_m = \left|x\right| \\ \left(x\_m \cdot x\_m\right) \cdot 0.16666666666666666 \end{array} \]
      x_m = (fabs.f64 x)
      (FPCore (x_m) :precision binary64 (* (* x_m x_m) 0.16666666666666666))
      x_m = fabs(x);
      double code(double x_m) {
      	return (x_m * x_m) * 0.16666666666666666;
      }
      
      x_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x_m
          code = (x_m * x_m) * 0.16666666666666666d0
      end function
      
      x_m = Math.abs(x);
      public static double code(double x_m) {
      	return (x_m * x_m) * 0.16666666666666666;
      }
      
      x_m = math.fabs(x)
      def code(x_m):
      	return (x_m * x_m) * 0.16666666666666666
      
      x_m = abs(x)
      function code(x_m)
      	return Float64(Float64(x_m * x_m) * 0.16666666666666666)
      end
      
      x_m = abs(x);
      function tmp = code(x_m)
      	tmp = (x_m * x_m) * 0.16666666666666666;
      end
      
      x_m = N[Abs[x], $MachinePrecision]
      code[x$95$m_] := N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]
      
      \begin{array}{l}
      x_m = \left|x\right|
      
      \\
      \left(x\_m \cdot x\_m\right) \cdot 0.16666666666666666
      \end{array}
      
      Derivation
      1. Initial program 53.0%

        \[\log \left(\frac{\sinh x}{x}\right) \]
      2. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{1}{6} \cdot {x}^{2}} \]
      3. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto {x}^{2} \cdot \color{blue}{\frac{1}{6}} \]
        2. lower-*.f64N/A

          \[\leadsto {x}^{2} \cdot \color{blue}{\frac{1}{6}} \]
        3. unpow2N/A

          \[\leadsto \left(x \cdot x\right) \cdot \frac{1}{6} \]
        4. lower-*.f6496.5

          \[\leadsto \left(x \cdot x\right) \cdot 0.16666666666666666 \]
      4. Applied rewrites96.5%

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.16666666666666666} \]
      5. Add Preprocessing

      Developer Target 1: 97.9% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| < 0.085:\\ \;\;\;\;\left(x \cdot x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x \cdot x, 0.0003527336860670194\right), x \cdot x, -0.005555555555555556\right), x \cdot x, 0.16666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{\sinh x}{x}\right)\\ \end{array} \end{array} \]
      (FPCore (x)
       :precision binary64
       (if (< (fabs x) 0.085)
         (*
          (* x x)
          (fma
           (fma
            (fma -2.6455026455026456e-5 (* x x) 0.0003527336860670194)
            (* x x)
            -0.005555555555555556)
           (* x x)
           0.16666666666666666))
         (log (/ (sinh x) x))))
      double code(double x) {
      	double tmp;
      	if (fabs(x) < 0.085) {
      		tmp = (x * x) * fma(fma(fma(-2.6455026455026456e-5, (x * x), 0.0003527336860670194), (x * x), -0.005555555555555556), (x * x), 0.16666666666666666);
      	} else {
      		tmp = log((sinh(x) / x));
      	}
      	return tmp;
      }
      
      function code(x)
      	tmp = 0.0
      	if (abs(x) < 0.085)
      		tmp = Float64(Float64(x * x) * fma(fma(fma(-2.6455026455026456e-5, Float64(x * x), 0.0003527336860670194), Float64(x * x), -0.005555555555555556), Float64(x * x), 0.16666666666666666));
      	else
      		tmp = log(Float64(sinh(x) / x));
      	end
      	return tmp
      end
      
      code[x_] := If[Less[N[Abs[x], $MachinePrecision], 0.085], N[(N[(x * x), $MachinePrecision] * N[(N[(N[(-2.6455026455026456e-5 * N[(x * x), $MachinePrecision] + 0.0003527336860670194), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.005555555555555556), $MachinePrecision] * N[(x * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[Log[N[(N[Sinh[x], $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\left|x\right| < 0.085:\\
      \;\;\;\;\left(x \cdot x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x \cdot x, 0.0003527336860670194\right), x \cdot x, -0.005555555555555556\right), x \cdot x, 0.16666666666666666\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\log \left(\frac{\sinh x}{x}\right)\\
      
      
      \end{array}
      \end{array}
      

      Reproduce

      ?
      herbie shell --seed 2025093 
      (FPCore (x)
        :name "bug500, discussion (missed optimization)"
        :precision binary64
      
        :alt
        (! :herbie-platform default (if (< (fabs x) 17/200) (let ((x2 (* x x))) (* x2 (fma (fma (fma -1/37800 x2 1/2835) x2 -1/180) x2 1/6))) (log (/ (sinh x) x))))
      
        (log (/ (sinh x) x)))