ENA, Section 1.4, Exercise 1

Percentage Accurate: 94.5% → 99.0%
Time: 3.6s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[1.99 \leq x \land x \leq 2.01\]
\[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
(FPCore (x)
  :precision binary64
  (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
	return cos(x) * exp((10.0 * (x * x)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
	return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x):
	return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x)
	return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = cos(x) * exp((10.0 * (x * x)));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}

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

\[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
(FPCore (x)
  :precision binary64
  (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
	return cos(x) * exp((10.0 * (x * x)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
	return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x):
	return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x)
	return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = cos(x) * exp((10.0 * (x * x)));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}

Alternative 1: 99.0% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := {\left({\left(e^{20}\right)}^{\left(0.5 \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)}\\ \cos x \cdot \left(t\_0 \cdot t\_0\right) \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (pow (pow (exp 20.0) (* 0.5 x)) (/ x 2.0))))
  (* (cos x) (* t_0 t_0))))
double code(double x) {
	double t_0 = pow(pow(exp(20.0), (0.5 * x)), (x / 2.0));
	return cos(x) * (t_0 * t_0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = (exp(20.0d0) ** (0.5d0 * x)) ** (x / 2.0d0)
    code = cos(x) * (t_0 * t_0)
end function
public static double code(double x) {
	double t_0 = Math.pow(Math.pow(Math.exp(20.0), (0.5 * x)), (x / 2.0));
	return Math.cos(x) * (t_0 * t_0);
}
def code(x):
	t_0 = math.pow(math.pow(math.exp(20.0), (0.5 * x)), (x / 2.0))
	return math.cos(x) * (t_0 * t_0)
function code(x)
	t_0 = (exp(20.0) ^ Float64(0.5 * x)) ^ Float64(x / 2.0)
	return Float64(cos(x) * Float64(t_0 * t_0))
end
function tmp = code(x)
	t_0 = (exp(20.0) ^ (0.5 * x)) ^ (x / 2.0);
	tmp = cos(x) * (t_0 * t_0);
end
code[x_] := Block[{t$95$0 = N[Power[N[Power[N[Exp[20.0], $MachinePrecision], N[(0.5 * x), $MachinePrecision]], $MachinePrecision], N[(x / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[Cos[x], $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := {\left({\left(e^{20}\right)}^{\left(0.5 \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)}\\
\cos x \cdot \left(t\_0 \cdot t\_0\right)
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    4. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    5. lower-exp.f6495.3%

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
  3. Applied rewrites95.3%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
  4. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
    3. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    4. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{10 \cdot \color{blue}{\left(x \cdot x\right)}} \]
    5. associate-*r*N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\left(10 \cdot x\right) \cdot x}} \]
    6. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10 \cdot x}\right)}^{x}} \]
    7. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    8. lower-unsound-*.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    9. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left(\color{blue}{{\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    10. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. lower-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. lower-unsound-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot \color{blue}{{\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}}\right) \]
    14. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    15. lower-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lower-unsound-/.f6495.0%

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}}\right) \]
  5. Applied rewrites95.0%

    \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
  6. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    4. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{5 \cdot 2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    5. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. exp-lft-sqr-revN/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{\frac{10}{2}} \cdot e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    8. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    9. lower-unsound-*.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    10. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left(\color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{5}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    14. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    15. lower-exp.f6496.1%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. metadata-eval96.1%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{5}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  7. Applied rewrites96.1%

    \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  8. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    4. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{5 \cdot 2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    5. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. exp-lft-sqr-revN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{\frac{10}{2}} \cdot e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    8. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    9. lower-unsound-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    10. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(\color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{5}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    14. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    15. lower-exp.f6498.2%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. metadata-eval98.2%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{5}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  9. Applied rewrites98.2%

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

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left(\color{blue}{{\left(e^{5}\right)}^{x}} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{5}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    4. pow-prod-downN/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5} \cdot e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    5. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(\color{blue}{e^{5}} \cdot e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5} \cdot \color{blue}{e^{5}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. exp-lft-sqr-revN/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{5 \cdot 2}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    8. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{10}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    9. exp-fabsN/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(\left|e^{10}\right|\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(\left|\color{blue}{e^{10}}\right|\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. rem-sqrt-square-revN/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(\sqrt{e^{10} \cdot e^{10}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. sqrt-pow2N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10} \cdot e^{10}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    14. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    15. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(\color{blue}{e^{10}} \cdot e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10} \cdot \color{blue}{e^{10}}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. prod-expN/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{10 + 10}\right)}}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    18. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{10 + 10}\right)}}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    19. metadata-eval98.7%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{20}}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    20. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    21. mult-flipN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\color{blue}{\left(x \cdot \frac{1}{2}\right)}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    22. *-commutativeN/A

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

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\color{blue}{\left(\frac{1}{2} \cdot x\right)}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    24. metadata-eval98.7%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\color{blue}{0.5} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  11. Applied rewrites98.7%

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

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(\color{blue}{{\left(e^{5}\right)}^{x}} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{5}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    4. pow-prod-downN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{5} \cdot e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    5. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(\color{blue}{e^{5}} \cdot e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5} \cdot \color{blue}{e^{5}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. exp-lft-sqr-revN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{5 \cdot 2}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    8. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{10}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    9. exp-fabsN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(\left|e^{10}\right|\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(\left|\color{blue}{e^{10}}\right|\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. rem-sqrt-square-revN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(\sqrt{e^{10} \cdot e^{10}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. sqrt-pow2N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    13. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{10} \cdot e^{10}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    14. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    15. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(\color{blue}{e^{10}} \cdot e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{10} \cdot \color{blue}{e^{10}}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. prod-expN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{10 + 10}\right)}}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    18. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{10 + 10}\right)}}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    19. metadata-eval99.0%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(0.5 \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{20}}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    20. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{20}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    21. mult-flipN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{20}\right)}^{\color{blue}{\left(x \cdot \frac{1}{2}\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    22. *-commutativeN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{20}\right)}^{\color{blue}{\left(\frac{1}{2} \cdot x\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    23. lower-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(\frac{1}{2} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{20}\right)}^{\color{blue}{\left(\frac{1}{2} \cdot x\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    24. metadata-eval99.0%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(0.5 \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{20}\right)}^{\left(\color{blue}{0.5} \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  13. Applied rewrites99.0%

    \[\leadsto \cos x \cdot \left({\left({\left(e^{20}\right)}^{\left(0.5 \cdot x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{20}\right)}^{\left(0.5 \cdot x\right)}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
  14. Add Preprocessing

Alternative 2: 98.4% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := {\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)}\\ \cos x \cdot \left(t\_0 \cdot t\_0\right) \end{array} \]
(FPCore (x)
  :precision binary64
  (let* ((t_0 (pow (pow (exp 5.0) (+ x x)) (/ x 2.0))))
  (* (cos x) (* t_0 t_0))))
double code(double x) {
	double t_0 = pow(pow(exp(5.0), (x + x)), (x / 2.0));
	return cos(x) * (t_0 * t_0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = (exp(5.0d0) ** (x + x)) ** (x / 2.0d0)
    code = cos(x) * (t_0 * t_0)
end function
public static double code(double x) {
	double t_0 = Math.pow(Math.pow(Math.exp(5.0), (x + x)), (x / 2.0));
	return Math.cos(x) * (t_0 * t_0);
}
def code(x):
	t_0 = math.pow(math.pow(math.exp(5.0), (x + x)), (x / 2.0))
	return math.cos(x) * (t_0 * t_0)
function code(x)
	t_0 = (exp(5.0) ^ Float64(x + x)) ^ Float64(x / 2.0)
	return Float64(cos(x) * Float64(t_0 * t_0))
end
function tmp = code(x)
	t_0 = (exp(5.0) ^ (x + x)) ^ (x / 2.0);
	tmp = cos(x) * (t_0 * t_0);
end
code[x_] := Block[{t$95$0 = N[Power[N[Power[N[Exp[5.0], $MachinePrecision], N[(x + x), $MachinePrecision]], $MachinePrecision], N[(x / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[Cos[x], $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := {\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)}\\
\cos x \cdot \left(t\_0 \cdot t\_0\right)
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    4. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    5. lower-exp.f6495.3%

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
  3. Applied rewrites95.3%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
  4. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
    3. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    4. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{10 \cdot \color{blue}{\left(x \cdot x\right)}} \]
    5. associate-*r*N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\left(10 \cdot x\right) \cdot x}} \]
    6. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10 \cdot x}\right)}^{x}} \]
    7. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    8. lower-unsound-*.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    9. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left(\color{blue}{{\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    10. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. lower-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. lower-unsound-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot \color{blue}{{\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}}\right) \]
    14. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    15. lower-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lower-unsound-/.f6495.0%

      \[\leadsto \cos x \cdot \left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\color{blue}{\left(\frac{x}{2}\right)}}\right) \]
  5. Applied rewrites95.0%

    \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
  6. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    4. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{5 \cdot 2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    5. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. exp-lft-sqr-revN/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{\frac{10}{2}} \cdot e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    8. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    9. lower-unsound-*.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    10. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left(\color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{\color{blue}{5}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    14. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    15. lower-exp.f6496.1%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. metadata-eval96.1%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{5}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  7. Applied rewrites96.1%

    \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10 \cdot x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  8. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    4. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{5 \cdot 2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    5. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{\frac{10}{2}} \cdot 2}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. exp-lft-sqr-revN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{\frac{10}{2}} \cdot e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    8. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    9. lower-unsound-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{\frac{10}{2}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    10. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(\color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    11. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    12. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    13. metadata-evalN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{\color{blue}{5}}\right)}^{x} \cdot {\left(e^{\frac{10}{2}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    14. lower-unsound-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{\frac{10}{2}}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    15. lower-exp.f6498.2%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\color{blue}{\left(e^{\frac{10}{2}}\right)}}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    16. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{\frac{10}{2}}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. metadata-eval98.2%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{\color{blue}{5}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  9. Applied rewrites98.2%

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

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left(\color{blue}{{\left(e^{5}\right)}^{x}} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{5}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    4. pow-sqrN/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{\left(2 \cdot x\right)}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    5. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{\left(2 \cdot x\right)}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    6. count-2-revN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\color{blue}{\left(x + x\right)}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. lower-+.f6498.4%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\color{blue}{\left(x + x\right)}}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  11. Applied rewrites98.4%

    \[\leadsto \cos x \cdot \left({\color{blue}{\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  12. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{5}\right)}^{x} \cdot {\left(e^{5}\right)}^{x}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(\color{blue}{{\left(e^{5}\right)}^{x}} \cdot {\left(e^{5}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    3. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{x} \cdot \color{blue}{{\left(e^{5}\right)}^{x}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    4. pow-sqrN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{5}\right)}^{\left(2 \cdot x\right)}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    5. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{5}\right)}^{\left(2 \cdot x\right)}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
    6. count-2-revN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{\color{blue}{\left(x + x\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    7. lower-+.f6498.4%

      \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{5}\right)}^{\color{blue}{\left(x + x\right)}}\right)}^{\left(\frac{x}{2}\right)}\right) \]
  13. Applied rewrites98.4%

    \[\leadsto \cos x \cdot \left({\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}^{\left(\frac{x}{2}\right)} \cdot {\color{blue}{\left({\left(e^{5}\right)}^{\left(x + x\right)}\right)}}^{\left(\frac{x}{2}\right)}\right) \]
  14. Add Preprocessing

Alternative 3: 98.1% accurate, 0.5× speedup?

\[\cos x \cdot \frac{1}{{\left({\left(e^{-10}\right)}^{x}\right)}^{x}} \]
(FPCore (x)
  :precision binary64
  (* (cos x) (/ 1.0 (pow (pow (exp -10.0) x) x))))
double code(double x) {
	return cos(x) * (1.0 / pow(pow(exp(-10.0), x), x));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = cos(x) * (1.0d0 / ((exp((-10.0d0)) ** x) ** x))
end function
public static double code(double x) {
	return Math.cos(x) * (1.0 / Math.pow(Math.pow(Math.exp(-10.0), x), x));
}
def code(x):
	return math.cos(x) * (1.0 / math.pow(math.pow(math.exp(-10.0), x), x))
function code(x)
	return Float64(cos(x) * Float64(1.0 / ((exp(-10.0) ^ x) ^ x)))
end
function tmp = code(x)
	tmp = cos(x) * (1.0 / ((exp(-10.0) ^ x) ^ x));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[(1.0 / N[Power[N[Power[N[Exp[-10.0], $MachinePrecision], x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\cos x \cdot \frac{1}{{\left({\left(e^{-10}\right)}^{x}\right)}^{x}}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. sinh-+-cosh-revN/A

      \[\leadsto \cos x \cdot \color{blue}{\left(\cosh \left(10 \cdot \left(x \cdot x\right)\right) + \sinh \left(10 \cdot \left(x \cdot x\right)\right)\right)} \]
    3. add-flipN/A

      \[\leadsto \cos x \cdot \color{blue}{\left(\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \left(\mathsf{neg}\left(\sinh \left(10 \cdot \left(x \cdot x\right)\right)\right)\right)\right)} \]
    4. cosh-neg-revN/A

      \[\leadsto \cos x \cdot \left(\color{blue}{\cosh \left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right)} - \left(\mathsf{neg}\left(\sinh \left(10 \cdot \left(x \cdot x\right)\right)\right)\right)\right) \]
    5. sinh-neg-revN/A

      \[\leadsto \cos x \cdot \left(\cosh \left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right)}\right) \]
    6. sinh---cosh-revN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right)\right)}} \]
    7. exp-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{e^{\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)}}} \]
    8. lower-/.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{e^{\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)}}} \]
    9. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{e^{\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
    11. distribute-lft-neg-inN/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(\mathsf{neg}\left(10\right)\right) \cdot \left(x \cdot x\right)}}} \]
    12. lower-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(\mathsf{neg}\left(10\right)\right) \cdot \left(x \cdot x\right)}}} \]
    13. metadata-eval94.5%

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{-10} \cdot \left(x \cdot x\right)}} \]
  3. Applied rewrites94.5%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{e^{-10 \cdot \left(x \cdot x\right)}}} \]
  4. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{e^{-10 \cdot \left(x \cdot x\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{-10 \cdot \left(x \cdot x\right)}}} \]
    3. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{-10 \cdot \color{blue}{\left(x \cdot x\right)}}} \]
    4. associate-*r*N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(-10 \cdot x\right) \cdot x}}} \]
    5. exp-prodN/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{-10 \cdot x}\right)}^{x}}} \]
    6. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{-10 \cdot x}\right)}^{x}}} \]
    7. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{-10 \cdot x}\right)}}^{x}} \]
    8. lower-*.f6495.0%

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{-10 \cdot x}}\right)}^{x}} \]
  5. Applied rewrites95.0%

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{-10 \cdot x}\right)}^{x}}} \]
  6. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{-10 \cdot x}\right)}}^{x}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{-10 \cdot x}}\right)}^{x}} \]
    3. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{x \cdot -10}}\right)}^{x}} \]
    4. exp-prodN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{x}\right)}^{-10}\right)}}^{x}} \]
    5. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{x}\right)}}^{-10}\right)}^{x}} \]
    6. lower-pow.f6496.8%

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{x}\right)}^{-10}\right)}}^{x}} \]
  7. Applied rewrites96.8%

    \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{x}\right)}^{-10}\right)}}^{x}} \]
  8. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{x}\right)}^{-10}\right)}}^{x}} \]
    2. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{x}\right)}}^{-10}\right)}^{x}} \]
    3. pow-expN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{x \cdot -10}\right)}}^{x}} \]
    4. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{-10 \cdot x}}\right)}^{x}} \]
    5. exp-prodN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{-10}\right)}^{x}\right)}}^{x}} \]
    6. metadata-evalN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{\color{blue}{\mathsf{neg}\left(10\right)}}\right)}^{x}\right)}^{x}} \]
    7. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{\mathsf{neg}\left(10\right)}\right)}^{x}\right)}}^{x}} \]
    8. metadata-evalN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{\color{blue}{-10}}\right)}^{x}\right)}^{x}} \]
    9. lower-exp.f6498.1%

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{-10}\right)}}^{x}\right)}^{x}} \]
  9. Applied rewrites98.1%

    \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{-10}\right)}^{x}\right)}}^{x}} \]
  10. Add Preprocessing

