bug500, discussion (missed optimization)

Percentage Accurate: 53.0% → 97.9%
Time: 7.8s
Alternatives: 9
Speedup: 3.2×

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.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.086:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x\_m \cdot x\_m, 0.0003527336860670194\right), x\_m \cdot x\_m, -0.005555555555555556\right) \cdot x\_m, x\_m, 0.16666666666666666\right) \cdot x\_m\right) \cdot x\_m\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1}{x\_m} \cdot \sinh 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 -2.6455026455026456e-5 (* x_m x_m) 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(-2.6455026455026456e-5, (x_m * x_m), 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(Float64(fma(Float64(fma(fma(-2.6455026455026456e-5, Float64(x_m * x_m), 0.0003527336860670194), Float64(x_m * x_m), -0.005555555555555556) * x_m), x_m, 0.16666666666666666) * x_m) * x_m);
	else
		tmp = log(Float64(Float64(1.0 / x_m) * sinh(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[(-2.6455026455026456e-5 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.0003527336860670194), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + -0.005555555555555556), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m + 0.16666666666666666), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $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:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x\_m \cdot x\_m, 0.0003527336860670194\right), x\_m \cdot x\_m, -0.005555555555555556\right) \cdot x\_m, x\_m, 0.16666666666666666\right) \cdot x\_m\right) \cdot x\_m\\

