Falkner and Boettcher, Appendix A

Percentage Accurate: 90.6% → 97.8%
Time: 8.2s
Alternatives: 11
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}

Sampling outcomes in binary64 precision:

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

\[\begin{array}{l} \\ \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}

Alternative 1: 97.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 0.00049:\\ \;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{{k}^{\left(-m\right)} \cdot 1}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m 0.00049)
   (* (/ (pow k m) (fma (+ k 10.0) k 1.0)) a)
   (/ a (* (pow k (- m)) 1.0))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= 0.00049) {
		tmp = (pow(k, m) / fma((k + 10.0), k, 1.0)) * a;
	} else {
		tmp = a / (pow(k, -m) * 1.0);
	}
	return tmp;
}
function code(a, k, m)
	tmp = 0.0
	if (m <= 0.00049)
		tmp = Float64(Float64((k ^ m) / fma(Float64(k + 10.0), k, 1.0)) * a);
	else
		tmp = Float64(a / Float64((k ^ Float64(-m)) * 1.0));
	end
	return tmp
end
code[a_, k_, m_] := If[LessEqual[m, 0.00049], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k + 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(a / N[(N[Power[k, (-m)], $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.00049:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a\\

\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)} \cdot 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < 4.8999999999999998e-4

    1. Initial program 98.3%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
      6. lower-/.f6498.3

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
      7. lift-+.f64N/A

        \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
      8. +-commutativeN/A

        \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
      9. lift-+.f64N/A

        \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
      10. +-commutativeN/A

        \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
      11. associate-+r+N/A

        \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
      12. lift-*.f64N/A

        \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
      13. lift-*.f64N/A

        \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
      14. distribute-rgt-outN/A

        \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
      15. +-commutativeN/A

        \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
      16. *-commutativeN/A

        \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
      17. lower-fma.f64N/A

        \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
      18. +-commutativeN/A

        \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
      19. lower-+.f6498.3

        \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
    4. Applied rewrites98.3%

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]

    if 4.8999999999999998e-4 < m

    1. Initial program 69.6%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1}} \]
    4. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1}} \]
      2. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \frac{a \cdot \color{blue}{{k}^{m}}}{1} \]
        2. pow-to-expN/A

          \[\leadsto \frac{a \cdot \color{blue}{e^{\log k \cdot m}}}{1} \]
        3. lift-log.f64N/A

          \[\leadsto \frac{a \cdot e^{\color{blue}{\log k} \cdot m}}{1} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{a \cdot e^{\color{blue}{\log k \cdot m}}}{1} \]
        5. sinh-+-cosh-revN/A

          \[\leadsto \frac{a \cdot \color{blue}{\left(\cosh \left(\log k \cdot m\right) + \sinh \left(\log k \cdot m\right)\right)}}{1} \]
        6. lift-cosh.f64N/A

          \[\leadsto \frac{a \cdot \left(\color{blue}{\cosh \left(\log k \cdot m\right)} + \sinh \left(\log k \cdot m\right)\right)}{1} \]
        7. lift-sinh.f64N/A

          \[\leadsto \frac{a \cdot \left(\cosh \left(\log k \cdot m\right) + \color{blue}{\sinh \left(\log k \cdot m\right)}\right)}{1} \]
        8. flip-+N/A

          \[\leadsto \frac{a \cdot \color{blue}{\frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right)}}}{1} \]
        9. lift-cosh.f64N/A

          \[\leadsto \frac{a \cdot \frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\color{blue}{\cosh \left(\log k \cdot m\right)} - \sinh \left(\log k \cdot m\right)}}{1} \]
        10. lift-sinh.f64N/A

          \[\leadsto \frac{a \cdot \frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\cosh \left(\log k \cdot m\right) - \color{blue}{\sinh \left(\log k \cdot m\right)}}}{1} \]
        11. sinh---cosh-revN/A

          \[\leadsto \frac{a \cdot \frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\color{blue}{e^{\mathsf{neg}\left(\log k \cdot m\right)}}}}{1} \]
      3. Applied rewrites100.0%

        \[\leadsto \frac{a \cdot \color{blue}{\frac{1}{{k}^{\left(-m\right)}}}}{1} \]
      4. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{a \cdot \frac{1}{{k}^{\left(-m\right)}}}{1}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{a \cdot \frac{1}{{k}^{\left(-m\right)}}}}{1} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{a \cdot \color{blue}{\frac{1}{{k}^{\left(-m\right)}}}}{1} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\color{blue}{\frac{a \cdot 1}{{k}^{\left(-m\right)}}}}{1} \]
        5. *-rgt-identityN/A

          \[\leadsto \frac{\frac{\color{blue}{a}}{{k}^{\left(-m\right)}}}{1} \]
        6. associate-/l/N/A

          \[\leadsto \color{blue}{\frac{a}{{k}^{\left(-m\right)} \cdot 1}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{a}{{k}^{\left(-m\right)} \cdot 1}} \]
        8. lower-*.f64100.0

          \[\leadsto \frac{a}{\color{blue}{{k}^{\left(-m\right)} \cdot 1}} \]
      5. Applied rewrites100.0%

        \[\leadsto \color{blue}{\frac{a}{{k}^{\left(-m\right)} \cdot 1}} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification98.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq 0.00049:\\ \;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{{k}^{\left(-m\right)} \cdot 1}\\ \end{array} \]
    7. Add Preprocessing

    Alternative 2: 97.1% accurate, 1.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -7.5 \cdot 10^{-9}:\\ \;\;\;\;\frac{a}{{k}^{\left(-m\right)} \cdot 1}\\ \mathbf{elif}\;m \leq 1.75 \cdot 10^{-14}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;{k}^{m} \cdot a\\ \end{array} \end{array} \]
    (FPCore (a k m)
     :precision binary64
     (if (<= m -7.5e-9)
       (/ a (* (pow k (- m)) 1.0))
       (if (<= m 1.75e-14) (/ a (fma (+ 10.0 k) k 1.0)) (* (pow k m) a))))
    double code(double a, double k, double m) {
    	double tmp;
    	if (m <= -7.5e-9) {
    		tmp = a / (pow(k, -m) * 1.0);
    	} else if (m <= 1.75e-14) {
    		tmp = a / fma((10.0 + k), k, 1.0);
    	} else {
    		tmp = pow(k, m) * a;
    	}
    	return tmp;
    }
    
    function code(a, k, m)
    	tmp = 0.0
    	if (m <= -7.5e-9)
    		tmp = Float64(a / Float64((k ^ Float64(-m)) * 1.0));
    	elseif (m <= 1.75e-14)
    		tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0));
    	else
    		tmp = Float64((k ^ m) * a);
    	end
    	return tmp
    end
    
    code[a_, k_, m_] := If[LessEqual[m, -7.5e-9], N[(a / N[(N[Power[k, (-m)], $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.75e-14], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;m \leq -7.5 \cdot 10^{-9}:\\
    \;\;\;\;\frac{a}{{k}^{\left(-m\right)} \cdot 1}\\
    
    \mathbf{elif}\;m \leq 1.75 \cdot 10^{-14}:\\
    \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;{k}^{m} \cdot a\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if m < -7.49999999999999933e-9

      1. Initial program 100.0%

        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      2. Add Preprocessing
      3. Taylor expanded in k around 0

        \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1}} \]
      4. Step-by-step derivation
        1. Applied rewrites100.0%

          \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1}} \]
        2. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto \frac{a \cdot \color{blue}{{k}^{m}}}{1} \]
          2. pow-to-expN/A

            \[\leadsto \frac{a \cdot \color{blue}{e^{\log k \cdot m}}}{1} \]
          3. lift-log.f64N/A

            \[\leadsto \frac{a \cdot e^{\color{blue}{\log k} \cdot m}}{1} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{a \cdot e^{\color{blue}{\log k \cdot m}}}{1} \]
          5. sinh-+-cosh-revN/A

            \[\leadsto \frac{a \cdot \color{blue}{\left(\cosh \left(\log k \cdot m\right) + \sinh \left(\log k \cdot m\right)\right)}}{1} \]
          6. lift-cosh.f64N/A

            \[\leadsto \frac{a \cdot \left(\color{blue}{\cosh \left(\log k \cdot m\right)} + \sinh \left(\log k \cdot m\right)\right)}{1} \]
          7. lift-sinh.f64N/A

            \[\leadsto \frac{a \cdot \left(\cosh \left(\log k \cdot m\right) + \color{blue}{\sinh \left(\log k \cdot m\right)}\right)}{1} \]
          8. flip-+N/A

            \[\leadsto \frac{a \cdot \color{blue}{\frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right)}}}{1} \]
          9. lift-cosh.f64N/A

            \[\leadsto \frac{a \cdot \frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\color{blue}{\cosh \left(\log k \cdot m\right)} - \sinh \left(\log k \cdot m\right)}}{1} \]
          10. lift-sinh.f64N/A

            \[\leadsto \frac{a \cdot \frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\cosh \left(\log k \cdot m\right) - \color{blue}{\sinh \left(\log k \cdot m\right)}}}{1} \]
          11. sinh---cosh-revN/A

            \[\leadsto \frac{a \cdot \frac{\cosh \left(\log k \cdot m\right) \cdot \cosh \left(\log k \cdot m\right) - \sinh \left(\log k \cdot m\right) \cdot \sinh \left(\log k \cdot m\right)}{\color{blue}{e^{\mathsf{neg}\left(\log k \cdot m\right)}}}}{1} \]
        3. Applied rewrites100.0%

          \[\leadsto \frac{a \cdot \color{blue}{\frac{1}{{k}^{\left(-m\right)}}}}{1} \]
        4. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{a \cdot \frac{1}{{k}^{\left(-m\right)}}}{1}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{a \cdot \frac{1}{{k}^{\left(-m\right)}}}}{1} \]
          3. lift-/.f64N/A

            \[\leadsto \frac{a \cdot \color{blue}{\frac{1}{{k}^{\left(-m\right)}}}}{1} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\color{blue}{\frac{a \cdot 1}{{k}^{\left(-m\right)}}}}{1} \]
          5. *-rgt-identityN/A

            \[\leadsto \frac{\frac{\color{blue}{a}}{{k}^{\left(-m\right)}}}{1} \]
          6. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{a}{{k}^{\left(-m\right)} \cdot 1}} \]
          7. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a}{{k}^{\left(-m\right)} \cdot 1}} \]
          8. lower-*.f64100.0

            \[\leadsto \frac{a}{\color{blue}{{k}^{\left(-m\right)} \cdot 1}} \]
        5. Applied rewrites100.0%

          \[\leadsto \color{blue}{\frac{a}{{k}^{\left(-m\right)} \cdot 1}} \]

        if -7.49999999999999933e-9 < m < 1.7500000000000001e-14

        1. Initial program 96.3%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Add Preprocessing
        3. Taylor expanded in m around 0

          \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
          2. unpow2N/A

            \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
          3. distribute-rgt-inN/A

            \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
          4. +-commutativeN/A

            \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
          5. *-commutativeN/A

            \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
          6. lower-fma.f64N/A

            \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
          7. lower-+.f6496.3

            \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
        5. Applied rewrites96.3%

          \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]

        if 1.7500000000000001e-14 < m

        1. Initial program 70.0%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          6. lower-/.f6470.0

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
          7. lift-+.f64N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
          8. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
          9. lift-+.f64N/A

            \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
          10. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
          11. associate-+r+N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
          12. lift-*.f64N/A

            \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
          13. lift-*.f64N/A

            \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
          14. distribute-rgt-outN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
          15. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
          16. *-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
          17. lower-fma.f64N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
          18. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
          19. lower-+.f6470.0

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
        4. Applied rewrites70.0%

          \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
        5. Taylor expanded in k around 0

          \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
        6. Step-by-step derivation
          1. lower-pow.f64100.0

            \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
        7. Applied rewrites100.0%

          \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
      5. Recombined 3 regimes into one program.
      6. Final simplification98.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -7.5 \cdot 10^{-9}:\\ \;\;\;\;\frac{a}{{k}^{\left(-m\right)} \cdot 1}\\ \mathbf{elif}\;m \leq 1.75 \cdot 10^{-14}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;{k}^{m} \cdot a\\ \end{array} \]
      7. Add Preprocessing

      Alternative 3: 97.1% accurate, 1.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -7.5 \cdot 10^{-9} \lor \neg \left(m \leq 1.75 \cdot 10^{-14}\right):\\ \;\;\;\;{k}^{m} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \end{array} \end{array} \]
      (FPCore (a k m)
       :precision binary64
       (if (or (<= m -7.5e-9) (not (<= m 1.75e-14)))
         (* (pow k m) a)
         (/ a (fma (+ 10.0 k) k 1.0))))
      double code(double a, double k, double m) {
      	double tmp;
      	if ((m <= -7.5e-9) || !(m <= 1.75e-14)) {
      		tmp = pow(k, m) * a;
      	} else {
      		tmp = a / fma((10.0 + k), k, 1.0);
      	}
      	return tmp;
      }
      
      function code(a, k, m)
      	tmp = 0.0
      	if ((m <= -7.5e-9) || !(m <= 1.75e-14))
      		tmp = Float64((k ^ m) * a);
      	else
      		tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0));
      	end
      	return tmp
      end
      
      code[a_, k_, m_] := If[Or[LessEqual[m, -7.5e-9], N[Not[LessEqual[m, 1.75e-14]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;m \leq -7.5 \cdot 10^{-9} \lor \neg \left(m \leq 1.75 \cdot 10^{-14}\right):\\
      \;\;\;\;{k}^{m} \cdot a\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if m < -7.49999999999999933e-9 or 1.7500000000000001e-14 < m

        1. Initial program 85.1%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          6. lower-/.f6485.1

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
          7. lift-+.f64N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
          8. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
          9. lift-+.f64N/A

            \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
          10. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
          11. associate-+r+N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
          12. lift-*.f64N/A

            \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
          13. lift-*.f64N/A

            \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
          14. distribute-rgt-outN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
          15. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
          16. *-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
          17. lower-fma.f64N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
          18. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
          19. lower-+.f6485.1

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
        4. Applied rewrites85.1%

          \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
        5. Taylor expanded in k around 0

          \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
        6. Step-by-step derivation
          1. lower-pow.f64100.0

            \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
        7. Applied rewrites100.0%

          \[\leadsto \color{blue}{{k}^{m}} \cdot a \]

        if -7.49999999999999933e-9 < m < 1.7500000000000001e-14

        1. Initial program 96.3%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Add Preprocessing
        3. Taylor expanded in m around 0

          \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
          2. unpow2N/A

            \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
          3. distribute-rgt-inN/A

            \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
          4. +-commutativeN/A

            \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
          5. *-commutativeN/A

            \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
          6. lower-fma.f64N/A

            \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
          7. lower-+.f6496.3

            \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
        5. Applied rewrites96.3%

          \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification98.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -7.5 \cdot 10^{-9} \lor \neg \left(m \leq 1.75 \cdot 10^{-14}\right):\\ \;\;\;\;{k}^{m} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 4: 69.8% accurate, 1.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.21:\\ \;\;\;\;{\left(k \cdot k\right)}^{-1} \cdot a\\ \mathbf{elif}\;m \leq 0.39:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \end{array} \]
      (FPCore (a k m)
       :precision binary64
       (if (<= m -0.21)
         (* (pow (* k k) -1.0) a)
         (if (<= m 0.39) (/ a (fma (+ 10.0 k) k 1.0)) (* (* (* k a) k) 101.0))))
      double code(double a, double k, double m) {
      	double tmp;
      	if (m <= -0.21) {
      		tmp = pow((k * k), -1.0) * a;
      	} else if (m <= 0.39) {
      		tmp = a / fma((10.0 + k), k, 1.0);
      	} else {
      		tmp = ((k * a) * k) * 101.0;
      	}
      	return tmp;
      }
      
      function code(a, k, m)
      	tmp = 0.0
      	if (m <= -0.21)
      		tmp = Float64((Float64(k * k) ^ -1.0) * a);
      	elseif (m <= 0.39)
      		tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0));
      	else
      		tmp = Float64(Float64(Float64(k * a) * k) * 101.0);
      	end
      	return tmp
      end
      
      code[a_, k_, m_] := If[LessEqual[m, -0.21], N[(N[Power[N[(k * k), $MachinePrecision], -1.0], $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 0.39], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 101.0), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;m \leq -0.21:\\
      \;\;\;\;{\left(k \cdot k\right)}^{-1} \cdot a\\
      
      \mathbf{elif}\;m \leq 0.39:\\
      \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if m < -0.209999999999999992

        1. Initial program 100.0%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          6. lower-/.f64100.0

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
          7. lift-+.f64N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
          8. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
          9. lift-+.f64N/A

            \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
          10. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
          11. associate-+r+N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
          12. lift-*.f64N/A

            \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
          13. lift-*.f64N/A

            \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
          14. distribute-rgt-outN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
          15. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
          16. *-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
          17. lower-fma.f64N/A

            \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
          18. +-commutativeN/A

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
          19. lower-+.f64100.0

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
        4. Applied rewrites100.0%

          \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
        5. Taylor expanded in m around 0

          \[\leadsto \color{blue}{\frac{1}{1 + k \cdot \left(10 + k\right)}} \cdot a \]
        6. Step-by-step derivation
          1. distribute-rgt-inN/A

            \[\leadsto \frac{1}{1 + \color{blue}{\left(10 \cdot k + k \cdot k\right)}} \cdot a \]
          2. unpow2N/A

            \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \cdot a \]
          3. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{1 + \left(10 \cdot k + {k}^{2}\right)}} \cdot a \]
          4. unpow2N/A

            \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \cdot a \]
          5. distribute-rgt-inN/A

            \[\leadsto \frac{1}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \cdot a \]
          6. +-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \cdot a \]
          7. *-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
          8. lower-fma.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
          9. lower-+.f6433.2

            \[\leadsto \frac{1}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \cdot a \]
        7. Applied rewrites33.2%

          \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
        8. Taylor expanded in k around inf

          \[\leadsto \frac{1}{{k}^{\color{blue}{2}}} \cdot a \]
        9. Step-by-step derivation
          1. Applied rewrites60.2%

            \[\leadsto \frac{1}{k \cdot \color{blue}{k}} \cdot a \]

          if -0.209999999999999992 < m < 0.39000000000000001

          1. Initial program 96.4%

            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          2. Add Preprocessing
          3. Taylor expanded in m around 0

            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
            2. unpow2N/A

              \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
            3. distribute-rgt-inN/A

              \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
            4. +-commutativeN/A

              \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
            5. *-commutativeN/A

              \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
            6. lower-fma.f64N/A

              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
            7. lower-+.f6493.5

              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
          5. Applied rewrites93.5%

            \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]

          if 0.39000000000000001 < m

          1. Initial program 69.3%

            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          2. Add Preprocessing
          3. Taylor expanded in m around 0

            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
            2. unpow2N/A

              \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
            3. distribute-rgt-inN/A

              \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
            4. +-commutativeN/A

              \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
            5. *-commutativeN/A

              \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
            6. lower-fma.f64N/A

              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
            7. lower-+.f642.7

              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
          5. Applied rewrites2.7%

            \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
          6. Step-by-step derivation
            1. Applied rewrites1.3%

              \[\leadsto \frac{a}{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{-k}, \sqrt{-k}, 10\right), k, 1\right)} \]
            2. Taylor expanded in k around 0

              \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(-100 \cdot a + a \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) - 10 \cdot a\right)} \]
            3. Step-by-step derivation
              1. Applied rewrites33.8%

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, a \cdot -101, -10 \cdot a\right), \color{blue}{k}, a\right) \]
              2. Taylor expanded in k around inf

                \[\leadsto 101 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
              3. Step-by-step derivation
                1. Applied rewrites53.8%

                  \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 101 \]
              4. Recombined 3 regimes into one program.
              5. Final simplification68.3%

                \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.21:\\ \;\;\;\;{\left(k \cdot k\right)}^{-1} \cdot a\\ \mathbf{elif}\;m \leq 0.39:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \]
              6. Add Preprocessing

              Alternative 5: 72.2% accurate, 2.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.21:\\ \;\;\;\;\frac{\frac{\frac{99}{k} + -10}{k} + 1}{k \cdot k} \cdot a\\ \mathbf{elif}\;m \leq 0.39:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \end{array} \]
              (FPCore (a k m)
               :precision binary64
               (if (<= m -0.21)
                 (* (/ (+ (/ (+ (/ 99.0 k) -10.0) k) 1.0) (* k k)) a)
                 (if (<= m 0.39) (/ a (fma (+ 10.0 k) k 1.0)) (* (* (* k a) k) 101.0))))
              double code(double a, double k, double m) {
              	double tmp;
              	if (m <= -0.21) {
              		tmp = (((((99.0 / k) + -10.0) / k) + 1.0) / (k * k)) * a;
              	} else if (m <= 0.39) {
              		tmp = a / fma((10.0 + k), k, 1.0);
              	} else {
              		tmp = ((k * a) * k) * 101.0;
              	}
              	return tmp;
              }
              
              function code(a, k, m)
              	tmp = 0.0
              	if (m <= -0.21)
              		tmp = Float64(Float64(Float64(Float64(Float64(Float64(99.0 / k) + -10.0) / k) + 1.0) / Float64(k * k)) * a);
              	elseif (m <= 0.39)
              		tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0));
              	else
              		tmp = Float64(Float64(Float64(k * a) * k) * 101.0);
              	end
              	return tmp
              end
              
              code[a_, k_, m_] := If[LessEqual[m, -0.21], N[(N[(N[(N[(N[(N[(99.0 / k), $MachinePrecision] + -10.0), $MachinePrecision] / k), $MachinePrecision] + 1.0), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 0.39], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 101.0), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;m \leq -0.21:\\
              \;\;\;\;\frac{\frac{\frac{99}{k} + -10}{k} + 1}{k \cdot k} \cdot a\\
              
              \mathbf{elif}\;m \leq 0.39:\\
              \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if m < -0.209999999999999992

                1. Initial program 100.0%

                  \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                  2. lift-*.f64N/A

                    \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                  3. associate-/l*N/A

                    \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                  4. *-commutativeN/A

                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                  5. lower-*.f64N/A

                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                  6. lower-/.f64100.0

                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                  7. lift-+.f64N/A

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                  8. +-commutativeN/A

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
                  9. lift-+.f64N/A

                    \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
                  10. +-commutativeN/A

                    \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
                  11. associate-+r+N/A

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
                  12. lift-*.f64N/A

                    \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
                  13. lift-*.f64N/A

                    \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
                  14. distribute-rgt-outN/A

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
                  15. +-commutativeN/A

                    \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
                  16. *-commutativeN/A

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                  17. lower-fma.f64N/A

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                  18. +-commutativeN/A

                    \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                  19. lower-+.f64100.0

                    \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                4. Applied rewrites100.0%

                  \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
                5. Taylor expanded in m around 0

                  \[\leadsto \color{blue}{\frac{1}{1 + k \cdot \left(10 + k\right)}} \cdot a \]
                6. Step-by-step derivation
                  1. distribute-rgt-inN/A

                    \[\leadsto \frac{1}{1 + \color{blue}{\left(10 \cdot k + k \cdot k\right)}} \cdot a \]
                  2. unpow2N/A

                    \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \cdot a \]
                  3. lower-/.f64N/A

                    \[\leadsto \color{blue}{\frac{1}{1 + \left(10 \cdot k + {k}^{2}\right)}} \cdot a \]
                  4. unpow2N/A

                    \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \cdot a \]
                  5. distribute-rgt-inN/A

                    \[\leadsto \frac{1}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \cdot a \]
                  6. +-commutativeN/A

                    \[\leadsto \frac{1}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \cdot a \]
                  7. *-commutativeN/A

                    \[\leadsto \frac{1}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                  8. lower-fma.f64N/A

                    \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                  9. lower-+.f6433.2

                    \[\leadsto \frac{1}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \cdot a \]
                7. Applied rewrites33.2%

                  \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                8. Taylor expanded in k around inf

                  \[\leadsto \frac{\left(1 + \frac{99}{{k}^{2}}\right) - 10 \cdot \frac{1}{k}}{\color{blue}{{k}^{2}}} \cdot a \]
                9. Step-by-step derivation
                  1. Applied rewrites67.7%

                    \[\leadsto \frac{\frac{\frac{99}{k} + -10}{k} + 1}{\color{blue}{k \cdot k}} \cdot a \]

                  if -0.209999999999999992 < m < 0.39000000000000001

                  1. Initial program 96.4%

                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                  2. Add Preprocessing
                  3. Taylor expanded in m around 0

                    \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                  4. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                    2. unpow2N/A

                      \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                    3. distribute-rgt-inN/A

                      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                    4. +-commutativeN/A

                      \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                    5. *-commutativeN/A

                      \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                    6. lower-fma.f64N/A

                      \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                    7. lower-+.f6493.5

                      \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                  5. Applied rewrites93.5%

                    \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]

                  if 0.39000000000000001 < m

                  1. Initial program 69.3%

                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                  2. Add Preprocessing
                  3. Taylor expanded in m around 0

                    \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                  4. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                    2. unpow2N/A

                      \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                    3. distribute-rgt-inN/A

                      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                    4. +-commutativeN/A

                      \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                    5. *-commutativeN/A

                      \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                    6. lower-fma.f64N/A

                      \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                    7. lower-+.f642.7

                      \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                  5. Applied rewrites2.7%

                    \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                  6. Step-by-step derivation
                    1. Applied rewrites1.3%

                      \[\leadsto \frac{a}{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{-k}, \sqrt{-k}, 10\right), k, 1\right)} \]
                    2. Taylor expanded in k around 0

                      \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(-100 \cdot a + a \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) - 10 \cdot a\right)} \]
                    3. Step-by-step derivation
                      1. Applied rewrites33.8%

                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, a \cdot -101, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                      2. Taylor expanded in k around inf

                        \[\leadsto 101 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites53.8%

                          \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 101 \]
                      4. Recombined 3 regimes into one program.
                      5. Add Preprocessing

                      Alternative 6: 69.6% accurate, 4.1× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.21:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.39:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \end{array} \]
                      (FPCore (a k m)
                       :precision binary64
                       (if (<= m -0.21)
                         (/ a (* k k))
                         (if (<= m 0.39) (/ a (fma (+ 10.0 k) k 1.0)) (* (* (* k a) k) 101.0))))
                      double code(double a, double k, double m) {
                      	double tmp;
                      	if (m <= -0.21) {
                      		tmp = a / (k * k);
                      	} else if (m <= 0.39) {
                      		tmp = a / fma((10.0 + k), k, 1.0);
                      	} else {
                      		tmp = ((k * a) * k) * 101.0;
                      	}
                      	return tmp;
                      }
                      
                      function code(a, k, m)
                      	tmp = 0.0
                      	if (m <= -0.21)
                      		tmp = Float64(a / Float64(k * k));
                      	elseif (m <= 0.39)
                      		tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0));
                      	else
                      		tmp = Float64(Float64(Float64(k * a) * k) * 101.0);
                      	end
                      	return tmp
                      end
                      
                      code[a_, k_, m_] := If[LessEqual[m, -0.21], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.39], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 101.0), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;m \leq -0.21:\\
                      \;\;\;\;\frac{a}{k \cdot k}\\
                      
                      \mathbf{elif}\;m \leq 0.39:\\
                      \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if m < -0.209999999999999992

                        1. Initial program 100.0%

                          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                        2. Add Preprocessing
                        3. Taylor expanded in m around 0

                          \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        4. Step-by-step derivation
                          1. lower-/.f64N/A

                            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                          2. unpow2N/A

                            \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                          3. distribute-rgt-inN/A

                            \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                          4. +-commutativeN/A

                            \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                          5. *-commutativeN/A

                            \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                          6. lower-fma.f64N/A

                            \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                          7. lower-+.f6433.2

                            \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                        5. Applied rewrites33.2%

                          \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                        6. Taylor expanded in k around inf

                          \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                        7. Step-by-step derivation
                          1. Applied rewrites59.1%

                            \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]

                          if -0.209999999999999992 < m < 0.39000000000000001

                          1. Initial program 96.4%

                            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                          2. Add Preprocessing
                          3. Taylor expanded in m around 0

                            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                          4. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                            2. unpow2N/A

                              \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                            3. distribute-rgt-inN/A

                              \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                            4. +-commutativeN/A

                              \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                            5. *-commutativeN/A

                              \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                            6. lower-fma.f64N/A

                              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                            7. lower-+.f6493.5

                              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                          5. Applied rewrites93.5%

                            \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]

                          if 0.39000000000000001 < m

                          1. Initial program 69.3%

                            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                          2. Add Preprocessing
                          3. Taylor expanded in m around 0

                            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                          4. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                            2. unpow2N/A

                              \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                            3. distribute-rgt-inN/A

                              \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                            4. +-commutativeN/A

                              \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                            5. *-commutativeN/A

                              \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                            6. lower-fma.f64N/A

                              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                            7. lower-+.f642.7

                              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                          5. Applied rewrites2.7%

                            \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                          6. Step-by-step derivation
                            1. Applied rewrites1.3%

                              \[\leadsto \frac{a}{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{-k}, \sqrt{-k}, 10\right), k, 1\right)} \]
                            2. Taylor expanded in k around 0

                              \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(-100 \cdot a + a \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) - 10 \cdot a\right)} \]
                            3. Step-by-step derivation
                              1. Applied rewrites33.8%

                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, a \cdot -101, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                              2. Taylor expanded in k around inf

                                \[\leadsto 101 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites53.8%

                                  \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 101 \]
                              4. Recombined 3 regimes into one program.
                              5. Add Preprocessing

                              Alternative 7: 58.8% accurate, 4.5× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -7.2 \cdot 10^{-39}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.39:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \end{array} \]
                              (FPCore (a k m)
                               :precision binary64
                               (if (<= m -7.2e-39)
                                 (/ a (* k k))
                                 (if (<= m 0.39) (/ a (fma 10.0 k 1.0)) (* (* (* k a) k) 101.0))))
                              double code(double a, double k, double m) {
                              	double tmp;
                              	if (m <= -7.2e-39) {
                              		tmp = a / (k * k);
                              	} else if (m <= 0.39) {
                              		tmp = a / fma(10.0, k, 1.0);
                              	} else {
                              		tmp = ((k * a) * k) * 101.0;
                              	}
                              	return tmp;
                              }
                              
                              function code(a, k, m)
                              	tmp = 0.0
                              	if (m <= -7.2e-39)
                              		tmp = Float64(a / Float64(k * k));
                              	elseif (m <= 0.39)
                              		tmp = Float64(a / fma(10.0, k, 1.0));
                              	else
                              		tmp = Float64(Float64(Float64(k * a) * k) * 101.0);
                              	end
                              	return tmp
                              end
                              
                              code[a_, k_, m_] := If[LessEqual[m, -7.2e-39], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.39], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 101.0), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;m \leq -7.2 \cdot 10^{-39}:\\
                              \;\;\;\;\frac{a}{k \cdot k}\\
                              
                              \mathbf{elif}\;m \leq 0.39:\\
                              \;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if m < -7.2000000000000001e-39

                                1. Initial program 99.0%

                                  \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                2. Add Preprocessing
                                3. Taylor expanded in m around 0

                                  \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                4. Step-by-step derivation
                                  1. lower-/.f64N/A

                                    \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                  2. unpow2N/A

                                    \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                  3. distribute-rgt-inN/A

                                    \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                  4. +-commutativeN/A

                                    \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                  5. *-commutativeN/A

                                    \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                  6. lower-fma.f64N/A

                                    \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                  7. lower-+.f6434.3

                                    \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                5. Applied rewrites34.3%

                                  \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                6. Taylor expanded in k around inf

                                  \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites58.2%

                                    \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]

                                  if -7.2000000000000001e-39 < m < 0.39000000000000001

                                  1. Initial program 97.4%

                                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in m around 0

                                    \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                  4. Step-by-step derivation
                                    1. lower-/.f64N/A

                                      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                    2. unpow2N/A

                                      \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                    3. distribute-rgt-inN/A

                                      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                    4. +-commutativeN/A

                                      \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                    5. *-commutativeN/A

                                      \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                    6. lower-fma.f64N/A

                                      \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                    7. lower-+.f6496.1

                                      \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                  5. Applied rewrites96.1%

                                    \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                  6. Taylor expanded in k around 0

                                    \[\leadsto \frac{a}{\mathsf{fma}\left(10, k, 1\right)} \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites67.2%

                                      \[\leadsto \frac{a}{\mathsf{fma}\left(10, k, 1\right)} \]

                                    if 0.39000000000000001 < m

                                    1. Initial program 69.3%

                                      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in m around 0

                                      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                    4. Step-by-step derivation
                                      1. lower-/.f64N/A

                                        \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                      2. unpow2N/A

                                        \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                      3. distribute-rgt-inN/A

                                        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                      4. +-commutativeN/A

                                        \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                      5. *-commutativeN/A

                                        \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                      6. lower-fma.f64N/A

                                        \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                      7. lower-+.f642.7

                                        \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                    5. Applied rewrites2.7%

                                      \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                    6. Step-by-step derivation
                                      1. Applied rewrites1.3%

                                        \[\leadsto \frac{a}{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{-k}, \sqrt{-k}, 10\right), k, 1\right)} \]
                                      2. Taylor expanded in k around 0

                                        \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(-100 \cdot a + a \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) - 10 \cdot a\right)} \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites33.8%

                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, a \cdot -101, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                        2. Taylor expanded in k around inf

                                          \[\leadsto 101 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites53.8%

                                            \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 101 \]
                                        4. Recombined 3 regimes into one program.
                                        5. Add Preprocessing

                                        Alternative 8: 54.2% accurate, 4.8× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -6.8 \cdot 10^{-39}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.39:\\ \;\;\;\;1 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \end{array} \]
                                        (FPCore (a k m)
                                         :precision binary64
                                         (if (<= m -6.8e-39)
                                           (/ a (* k k))
                                           (if (<= m 0.39) (* 1.0 a) (* (* (* k a) k) 101.0))))
                                        double code(double a, double k, double m) {
                                        	double tmp;
                                        	if (m <= -6.8e-39) {
                                        		tmp = a / (k * k);
                                        	} else if (m <= 0.39) {
                                        		tmp = 1.0 * a;
                                        	} else {
                                        		tmp = ((k * a) * k) * 101.0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        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(a, k, m)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: a
                                            real(8), intent (in) :: k
                                            real(8), intent (in) :: m
                                            real(8) :: tmp
                                            if (m <= (-6.8d-39)) then
                                                tmp = a / (k * k)
                                            else if (m <= 0.39d0) then
                                                tmp = 1.0d0 * a
                                            else
                                                tmp = ((k * a) * k) * 101.0d0
                                            end if
                                            code = tmp
                                        end function
                                        
                                        public static double code(double a, double k, double m) {
                                        	double tmp;
                                        	if (m <= -6.8e-39) {
                                        		tmp = a / (k * k);
                                        	} else if (m <= 0.39) {
                                        		tmp = 1.0 * a;
                                        	} else {
                                        		tmp = ((k * a) * k) * 101.0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(a, k, m):
                                        	tmp = 0
                                        	if m <= -6.8e-39:
                                        		tmp = a / (k * k)
                                        	elif m <= 0.39:
                                        		tmp = 1.0 * a
                                        	else:
                                        		tmp = ((k * a) * k) * 101.0
                                        	return tmp
                                        
                                        function code(a, k, m)
                                        	tmp = 0.0
                                        	if (m <= -6.8e-39)
                                        		tmp = Float64(a / Float64(k * k));
                                        	elseif (m <= 0.39)
                                        		tmp = Float64(1.0 * a);
                                        	else
                                        		tmp = Float64(Float64(Float64(k * a) * k) * 101.0);
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(a, k, m)
                                        	tmp = 0.0;
                                        	if (m <= -6.8e-39)
                                        		tmp = a / (k * k);
                                        	elseif (m <= 0.39)
                                        		tmp = 1.0 * a;
                                        	else
                                        		tmp = ((k * a) * k) * 101.0;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[a_, k_, m_] := If[LessEqual[m, -6.8e-39], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.39], N[(1.0 * a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 101.0), $MachinePrecision]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;m \leq -6.8 \cdot 10^{-39}:\\
                                        \;\;\;\;\frac{a}{k \cdot k}\\
                                        
                                        \mathbf{elif}\;m \leq 0.39:\\
                                        \;\;\;\;1 \cdot a\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 3 regimes
                                        2. if m < -6.7999999999999998e-39

                                          1. Initial program 99.0%

                                            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in m around 0

                                            \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                          4. Step-by-step derivation
                                            1. lower-/.f64N/A

                                              \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                            2. unpow2N/A

                                              \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                            3. distribute-rgt-inN/A

                                              \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                            4. +-commutativeN/A

                                              \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                            5. *-commutativeN/A

                                              \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                            6. lower-fma.f64N/A

                                              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                            7. lower-+.f6434.3

                                              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                          5. Applied rewrites34.3%

                                            \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                          6. Taylor expanded in k around inf

                                            \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites58.2%

                                              \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]

                                            if -6.7999999999999998e-39 < m < 0.39000000000000001

                                            1. Initial program 97.4%

                                              \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. lift-/.f64N/A

                                                \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                              2. lift-*.f64N/A

                                                \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                              3. associate-/l*N/A

                                                \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                              4. *-commutativeN/A

                                                \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                              5. lower-*.f64N/A

                                                \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                              6. lower-/.f6497.4

                                                \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                              7. lift-+.f64N/A

                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                              8. +-commutativeN/A

                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
                                              9. lift-+.f64N/A

                                                \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
                                              10. +-commutativeN/A

                                                \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
                                              11. associate-+r+N/A

                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
                                              12. lift-*.f64N/A

                                                \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
                                              13. lift-*.f64N/A

                                                \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
                                              14. distribute-rgt-outN/A

                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
                                              15. +-commutativeN/A

                                                \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
                                              16. *-commutativeN/A

                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                              17. lower-fma.f64N/A

                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                              18. +-commutativeN/A

                                                \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                              19. lower-+.f6497.5

                                                \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                            4. Applied rewrites97.5%

                                              \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
                                            5. Taylor expanded in m around 0

                                              \[\leadsto \color{blue}{\frac{1}{1 + k \cdot \left(10 + k\right)}} \cdot a \]
                                            6. Step-by-step derivation
                                              1. distribute-rgt-inN/A

                                                \[\leadsto \frac{1}{1 + \color{blue}{\left(10 \cdot k + k \cdot k\right)}} \cdot a \]
                                              2. unpow2N/A

                                                \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \cdot a \]
                                              3. lower-/.f64N/A

                                                \[\leadsto \color{blue}{\frac{1}{1 + \left(10 \cdot k + {k}^{2}\right)}} \cdot a \]
                                              4. unpow2N/A

                                                \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \cdot a \]
                                              5. distribute-rgt-inN/A

                                                \[\leadsto \frac{1}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \cdot a \]
                                              6. +-commutativeN/A

                                                \[\leadsto \frac{1}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \cdot a \]
                                              7. *-commutativeN/A

                                                \[\leadsto \frac{1}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                              8. lower-fma.f64N/A

                                                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                              9. lower-+.f6496.1

                                                \[\leadsto \frac{1}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \cdot a \]
                                            7. Applied rewrites96.1%

                                              \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                            8. Taylor expanded in k around 0

                                              \[\leadsto 1 \cdot a \]
                                            9. Step-by-step derivation
                                              1. Applied rewrites60.1%

                                                \[\leadsto 1 \cdot a \]

                                              if 0.39000000000000001 < m

                                              1. Initial program 69.3%

                                                \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in m around 0

                                                \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                              4. Step-by-step derivation
                                                1. lower-/.f64N/A

                                                  \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                                2. unpow2N/A

                                                  \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                                3. distribute-rgt-inN/A

                                                  \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                                4. +-commutativeN/A

                                                  \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                                5. *-commutativeN/A

                                                  \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                                6. lower-fma.f64N/A

                                                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                7. lower-+.f642.7

                                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                              5. Applied rewrites2.7%

                                                \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                              6. Step-by-step derivation
                                                1. Applied rewrites1.3%

                                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{-k}, \sqrt{-k}, 10\right), k, 1\right)} \]
                                                2. Taylor expanded in k around 0

                                                  \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(-100 \cdot a + a \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) - 10 \cdot a\right)} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites33.8%

                                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, a \cdot -101, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                                  2. Taylor expanded in k around inf

                                                    \[\leadsto 101 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites53.8%

                                                      \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 101 \]
                                                  4. Recombined 3 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 9: 36.1% accurate, 6.1× speedup?

                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 0.39:\\ \;\;\;\;1 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\ \end{array} \end{array} \]
                                                  (FPCore (a k m)
                                                   :precision binary64
                                                   (if (<= m 0.39) (* 1.0 a) (* (* (* k a) k) 101.0)))
                                                  double code(double a, double k, double m) {
                                                  	double tmp;
                                                  	if (m <= 0.39) {
                                                  		tmp = 1.0 * a;
                                                  	} else {
                                                  		tmp = ((k * a) * k) * 101.0;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  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(a, k, m)
                                                  use fmin_fmax_functions
                                                      real(8), intent (in) :: a
                                                      real(8), intent (in) :: k
                                                      real(8), intent (in) :: m
                                                      real(8) :: tmp
                                                      if (m <= 0.39d0) then
                                                          tmp = 1.0d0 * a
                                                      else
                                                          tmp = ((k * a) * k) * 101.0d0
                                                      end if
                                                      code = tmp
                                                  end function
                                                  
                                                  public static double code(double a, double k, double m) {
                                                  	double tmp;
                                                  	if (m <= 0.39) {
                                                  		tmp = 1.0 * a;
                                                  	} else {
                                                  		tmp = ((k * a) * k) * 101.0;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  def code(a, k, m):
                                                  	tmp = 0
                                                  	if m <= 0.39:
                                                  		tmp = 1.0 * a
                                                  	else:
                                                  		tmp = ((k * a) * k) * 101.0
                                                  	return tmp
                                                  
                                                  function code(a, k, m)
                                                  	tmp = 0.0
                                                  	if (m <= 0.39)
                                                  		tmp = Float64(1.0 * a);
                                                  	else
                                                  		tmp = Float64(Float64(Float64(k * a) * k) * 101.0);
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  function tmp_2 = code(a, k, m)
                                                  	tmp = 0.0;
                                                  	if (m <= 0.39)
                                                  		tmp = 1.0 * a;
                                                  	else
                                                  		tmp = ((k * a) * k) * 101.0;
                                                  	end
                                                  	tmp_2 = tmp;
                                                  end
                                                  
                                                  code[a_, k_, m_] := If[LessEqual[m, 0.39], N[(1.0 * a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 101.0), $MachinePrecision]]
                                                  
                                                  \begin{array}{l}
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  \mathbf{if}\;m \leq 0.39:\\
                                                  \;\;\;\;1 \cdot a\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 101\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if m < 0.39000000000000001

                                                    1. Initial program 98.3%

                                                      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-/.f64N/A

                                                        \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                                      2. lift-*.f64N/A

                                                        \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                      3. associate-/l*N/A

                                                        \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                                      4. *-commutativeN/A

                                                        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                                      5. lower-*.f64N/A

                                                        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                                      6. lower-/.f6498.3

                                                        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                                      7. lift-+.f64N/A

                                                        \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                                      8. +-commutativeN/A

                                                        \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
                                                      9. lift-+.f64N/A

                                                        \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
                                                      10. +-commutativeN/A

                                                        \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
                                                      11. associate-+r+N/A

                                                        \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
                                                      12. lift-*.f64N/A

                                                        \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
                                                      13. lift-*.f64N/A

                                                        \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
                                                      14. distribute-rgt-outN/A

                                                        \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
                                                      15. +-commutativeN/A

                                                        \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
                                                      16. *-commutativeN/A

                                                        \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                                      17. lower-fma.f64N/A

                                                        \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                      18. +-commutativeN/A

                                                        \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                                      19. lower-+.f6498.3

                                                        \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                                    4. Applied rewrites98.3%

                                                      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
                                                    5. Taylor expanded in m around 0

                                                      \[\leadsto \color{blue}{\frac{1}{1 + k \cdot \left(10 + k\right)}} \cdot a \]
                                                    6. Step-by-step derivation
                                                      1. distribute-rgt-inN/A

                                                        \[\leadsto \frac{1}{1 + \color{blue}{\left(10 \cdot k + k \cdot k\right)}} \cdot a \]
                                                      2. unpow2N/A

                                                        \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \cdot a \]
                                                      3. lower-/.f64N/A

                                                        \[\leadsto \color{blue}{\frac{1}{1 + \left(10 \cdot k + {k}^{2}\right)}} \cdot a \]
                                                      4. unpow2N/A

                                                        \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \cdot a \]
                                                      5. distribute-rgt-inN/A

                                                        \[\leadsto \frac{1}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \cdot a \]
                                                      6. +-commutativeN/A

                                                        \[\leadsto \frac{1}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \cdot a \]
                                                      7. *-commutativeN/A

                                                        \[\leadsto \frac{1}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                                      8. lower-fma.f64N/A

                                                        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                      9. lower-+.f6461.5

                                                        \[\leadsto \frac{1}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \cdot a \]
                                                    7. Applied rewrites61.5%

                                                      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                    8. Taylor expanded in k around 0

                                                      \[\leadsto 1 \cdot a \]
                                                    9. Step-by-step derivation
                                                      1. Applied rewrites28.8%

                                                        \[\leadsto 1 \cdot a \]

                                                      if 0.39000000000000001 < m

                                                      1. Initial program 69.3%

                                                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                      2. Add Preprocessing
                                                      3. Taylor expanded in m around 0

                                                        \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                                      4. Step-by-step derivation
                                                        1. lower-/.f64N/A

                                                          \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                                        2. unpow2N/A

                                                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                                        3. distribute-rgt-inN/A

                                                          \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                                        4. +-commutativeN/A

                                                          \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                                        5. *-commutativeN/A

                                                          \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                                        6. lower-fma.f64N/A

                                                          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                        7. lower-+.f642.7

                                                          \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                      5. Applied rewrites2.7%

                                                        \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                      6. Step-by-step derivation
                                                        1. Applied rewrites1.3%

                                                          \[\leadsto \frac{a}{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{-k}, \sqrt{-k}, 10\right), k, 1\right)} \]
                                                        2. Taylor expanded in k around 0

                                                          \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(-100 \cdot a + a \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) - 10 \cdot a\right)} \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites33.8%

                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, a \cdot -101, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                                          2. Taylor expanded in k around inf

                                                            \[\leadsto 101 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites53.8%

                                                              \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 101 \]
                                                          4. Recombined 2 regimes into one program.
                                                          5. Add Preprocessing

                                                          Alternative 10: 25.4% accurate, 7.9× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 2850000000000:\\ \;\;\;\;1 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot k\right) \cdot -10\\ \end{array} \end{array} \]
                                                          (FPCore (a k m)
                                                           :precision binary64
                                                           (if (<= m 2850000000000.0) (* 1.0 a) (* (* a k) -10.0)))
                                                          double code(double a, double k, double m) {
                                                          	double tmp;
                                                          	if (m <= 2850000000000.0) {
                                                          		tmp = 1.0 * a;
                                                          	} else {
                                                          		tmp = (a * k) * -10.0;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          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(a, k, m)
                                                          use fmin_fmax_functions
                                                              real(8), intent (in) :: a
                                                              real(8), intent (in) :: k
                                                              real(8), intent (in) :: m
                                                              real(8) :: tmp
                                                              if (m <= 2850000000000.0d0) then
                                                                  tmp = 1.0d0 * a
                                                              else
                                                                  tmp = (a * k) * (-10.0d0)
                                                              end if
                                                              code = tmp
                                                          end function
                                                          
                                                          public static double code(double a, double k, double m) {
                                                          	double tmp;
                                                          	if (m <= 2850000000000.0) {
                                                          		tmp = 1.0 * a;
                                                          	} else {
                                                          		tmp = (a * k) * -10.0;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          def code(a, k, m):
                                                          	tmp = 0
                                                          	if m <= 2850000000000.0:
                                                          		tmp = 1.0 * a
                                                          	else:
                                                          		tmp = (a * k) * -10.0
                                                          	return tmp
                                                          
                                                          function code(a, k, m)
                                                          	tmp = 0.0
                                                          	if (m <= 2850000000000.0)
                                                          		tmp = Float64(1.0 * a);
                                                          	else
                                                          		tmp = Float64(Float64(a * k) * -10.0);
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          function tmp_2 = code(a, k, m)
                                                          	tmp = 0.0;
                                                          	if (m <= 2850000000000.0)
                                                          		tmp = 1.0 * a;
                                                          	else
                                                          		tmp = (a * k) * -10.0;
                                                          	end
                                                          	tmp_2 = tmp;
                                                          end
                                                          
                                                          code[a_, k_, m_] := If[LessEqual[m, 2850000000000.0], N[(1.0 * a), $MachinePrecision], N[(N[(a * k), $MachinePrecision] * -10.0), $MachinePrecision]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;m \leq 2850000000000:\\
                                                          \;\;\;\;1 \cdot a\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;\left(a \cdot k\right) \cdot -10\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if m < 2.85e12

                                                            1. Initial program 97.8%

                                                              \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                            2. Add Preprocessing
                                                            3. Step-by-step derivation
                                                              1. lift-/.f64N/A

                                                                \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                                              2. lift-*.f64N/A

                                                                \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                              3. associate-/l*N/A

                                                                \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                                              4. *-commutativeN/A

                                                                \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                                              5. lower-*.f64N/A

                                                                \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                                              6. lower-/.f6497.8

                                                                \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                                              7. lift-+.f64N/A

                                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                                              8. +-commutativeN/A

                                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
                                                              9. lift-+.f64N/A

                                                                \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
                                                              10. +-commutativeN/A

                                                                \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
                                                              11. associate-+r+N/A

                                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
                                                              12. lift-*.f64N/A

                                                                \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
                                                              13. lift-*.f64N/A

                                                                \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
                                                              14. distribute-rgt-outN/A

                                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
                                                              15. +-commutativeN/A

                                                                \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
                                                              16. *-commutativeN/A

                                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                                              17. lower-fma.f64N/A

                                                                \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                              18. +-commutativeN/A

                                                                \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                                              19. lower-+.f6497.8

                                                                \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                                            4. Applied rewrites97.8%

                                                              \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
                                                            5. Taylor expanded in m around 0

                                                              \[\leadsto \color{blue}{\frac{1}{1 + k \cdot \left(10 + k\right)}} \cdot a \]
                                                            6. Step-by-step derivation
                                                              1. distribute-rgt-inN/A

                                                                \[\leadsto \frac{1}{1 + \color{blue}{\left(10 \cdot k + k \cdot k\right)}} \cdot a \]
                                                              2. unpow2N/A

                                                                \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \cdot a \]
                                                              3. lower-/.f64N/A

                                                                \[\leadsto \color{blue}{\frac{1}{1 + \left(10 \cdot k + {k}^{2}\right)}} \cdot a \]
                                                              4. unpow2N/A

                                                                \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \cdot a \]
                                                              5. distribute-rgt-inN/A

                                                                \[\leadsto \frac{1}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \cdot a \]
                                                              6. +-commutativeN/A

                                                                \[\leadsto \frac{1}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \cdot a \]
                                                              7. *-commutativeN/A

                                                                \[\leadsto \frac{1}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                                              8. lower-fma.f64N/A

                                                                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                              9. lower-+.f6460.5

                                                                \[\leadsto \frac{1}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \cdot a \]
                                                            7. Applied rewrites60.5%

                                                              \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                            8. Taylor expanded in k around 0

                                                              \[\leadsto 1 \cdot a \]
                                                            9. Step-by-step derivation
                                                              1. Applied rewrites28.4%

                                                                \[\leadsto 1 \cdot a \]

                                                              if 2.85e12 < m

                                                              1. Initial program 69.4%

                                                                \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                              2. Add Preprocessing
                                                              3. Taylor expanded in m around 0

                                                                \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                                              4. Step-by-step derivation
                                                                1. lower-/.f64N/A

                                                                  \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                                                2. unpow2N/A

                                                                  \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \]
                                                                3. distribute-rgt-inN/A

                                                                  \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \]
                                                                4. +-commutativeN/A

                                                                  \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \]
                                                                5. *-commutativeN/A

                                                                  \[\leadsto \frac{a}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \]
                                                                6. lower-fma.f64N/A

                                                                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                                7. lower-+.f642.7

                                                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                              5. Applied rewrites2.7%

                                                                \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                              6. Taylor expanded in k around 0

                                                                \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites13.2%

                                                                  \[\leadsto \mathsf{fma}\left(a \cdot k, \color{blue}{-10}, a\right) \]
                                                                2. Taylor expanded in k around inf

                                                                  \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites23.9%

                                                                    \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                                                4. Recombined 2 regimes into one program.
                                                                5. Add Preprocessing

                                                                Alternative 11: 20.1% accurate, 22.3× speedup?

                                                                \[\begin{array}{l} \\ 1 \cdot a \end{array} \]
                                                                (FPCore (a k m) :precision binary64 (* 1.0 a))
                                                                double code(double a, double k, double m) {
                                                                	return 1.0 * a;
                                                                }
                                                                
                                                                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(a, k, m)
                                                                use fmin_fmax_functions
                                                                    real(8), intent (in) :: a
                                                                    real(8), intent (in) :: k
                                                                    real(8), intent (in) :: m
                                                                    code = 1.0d0 * a
                                                                end function
                                                                
                                                                public static double code(double a, double k, double m) {
                                                                	return 1.0 * a;
                                                                }
                                                                
                                                                def code(a, k, m):
                                                                	return 1.0 * a
                                                                
                                                                function code(a, k, m)
                                                                	return Float64(1.0 * a)
                                                                end
                                                                
                                                                function tmp = code(a, k, m)
                                                                	tmp = 1.0 * a;
                                                                end
                                                                
                                                                code[a_, k_, m_] := N[(1.0 * a), $MachinePrecision]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                1 \cdot a
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Initial program 88.3%

                                                                  \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                                2. Add Preprocessing
                                                                3. Step-by-step derivation
                                                                  1. lift-/.f64N/A

                                                                    \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                                                  2. lift-*.f64N/A

                                                                    \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                                                  3. associate-/l*N/A

                                                                    \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                                                                  4. *-commutativeN/A

                                                                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                                                  5. lower-*.f64N/A

                                                                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                                                                  6. lower-/.f6488.3

                                                                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                                                  7. lift-+.f64N/A

                                                                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot a \]
                                                                  8. +-commutativeN/A

                                                                    \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k + \left(1 + 10 \cdot k\right)}} \cdot a \]
                                                                  9. lift-+.f64N/A

                                                                    \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(1 + 10 \cdot k\right)}} \cdot a \]
                                                                  10. +-commutativeN/A

                                                                    \[\leadsto \frac{{k}^{m}}{k \cdot k + \color{blue}{\left(10 \cdot k + 1\right)}} \cdot a \]
                                                                  11. associate-+r+N/A

                                                                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(k \cdot k + 10 \cdot k\right) + 1}} \cdot a \]
                                                                  12. lift-*.f64N/A

                                                                    \[\leadsto \frac{{k}^{m}}{\left(\color{blue}{k \cdot k} + 10 \cdot k\right) + 1} \cdot a \]
                                                                  13. lift-*.f64N/A

                                                                    \[\leadsto \frac{{k}^{m}}{\left(k \cdot k + \color{blue}{10 \cdot k}\right) + 1} \cdot a \]
                                                                  14. distribute-rgt-outN/A

                                                                    \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot \left(k + 10\right)} + 1} \cdot a \]
                                                                  15. +-commutativeN/A

                                                                    \[\leadsto \frac{{k}^{m}}{k \cdot \color{blue}{\left(10 + k\right)} + 1} \cdot a \]
                                                                  16. *-commutativeN/A

                                                                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                                                  17. lower-fma.f64N/A

                                                                    \[\leadsto \frac{{k}^{m}}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                                  18. +-commutativeN/A

                                                                    \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                                                  19. lower-+.f6488.3

                                                                    \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{k + 10}, k, 1\right)} \cdot a \]
                                                                4. Applied rewrites88.3%

                                                                  \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a} \]
                                                                5. Taylor expanded in m around 0

                                                                  \[\leadsto \color{blue}{\frac{1}{1 + k \cdot \left(10 + k\right)}} \cdot a \]
                                                                6. Step-by-step derivation
                                                                  1. distribute-rgt-inN/A

                                                                    \[\leadsto \frac{1}{1 + \color{blue}{\left(10 \cdot k + k \cdot k\right)}} \cdot a \]
                                                                  2. unpow2N/A

                                                                    \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \cdot a \]
                                                                  3. lower-/.f64N/A

                                                                    \[\leadsto \color{blue}{\frac{1}{1 + \left(10 \cdot k + {k}^{2}\right)}} \cdot a \]
                                                                  4. unpow2N/A

                                                                    \[\leadsto \frac{1}{1 + \left(10 \cdot k + \color{blue}{k \cdot k}\right)} \cdot a \]
                                                                  5. distribute-rgt-inN/A

                                                                    \[\leadsto \frac{1}{1 + \color{blue}{k \cdot \left(10 + k\right)}} \cdot a \]
                                                                  6. +-commutativeN/A

                                                                    \[\leadsto \frac{1}{\color{blue}{k \cdot \left(10 + k\right) + 1}} \cdot a \]
                                                                  7. *-commutativeN/A

                                                                    \[\leadsto \frac{1}{\color{blue}{\left(10 + k\right) \cdot k} + 1} \cdot a \]
                                                                  8. lower-fma.f64N/A

                                                                    \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                                  9. lower-+.f6441.3

                                                                    \[\leadsto \frac{1}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \cdot a \]
                                                                7. Applied rewrites41.3%

                                                                  \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}} \cdot a \]
                                                                8. Taylor expanded in k around 0

                                                                  \[\leadsto 1 \cdot a \]
                                                                9. Step-by-step derivation
                                                                  1. Applied rewrites20.2%

                                                                    \[\leadsto 1 \cdot a \]
                                                                  2. Add Preprocessing

                                                                  Reproduce

                                                                  ?
                                                                  herbie shell --seed 2024360 
                                                                  (FPCore (a k m)
                                                                    :name "Falkner and Boettcher, Appendix A"
                                                                    :precision binary64
                                                                    (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))