Alternative 4: 95.3% accurate, 0.6× speedup?

\[\sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{{\left(e^{20}\right)}^{\left(\frac{-x \cdot x}{2}\right)}} \]
(FPCore (x)
  :precision binary64
  (*
 (sin (- (+ x (* PI -0.5))))
 (/ 1.0 (pow (exp 20.0) (/ (- (* x x)) 2.0)))))
double code(double x) {
	return sin(-(x + (((double) M_PI) * -0.5))) * (1.0 / pow(exp(20.0), (-(x * x) / 2.0)));
}
public static double code(double x) {
	return Math.sin(-(x + (Math.PI * -0.5))) * (1.0 / Math.pow(Math.exp(20.0), (-(x * x) / 2.0)));
}
def code(x):
	return math.sin(-(x + (math.pi * -0.5))) * (1.0 / math.pow(math.exp(20.0), (-(x * x) / 2.0)))
function code(x)
	return Float64(sin(Float64(-Float64(x + Float64(pi * -0.5)))) * Float64(1.0 / (exp(20.0) ^ Float64(Float64(-Float64(x * x)) / 2.0))))
end
function tmp = code(x)
	tmp = sin(-(x + (pi * -0.5))) * (1.0 / (exp(20.0) ^ (-(x * x) / 2.0)));