\mathbf{else}:\\
\;\;\;\;\log \left(\frac{1}{x\_m} \cdot \sinh 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(\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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. 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)} \]
    6. Step-by-step derivation
      1. log-divN/A

        \[\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) \]
      2. sinh-defN/A

        \[\leadsto {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. sinh-undef-revN/A

        \[\leadsto {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) \]
      4. *-commutativeN/A

        \[\leadsto {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) \]
      5. associate-/l*N/A

        \[\leadsto {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) \]
      6. metadata-evalN/A

        \[\leadsto {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) \]
      7. metadata-evalN/A

        \[\leadsto {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) \]
      8. associate-*l*N/A

        \[\leadsto {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) \]
      9. *-commutativeN/A

        \[\leadsto {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) \]
      10. *-rgt-identityN/A

        \[\leadsto {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) \]
      11. log-divN/A

        \[\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) \]
      12. associate-*r/N/A

        \[\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) \]
      13. *-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}} \]
      14. pow2N/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 \left(x \cdot \color{blue}{x}\right) \]
      15. associate-*r*N/A

        \[\leadsto \left(\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 x\right) \cdot \color{blue}{x} \]
    7. Applied rewrites99.7%

      \[\leadsto \color{blue}{\left(\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) \cdot x, x, 0.16666666666666666\right) \cdot x\right) \cdot x} \]

    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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(\frac{2 \cdot \sinh x}{2} \cdot \frac{1}{x}\right) \]
      11. sinh-undef-revN/A

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

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

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.032:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right), \left(x\_m \cdot x\_m\right) \cdot x\_m, 0.16666666666666666 \cdot x\_m\right) \cdot x\_m\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1}{x\_m} \cdot \sinh x\_m\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (if (<= x_m 0.032)
   (*
    (fma
     (fma (* x_m x_m) 0.0003527336860670194 -0.005555555555555556)
     (* (* x_m 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.032) {
		tmp = fma(fma((x_m * x_m), 0.0003527336860670194, -0.005555555555555556), ((x_m * 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.032)
		tmp = Float64(fma(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556), Float64(Float64(x_m * x_m) * x_m), Float64(0.16666666666666666 * x_m)) * x_m);
	else
		tmp = log(Float64(Float64(1.0 / x_m) * sinh(x_m)));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := If[LessEqual[x$95$m, 0.032], N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.0003527336860670194 + -0.005555555555555556), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision] + N[(0.16666666666666666 * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $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.032:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.0003527336860670194, -0.005555555555555556\right), \left(x\_m \cdot x\_m\right) \cdot x\_m, 0.16666666666666666 \cdot x\_m\right) \cdot x\_m\\

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


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

    1. Initial program 53.3%

      \[\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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-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 \]
      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(x \cdot \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)\right) \cdot x \]
      8. +-commutativeN/A

        \[\leadsto \left(x \cdot \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)\right) \cdot x \]
      9. pow2N/A

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

        \[\leadsto \left(x \cdot \left(\frac{1}{6} + \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right) \cdot {x}^{2}\right)\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. distribute-rgt-inN/A

        \[\leadsto \left(\frac{1}{6} \cdot x + \left({x}^{2} \cdot \left(\frac{1}{2835} \cdot {x}^{2} - \frac{1}{180}\right)\right) \cdot x\right) \cdot x \]
      13. +-commutativeN/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 \]
    6. Applied rewrites99.7%

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

    if 0.032000000000000001 < x

    1. Initial program 44.1%

      \[\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. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \log \left(\left(\left(2 \cdot \sinh x\right) \cdot \frac{1}{2}\right) \cdot \frac{1}{x}\right) \]
      10. lower-/.f6444.2

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(\frac{2 \cdot \sinh x}{2} \cdot \frac{1}{x}\right) \]
      11. sinh-undef-revN/A

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

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

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

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

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

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

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

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

Alternative 3: 97.9% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.032:\\ \;\;\;\;\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\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1}{x\_m} \cdot \sinh x\_m\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (if (<= x_m 0.032)
   (*
    (*
     (fma
      (fma (* x_m x_m) 0.0003527336860670194 -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.032) {
		tmp = (fma(fma((x_m * x_m), 0.0003527336860670194, -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.032)
		tmp = Float64(Float64(fma(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556), Float64(x_m * x_m), 0.16666666666666666) * x_m) * x_m);
	else
		tmp = log(Float64(Float64(1.0 / x_m) * sinh(x_m)));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := If[LessEqual[x$95$m, 0.032], 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], 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.032:\\
\;\;\;\;\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\\

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


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

    1. Initial program 53.3%

      \[\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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} \]

    if 0.032000000000000001 < x

    1. Initial program 44.1%

      \[\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. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \log \left(\left(\left(2 \cdot \sinh x\right) \cdot \frac{1}{2}\right) \cdot \frac{1}{x}\right) \]
      10. lower-/.f6444.2

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(\frac{2 \cdot \sinh x}{2} \cdot \frac{1}{x}\right) \]
      11. sinh-undef-revN/A

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

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

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

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

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

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

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

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

Alternative 4: 97.9% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.032:\\ \;\;\;\;\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\\ \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.032)
   (*
    (*
     (fma
      (fma (* x_m x_m) 0.0003527336860670194 -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.032) {
		tmp = (fma(fma((x_m * x_m), 0.0003527336860670194, -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.032)
		tmp = Float64(Float64(fma(fma(Float64(x_m * x_m), 0.0003527336860670194, -0.005555555555555556), Float64(x_m * x_m), 0.16666666666666666) * 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.032], 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], 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.032:\\
\;\;\;\;\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\\

\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.032000000000000001

    1. Initial program 53.3%

      \[\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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} \]

    if 0.032000000000000001 < x

    1. Initial program 44.1%

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

Alternative 5: 97.8% accurate, 0.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 0.0065:\\ \;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, -0.005555555555555556, 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.0065)
   (* (fma (* x_m x_m) -0.005555555555555556 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.0065) {
		tmp = fma((x_m * x_m), -0.005555555555555556, 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.0065)
		tmp = Float64(fma(Float64(x_m * x_m), -0.005555555555555556, 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.0065], N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * -0.005555555555555556 + 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.0065:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, -0.005555555555555556, 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.0064999999999999997

    1. Initial program 53.2%

      \[\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-*.f6499.7

        \[\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 rewrites99.7%

      \[\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. Applied rewrites99.7%

      \[\leadsto \frac{\left({\left(\left(\mathsf{fma}\left(x \cdot x, 0.0003527336860670194, -0.005555555555555556\right) \cdot x\right) \cdot x\right)}^{3} + 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), x \cdot x, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x \]
    6. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right)} \]
    7. 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. lower-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, -0.005555555555555556, 0.16666666666666666\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
    8. Applied rewrites99.7%

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

    if 0.0064999999999999997 < x

    1. Initial program 47.1%

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

Alternative 6: 96.6% accurate, 1.5× speedup?

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

\\
\mathsf{fma}\left(x\_m \cdot x\_m, -0.005555555555555556, 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(\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. 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)}^{3} + 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), x \cdot x, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x \]
  6. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{6} + \frac{-1}{180} \cdot {x}^{2}\right)} \]
  7. 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. lower-*.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x \cdot x, -0.005555555555555556, 0.16666666666666666\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
  8. Applied rewrites96.6%

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

Alternative 7: 96.5% accurate, 2.2× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \frac{0.004629629629629629 \cdot x\_m}{0.027777777777777776} \cdot x\_m \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (* (/ (* 0.004629629629629629 x_m) 0.027777777777777776) x_m))
x_m = fabs(x);
double code(double x_m) {
	return ((0.004629629629629629 * x_m) / 0.027777777777777776) * x_m;
}
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 = ((0.004629629629629629d0 * x_m) / 0.027777777777777776d0) * x_m
end function
x_m = Math.abs(x);
public static double code(double x_m) {
	return ((0.004629629629629629 * x_m) / 0.027777777777777776) * x_m;
}
x_m = math.fabs(x)
def code(x_m):
	return ((0.004629629629629629 * x_m) / 0.027777777777777776) * x_m
x_m = abs(x)
function code(x_m)
	return Float64(Float64(Float64(0.004629629629629629 * x_m) / 0.027777777777777776) * x_m)
end
x_m = abs(x);
function tmp = code(x_m)
	tmp = ((0.004629629629629629 * x_m) / 0.027777777777777776) * x_m;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := N[(N[(N[(0.004629629629629629 * x$95$m), $MachinePrecision] / 0.027777777777777776), $MachinePrecision] * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

\\
\frac{0.004629629629629629 \cdot x\_m}{0.027777777777777776} \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. 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)}^{3} + 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), x \cdot x, -0.16666666666666666\right), 0.027777777777777776\right)} \cdot x \]
  6. Taylor expanded in x around 0

    \[\leadsto \frac{\left({\left(\left(\mathsf{fma}\left(x \cdot x, \frac{1}{2835}, \frac{-1}{180}\right) \cdot x\right) \cdot x\right)}^{3} + \frac{1}{216}\right) \cdot x}{\frac{1}{36}} \cdot x \]
  7. Step-by-step derivation
    1. Applied rewrites96.4%

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

      \[\leadsto \frac{\frac{1}{216} \cdot x}{\frac{1}{36}} \cdot x \]
    3. Step-by-step derivation
      1. Applied rewrites96.5%

        \[\leadsto \frac{0.004629629629629629 \cdot x}{0.027777777777777776} \cdot x \]
      2. Add Preprocessing

      Alternative 8: 96.5% accurate, 3.2× 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

      Alternative 9: 50.7% accurate, 3.3× speedup?

      \[\begin{array}{l} x_m = \left|x\right| \\ \log 1 \end{array} \]
      x_m = (fabs.f64 x)
      (FPCore (x_m) :precision binary64 (log 1.0))
      x_m = fabs(x);
      double code(double x_m) {
      	return log(1.0);
      }
      
      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 = log(1.0d0)
      end function
      
      x_m = Math.abs(x);
      public static double code(double x_m) {
      	return Math.log(1.0);
      }
      
      x_m = math.fabs(x)
      def code(x_m):
      	return math.log(1.0)
      
      x_m = abs(x)
      function code(x_m)
      	return log(1.0)
      end
      
      x_m = abs(x);
      function tmp = code(x_m)
      	tmp = log(1.0);
      end
      
      x_m = N[Abs[x], $MachinePrecision]
      code[x$95$m_] := N[Log[1.0], $MachinePrecision]
      
      \begin{array}{l}
      x_m = \left|x\right|
      
      \\
      \log 1
      \end{array}
      
      Derivation
      1. Initial program 53.0%

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

        \[\leadsto \log \color{blue}{1} \]
      3. Step-by-step derivation
        1. Applied rewrites50.7%

          \[\leadsto \log \color{blue}{1} \]
        2. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2025093 
        (FPCore (x)
          :name "bug500, discussion (missed optimization)"
          :precision binary64
          (log (/ (sinh x) x)))