end
code[x_] := N[(N[Sin[(-N[(x + N[(Pi * -0.5), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * N[(1.0 / N[Power[N[Exp[20.0], $MachinePrecision], N[((-N[(x * x), $MachinePrecision]) / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{{\left(e^{20}\right)}^{\left(\frac{-x \cdot x}{2}\right)}}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. sinh-+-cosh-revN/A

      \[\leadsto \cos x \cdot \color{blue}{\left(\cosh \left(10 \cdot \left(x \cdot x\right)\right) + \sinh \left(10 \cdot \left(x \cdot x\right)\right)\right)} \]
    3. add-flipN/A

      \[\leadsto \cos x \cdot \color{blue}{\left(\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \left(\mathsf{neg}\left(\sinh \left(10 \cdot \left(x \cdot x\right)\right)\right)\right)\right)} \]
    4. cosh-neg-revN/A

      \[\leadsto \cos x \cdot \left(\color{blue}{\cosh \left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right)} - \left(\mathsf{neg}\left(\sinh \left(10 \cdot \left(x \cdot x\right)\right)\right)\right)\right) \]
    5. sinh-neg-revN/A

      \[\leadsto \cos x \cdot \left(\cosh \left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right)}\right) \]
    6. sinh---cosh-revN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)\right)\right)}} \]
    7. exp-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{e^{\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)}}} \]
    8. lower-/.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{e^{\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)}}} \]
    9. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{e^{\mathsf{neg}\left(10 \cdot \left(x \cdot x\right)\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
    11. distribute-lft-neg-inN/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(\mathsf{neg}\left(10\right)\right) \cdot \left(x \cdot x\right)}}} \]
    12. lower-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(\mathsf{neg}\left(10\right)\right) \cdot \left(x \cdot x\right)}}} \]
    13. metadata-eval94.5%

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{-10} \cdot \left(x \cdot x\right)}} \]
  3. Applied rewrites94.5%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{e^{-10 \cdot \left(x \cdot x\right)}}} \]
  4. Step-by-step derivation
    1. lift-cos.f64N/A

      \[\leadsto \color{blue}{\cos x} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    2. cos-neg-revN/A

      \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(x\right)\right)} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    3. sin-+PI/2-revN/A

      \[\leadsto \color{blue}{\sin \left(\left(\mathsf{neg}\left(x\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    4. lower-sin.f64N/A

      \[\leadsto \color{blue}{\sin \left(\left(\mathsf{neg}\left(x\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    5. frac-2negN/A

      \[\leadsto \sin \left(\left(\mathsf{neg}\left(x\right)\right) + \color{blue}{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{\mathsf{neg}\left(2\right)}}\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    6. distribute-frac-neg2N/A

      \[\leadsto \sin \left(\left(\mathsf{neg}\left(x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{2}\right)\right)}\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    7. distribute-neg-fracN/A

      \[\leadsto \sin \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}\right)\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    8. distribute-neg-outN/A

      \[\leadsto \sin \color{blue}{\left(\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)\right)\right)} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    9. lower-neg.f64N/A

      \[\leadsto \sin \color{blue}{\left(-\left(x + \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)\right)} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    10. lower-+.f64N/A

      \[\leadsto \sin \left(-\color{blue}{\left(x + \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)}\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    11. distribute-neg-frac2N/A

      \[\leadsto \sin \left(-\left(x + \color{blue}{\frac{\mathsf{PI}\left(\right)}{\mathsf{neg}\left(2\right)}}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    12. metadata-evalN/A

      \[\leadsto \sin \left(-\left(x + \frac{\mathsf{PI}\left(\right)}{\color{blue}{-2}}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    13. mult-flipN/A

      \[\leadsto \sin \left(-\left(x + \color{blue}{\mathsf{PI}\left(\right) \cdot \frac{1}{-2}}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    14. metadata-evalN/A

      \[\leadsto \sin \left(-\left(x + \mathsf{PI}\left(\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    15. metadata-evalN/A

      \[\leadsto \sin \left(-\left(x + \mathsf{PI}\left(\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    16. lower-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \color{blue}{\mathsf{PI}\left(\right) \cdot \frac{-1}{2}}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    17. lower-PI.f64N/A

      \[\leadsto \sin \left(-\left(x + \color{blue}{\pi} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    18. metadata-eval94.5%

      \[\leadsto \sin \left(-\left(x + \pi \cdot \color{blue}{-0.5}\right)\right) \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
  5. Applied rewrites94.5%

    \[\leadsto \color{blue}{\sin \left(-\left(x + \pi \cdot -0.5\right)\right)} \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
  6. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{e^{-10 \cdot \left(x \cdot x\right)}}} \]
    2. sinh-+-cosh-revN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{\cosh \left(-10 \cdot \left(x \cdot x\right)\right) + \sinh \left(-10 \cdot \left(x \cdot x\right)\right)}} \]
    3. add-flipN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{\cosh \left(-10 \cdot \left(x \cdot x\right)\right) - \left(\mathsf{neg}\left(\sinh \left(-10 \cdot \left(x \cdot x\right)\right)\right)\right)}} \]
    4. cosh-neg-revN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{\cosh \left(\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)\right)} - \left(\mathsf{neg}\left(\sinh \left(-10 \cdot \left(x \cdot x\right)\right)\right)\right)} \]
    5. sinh-neg-revN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\cosh \left(\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)\right)}} \]
    6. sinh---cosh-revN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)\right)\right)}}} \]
    7. exp-negN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{e^{\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)}}}} \]
    8. rec-expN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{\frac{1}{e^{-10 \cdot \left(x \cdot x\right)}}}}} \]
    9. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\frac{1}{\color{blue}{e^{-10 \cdot \left(x \cdot x\right)}}}}} \]
    10. lift-/.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{\frac{1}{e^{-10 \cdot \left(x \cdot x\right)}}}}} \]
    11. lower-/.f6494.5%

      \[\leadsto \sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{\frac{1}{e^{-10 \cdot \left(x \cdot x\right)}}}}} \]
    12. lift-/.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{\frac{1}{e^{-10 \cdot \left(x \cdot x\right)}}}}} \]
    13. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\frac{1}{\color{blue}{e^{-10 \cdot \left(x \cdot x\right)}}}}} \]
    14. rec-expN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)}}}} \]
    15. lower-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(-10 \cdot \left(x \cdot x\right)\right)}}}} \]
    16. lift-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{e^{\mathsf{neg}\left(\color{blue}{-10 \cdot \left(x \cdot x\right)}\right)}}} \]
    17. distribute-lft-neg-inN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{e^{\color{blue}{\left(\mathsf{neg}\left(-10\right)\right) \cdot \left(x \cdot x\right)}}}} \]
    18. metadata-evalN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{e^{\color{blue}{10} \cdot \left(x \cdot x\right)}}} \]
    19. lift-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{e^{10 \cdot \color{blue}{\left(x \cdot x\right)}}}} \]
    20. associate-*r*N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{e^{\color{blue}{\left(10 \cdot x\right) \cdot x}}}} \]
    21. lift-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{e^{\color{blue}{\left(10 \cdot x\right)} \cdot x}}} \]
    22. lower-*.f6494.4%

      \[\leadsto \sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{\frac{1}{e^{\color{blue}{\left(10 \cdot x\right) \cdot x}}}} \]
  7. Applied rewrites94.4%

    \[\leadsto \sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{e^{\left(10 \cdot x\right) \cdot x}}}} \]
  8. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{e^{\left(10 \cdot x\right) \cdot x}}}} \]
    2. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{e^{\left(10 \cdot x\right) \cdot x}}}} \]
    3. rec-expN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{e^{\mathsf{neg}\left(\left(10 \cdot x\right) \cdot x\right)}}} \]
    4. lift-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{e^{\mathsf{neg}\left(\color{blue}{\left(10 \cdot x\right) \cdot x}\right)}} \]
    5. lift-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{e^{\mathsf{neg}\left(\color{blue}{\left(10 \cdot x\right)} \cdot x\right)}} \]
    6. associate-*l*N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
    7. lift-*.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{e^{\mathsf{neg}\left(10 \cdot \color{blue}{\left(x \cdot x\right)}\right)}} \]
    8. distribute-rgt-neg-inN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{e^{\color{blue}{10 \cdot \left(\mathsf{neg}\left(x \cdot x\right)\right)}}} \]
    9. pow-expN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{{\left(e^{10}\right)}^{\left(\mathsf{neg}\left(x \cdot x\right)\right)}}} \]
    10. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(e^{10}\right)}}^{\left(\mathsf{neg}\left(x \cdot x\right)\right)}} \]
    11. rem-square-sqrtN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(\sqrt{e^{10}} \cdot \sqrt{e^{10}}\right)}}^{\left(\mathsf{neg}\left(x \cdot x\right)\right)}} \]
    12. sqrt-unprodN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(\sqrt{e^{10} \cdot e^{10}}\right)}}^{\left(\mathsf{neg}\left(x \cdot x\right)\right)}} \]
    13. sqrt-pow2N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{{\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}}} \]
    14. lower-pow.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\color{blue}{{\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}}} \]
    15. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\left(\color{blue}{e^{10}} \cdot e^{10}\right)}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}} \]
    16. lift-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\left(e^{10} \cdot \color{blue}{e^{10}}\right)}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}} \]
    17. prod-expN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(e^{10 + 10}\right)}}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}} \]
    18. lower-exp.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(e^{10 + 10}\right)}}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}} \]
    19. metadata-evalN/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\left(e^{\color{blue}{20}}\right)}^{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}} \]
    20. lower-/.f64N/A

      \[\leadsto \sin \left(-\left(x + \pi \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{{\left(e^{20}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{2}\right)}}} \]
    21. lower-neg.f6495.3%

      \[\leadsto \sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{{\left(e^{20}\right)}^{\left(\frac{\color{blue}{-x \cdot x}}{2}\right)}} \]
  9. Applied rewrites95.3%

    \[\leadsto \sin \left(-\left(x + \pi \cdot -0.5\right)\right) \cdot \frac{1}{\color{blue}{{\left(e^{20}\right)}^{\left(\frac{-x \cdot x}{2}\right)}}} \]
  10. Add Preprocessing

Alternative 5: 95.3% accurate, 1.0× speedup?

\[\cos x \cdot {22026.465794806718}^{\left(x \cdot x\right)} \]
(FPCore (x)
  :precision binary64
  (* (cos x) (pow 22026.465794806718 (* x x))))
double code(double x) {
	return cos(x) * pow(22026.465794806718, (x * x));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = cos(x) * (22026.465794806718d0 ** (x * x))
end function
public static double code(double x) {
	return Math.cos(x) * Math.pow(22026.465794806718, (x * x));
}
def code(x):
	return math.cos(x) * math.pow(22026.465794806718, (x * x))
function code(x)
	return Float64(cos(x) * (22026.465794806718 ^ Float64(x * x)))
end
function tmp = code(x)
	tmp = cos(x) * (22026.465794806718 ^ (x * x));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[22026.465794806718, N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\cos x \cdot {22026.465794806718}^{\left(x \cdot x\right)}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    4. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    5. lower-exp.f6495.3%

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
  3. Applied rewrites95.3%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
  4. Evaluated real constant95.3%

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

Alternative 6: 1.5% accurate, 15.4× speedup?

\[1 + \left(9.5 \cdot x\right) \cdot x \]
(FPCore (x)
  :precision binary64
  (+ 1.0 (* (* 9.5 x) x)))
double code(double x) {
	return 1.0 + ((9.5 * x) * x);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x)
use fmin_fmax_functions
    real(8), intent (in) :: x
    code = 1.0d0 + ((9.5d0 * x) * x)
end function
public static double code(double x) {
	return 1.0 + ((9.5 * x) * x);
}
def code(x):
	return 1.0 + ((9.5 * x) * x)
function code(x)
	return Float64(1.0 + Float64(Float64(9.5 * x) * x))
end
function tmp = code(x)
	tmp = 1.0 + ((9.5 * x) * x);
end
code[x_] := N[(1.0 + N[(N[(9.5 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
1 + \left(9.5 \cdot x\right) \cdot x
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{1 + \frac{19}{2} \cdot {x}^{2}} \]
  3. Step-by-step derivation
    1. lower-+.f64N/A

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

      \[\leadsto 1 + \frac{19}{2} \cdot \color{blue}{{x}^{2}} \]
    3. lower-pow.f641.5%

      \[\leadsto 1 + 9.5 \cdot {x}^{\color{blue}{2}} \]
  4. Applied rewrites1.5%

    \[\leadsto \color{blue}{1 + 9.5 \cdot {x}^{2}} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto 1 + \frac{19}{2} \cdot \color{blue}{{x}^{2}} \]
    2. lift-pow.f64N/A

      \[\leadsto 1 + \frac{19}{2} \cdot {x}^{\color{blue}{2}} \]
    3. pow2N/A

      \[\leadsto 1 + \frac{19}{2} \cdot \left(x \cdot \color{blue}{x}\right) \]
    4. sqr-neg-revN/A

      \[\leadsto 1 + \frac{19}{2} \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
    5. associate-*r*N/A

      \[\leadsto 1 + \left(\frac{19}{2} \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \]
    6. distribute-rgt-neg-outN/A

      \[\leadsto 1 + \left(\mathsf{neg}\left(\left(\frac{19}{2} \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot x\right)\right) \]
    7. distribute-lft-neg-inN/A

      \[\leadsto 1 + \left(\mathsf{neg}\left(\frac{19}{2} \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \color{blue}{x} \]
    8. distribute-lft-neg-outN/A

      \[\leadsto 1 + \left(\left(\mathsf{neg}\left(\frac{19}{2}\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot x \]
    9. lower-*.f64N/A

      \[\leadsto 1 + \left(\left(\mathsf{neg}\left(\frac{19}{2}\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot \color{blue}{x} \]
    10. distribute-rgt-neg-outN/A

      \[\leadsto 1 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{19}{2}\right)\right) \cdot x\right)\right) \cdot x \]
    11. distribute-lft-neg-outN/A

      \[\leadsto 1 + \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{19}{2}\right)\right)\right)\right) \cdot x\right) \cdot x \]
    12. remove-double-negN/A

      \[\leadsto 1 + \left(\frac{19}{2} \cdot x\right) \cdot x \]
    13. lower-*.f641.5%

      \[\leadsto 1 + \left(9.5 \cdot x\right) \cdot x \]
  6. Applied rewrites1.5%

    \[\leadsto 1 + \left(9.5 \cdot x\right) \cdot \color{blue}{x} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2025258 
(FPCore (x)
  :name "ENA, Section 1.4, Exercise 1"
  :precision binary64
  :pre (and (<= 1.99 x) (<= x 2.01))
  (* (cos x) (exp (* 10.0 (* x x)))))