Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A

Percentage Accurate: 99.3% → 99.3%
Time: 5.1s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.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, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.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, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}

Alternative 1: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.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, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Derivation
  1. Initial program 99.3%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Add Preprocessing

Alternative 2: 88.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\ t_2 := \sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\\ \mathbf{if}\;t \leq 1.15:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 10^{+91}:\\ \;\;\;\;\left(t\_2 \cdot 0.5\right) \cdot x\\ \mathbf{elif}\;t \leq 4 \cdot 10^{+140}:\\ \;\;\;\;\left(-t\_2\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0)))
        (t_2 (sqrt (* (+ z z) (exp (* t t))))))
   (if (<= t 1.15)
     t_1
     (if (<= t 1e+91)
       (* (* t_2 0.5) x)
       (if (<= t 4e+140) (* (- t_2) y) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
	double t_2 = sqrt(((z + z) * exp((t * t))));
	double tmp;
	if (t <= 1.15) {
		tmp = t_1;
	} else if (t <= 1e+91) {
		tmp = (t_2 * 0.5) * x;
	} else if (t <= 4e+140) {
		tmp = -t_2 * y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0))
	t_2 = sqrt(Float64(Float64(z + z) * exp(Float64(t * t))))
	tmp = 0.0
	if (t <= 1.15)
		tmp = t_1;
	elseif (t <= 1e+91)
		tmp = Float64(Float64(t_2 * 0.5) * x);
	elseif (t <= 4e+140)
		tmp = Float64(Float64(-t_2) * y);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.15], t$95$1, If[LessEqual[t, 1e+91], N[(N[(t$95$2 * 0.5), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 4e+140], N[((-t$95$2) * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
t_2 := \sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\\
\mathbf{if}\;t \leq 1.15:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 10^{+91}:\\
\;\;\;\;\left(t\_2 \cdot 0.5\right) \cdot x\\

\mathbf{elif}\;t \leq 4 \cdot 10^{+140}:\\
\;\;\;\;\left(-t\_2\right) \cdot y\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 1.1499999999999999 or 4.00000000000000024e140 < t

    1. Initial program 99.4%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

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

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(\frac{1}{2} \cdot {t}^{2} + \color{blue}{1}\right) \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left({t}^{2} \cdot \frac{1}{2} + 1\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left({t}^{2}, \color{blue}{\frac{1}{2}}, 1\right) \]
      4. pow2N/A

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{1}{2}, 1\right) \]
      5. lift-*.f6490.7

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right) \]
    4. Applied rewrites90.7%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{\mathsf{fma}\left(t \cdot t, 0.5, 1\right)} \]

    if 1.1499999999999999 < t < 1.00000000000000008e91

    1. Initial program 99.3%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around inf

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

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

        \[\leadsto \frac{1}{2} \cdot \left(\sqrt{z} \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \color{blue}{x}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \color{blue}{x}\right) \]
      4. associate-*l*N/A

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

        \[\leadsto \left(\frac{1}{2} \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{x} \]
    4. Applied rewrites75.8%

      \[\leadsto \color{blue}{\left(\sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot 0.5\right) \cdot x} \]

    if 1.00000000000000008e91 < t < 4.00000000000000024e140

    1. Initial program 98.7%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites72.4%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 88.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\ \mathbf{if}\;t \leq 60:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4 \cdot 10^{+140}:\\ \;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0))))
   (if (<= t 60.0)
     t_1
     (if (<= t 4e+140) (* (- (sqrt (* (+ z z) (exp (* t t))))) y) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
	double tmp;
	if (t <= 60.0) {
		tmp = t_1;
	} else if (t <= 4e+140) {
		tmp = -sqrt(((z + z) * exp((t * t)))) * y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0))
	tmp = 0.0
	if (t <= 60.0)
		tmp = t_1;
	elseif (t <= 4e+140)
		tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * exp(Float64(t * t))))) * y);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 60.0], t$95$1, If[LessEqual[t, 4e+140], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{if}\;t \leq 60:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 4 \cdot 10^{+140}:\\
\;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 60 or 4.00000000000000024e140 < t

    1. Initial program 99.4%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

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

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(\frac{1}{2} \cdot {t}^{2} + \color{blue}{1}\right) \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left({t}^{2} \cdot \frac{1}{2} + 1\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left({t}^{2}, \color{blue}{\frac{1}{2}}, 1\right) \]
      4. pow2N/A

        \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{1}{2}, 1\right) \]
      5. lift-*.f6490.6

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right) \]
    4. Applied rewrites90.6%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{\mathsf{fma}\left(t \cdot t, 0.5, 1\right)} \]

    if 60 < t < 4.00000000000000024e140

    1. Initial program 99.1%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites74.3%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 85.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0)))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
}
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0))
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)
\end{array}
Derivation
  1. Initial program 99.3%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Taylor expanded in t around 0

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

      \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(\frac{1}{2} \cdot {t}^{2} + \color{blue}{1}\right) \]
    2. *-commutativeN/A

      \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left({t}^{2} \cdot \frac{1}{2} + 1\right) \]
    3. lower-fma.f64N/A

      \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left({t}^{2}, \color{blue}{\frac{1}{2}}, 1\right) \]
    4. pow2N/A

      \[\leadsto \left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, \frac{1}{2}, 1\right) \]
    5. lift-*.f6485.2

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right) \]
  4. Applied rewrites85.2%

    \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{\mathsf{fma}\left(t \cdot t, 0.5, 1\right)} \]
  5. Add Preprocessing

Alternative 5: 65.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z + z}\\ \mathbf{if}\;t \leq 25:\\ \;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{+31}:\\ \;\;\;\;\sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(t \cdot t\right) \cdot t\_1\right) \cdot -0.5 - t\_1\right) \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ z z))))
   (if (<= t 25.0)
     (* t_1 (- (* 0.5 x) y))
     (if (<= t 6.5e+31)
       (* (sqrt (* (+ z z) (exp (* t t)))) y)
       (* (- (* (* (* t t) t_1) -0.5) t_1) y)))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z + z));
	double tmp;
	if (t <= 25.0) {
		tmp = t_1 * ((0.5 * x) - y);
	} else if (t <= 6.5e+31) {
		tmp = sqrt(((z + z) * exp((t * t)))) * y;
	} else {
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z + z))
    if (t <= 25.0d0) then
        tmp = t_1 * ((0.5d0 * x) - y)
    else if (t <= 6.5d+31) then
        tmp = sqrt(((z + z) * exp((t * t)))) * y
    else
        tmp = ((((t * t) * t_1) * (-0.5d0)) - t_1) * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z + z));
	double tmp;
	if (t <= 25.0) {
		tmp = t_1 * ((0.5 * x) - y);
	} else if (t <= 6.5e+31) {
		tmp = Math.sqrt(((z + z) * Math.exp((t * t)))) * y;
	} else {
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z + z))
	tmp = 0
	if t <= 25.0:
		tmp = t_1 * ((0.5 * x) - y)
	elif t <= 6.5e+31:
		tmp = math.sqrt(((z + z) * math.exp((t * t)))) * y
	else:
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z + z))
	tmp = 0.0
	if (t <= 25.0)
		tmp = Float64(t_1 * Float64(Float64(0.5 * x) - y));
	elseif (t <= 6.5e+31)
		tmp = Float64(sqrt(Float64(Float64(z + z) * exp(Float64(t * t)))) * y);
	else
		tmp = Float64(Float64(Float64(Float64(Float64(t * t) * t_1) * -0.5) - t_1) * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z + z));
	tmp = 0.0;
	if (t <= 25.0)
		tmp = t_1 * ((0.5 * x) - y);
	elseif (t <= 6.5e+31)
		tmp = sqrt(((z + z) * exp((t * t)))) * y;
	else
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 25.0], N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.5e+31], N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t$95$1), $MachinePrecision] * -0.5), $MachinePrecision] - t$95$1), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 25:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\

\mathbf{elif}\;t \leq 6.5 \cdot 10^{+31}:\\
\;\;\;\;\sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot t\_1\right) \cdot -0.5 - t\_1\right) \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 25

    1. Initial program 99.4%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\sqrt{z} \cdot \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot x - y\right)} \]
      2. sqrt-prodN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right) \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot \frac{1}{2} - y\right) \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot \frac{1}{2} - y\right)} \]
      5. lift-sqrt.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x \cdot \frac{1}{2}} - y\right) \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      7. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      8. *-commutativeN/A

        \[\leadsto \sqrt{2 \cdot z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      9. count-2-revN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      10. lower-+.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      11. lift--.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(x \cdot \frac{1}{2} - \color{blue}{y}\right) \]
      12. *-commutativeN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\frac{1}{2} \cdot x - y\right) \]
      13. lower-*.f6470.0

        \[\leadsto \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \]
    4. Applied rewrites70.0%

      \[\leadsto \color{blue}{\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)} \]

    if 25 < t < 6.5000000000000004e31

    1. Initial program 99.5%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites75.2%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
    5. Taylor expanded in z around -inf

      \[\leadsto \left(\sqrt{z \cdot e^{{t}^{2}}} \cdot \left(\sqrt{-2} \cdot \sqrt{-1}\right)\right) \cdot y \]
    6. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \left(\sqrt{z \cdot e^{{t}^{2}}} \cdot \sqrt{-2 \cdot -1}\right) \cdot y \]
      2. metadata-evalN/A

        \[\leadsto \left(\sqrt{z \cdot e^{{t}^{2}}} \cdot \sqrt{2}\right) \cdot y \]
      3. sqrt-unprodN/A

        \[\leadsto \sqrt{\left(z \cdot e^{{t}^{2}}\right) \cdot 2} \cdot y \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{2 \cdot \left(z \cdot e^{{t}^{2}}\right)} \cdot y \]
      5. associate-*r*N/A

        \[\leadsto \sqrt{\left(2 \cdot z\right) \cdot e^{{t}^{2}}} \cdot y \]
      6. count-2-revN/A

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{{t}^{2}}} \cdot y \]
      7. lift-+.f64N/A

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{{t}^{2}}} \cdot y \]
      8. lower-exp.f64N/A

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{{t}^{2}}} \cdot y \]
      9. pow2N/A

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y \]
      10. lift-*.f64N/A

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y \]
      11. lift-*.f64N/A

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y \]
      12. lift-sqrt.f6424.8

        \[\leadsto \sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y \]
    7. Applied rewrites24.8%

      \[\leadsto \sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y \]

    if 6.5000000000000004e31 < t

    1. Initial program 99.3%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites75.0%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
    5. Taylor expanded in t around 0

      \[\leadsto \left(\frac{-1}{2} \cdot \left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\frac{-1}{2} \cdot \left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      3. lower-*.f64N/A

        \[\leadsto \left(\left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      4. associate-*l*N/A

        \[\leadsto \left(\left({t}^{2} \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      5. *-commutativeN/A

        \[\leadsto \left(\left({t}^{2} \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left({t}^{2} \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      7. pow2N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      8. lift-*.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      9. sqrt-prodN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z \cdot 2}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{2 \cdot z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{2 \cdot z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      12. count-2-revN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      13. lift-+.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      14. sqrt-prodN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z \cdot 2}\right) \cdot y \]
      15. *-commutativeN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{2 \cdot z}\right) \cdot y \]
      16. lower-sqrt.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{2 \cdot z}\right) \cdot y \]
      17. count-2-revN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z + z}\right) \cdot y \]
      18. lift-+.f6456.9

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot -0.5 - \sqrt{z + z}\right) \cdot y \]
    7. Applied rewrites56.9%

      \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot -0.5 - \sqrt{z + z}\right) \cdot y \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 65.7% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z + z}\\ \mathbf{if}\;t \leq 1.15 \cdot 10^{+56}:\\ \;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(t \cdot t\right) \cdot t\_1\right) \cdot -0.5 - t\_1\right) \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ z z))))
   (if (<= t 1.15e+56)
     (* t_1 (- (* 0.5 x) y))
     (* (- (* (* (* t t) t_1) -0.5) t_1) y))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z + z));
	double tmp;
	if (t <= 1.15e+56) {
		tmp = t_1 * ((0.5 * x) - y);
	} else {
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z + z))
    if (t <= 1.15d+56) then
        tmp = t_1 * ((0.5d0 * x) - y)
    else
        tmp = ((((t * t) * t_1) * (-0.5d0)) - t_1) * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z + z));
	double tmp;
	if (t <= 1.15e+56) {
		tmp = t_1 * ((0.5 * x) - y);
	} else {
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z + z))
	tmp = 0
	if t <= 1.15e+56:
		tmp = t_1 * ((0.5 * x) - y)
	else:
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z + z))
	tmp = 0.0
	if (t <= 1.15e+56)
		tmp = Float64(t_1 * Float64(Float64(0.5 * x) - y));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(t * t) * t_1) * -0.5) - t_1) * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z + z));
	tmp = 0.0;
	if (t <= 1.15e+56)
		tmp = t_1 * ((0.5 * x) - y);
	else
		tmp = ((((t * t) * t_1) * -0.5) - t_1) * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.15e+56], N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t$95$1), $MachinePrecision] * -0.5), $MachinePrecision] - t$95$1), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 1.15 \cdot 10^{+56}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot t\_1\right) \cdot -0.5 - t\_1\right) \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.15000000000000007e56

    1. Initial program 99.4%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\sqrt{z} \cdot \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot x - y\right)} \]
      2. sqrt-prodN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right) \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot \frac{1}{2} - y\right) \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot \frac{1}{2} - y\right)} \]
      5. lift-sqrt.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x \cdot \frac{1}{2}} - y\right) \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      7. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      8. *-commutativeN/A

        \[\leadsto \sqrt{2 \cdot z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      9. count-2-revN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      10. lower-+.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      11. lift--.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(x \cdot \frac{1}{2} - \color{blue}{y}\right) \]
      12. *-commutativeN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\frac{1}{2} \cdot x - y\right) \]
      13. lower-*.f6466.9

        \[\leadsto \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \]
    4. Applied rewrites66.9%

      \[\leadsto \color{blue}{\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)} \]

    if 1.15000000000000007e56 < t

    1. Initial program 99.3%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites75.1%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
    5. Taylor expanded in t around 0

      \[\leadsto \left(\frac{-1}{2} \cdot \left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\frac{-1}{2} \cdot \left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      3. lower-*.f64N/A

        \[\leadsto \left(\left(\left({t}^{2} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      4. associate-*l*N/A

        \[\leadsto \left(\left({t}^{2} \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      5. *-commutativeN/A

        \[\leadsto \left(\left({t}^{2} \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left({t}^{2} \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      7. pow2N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      8. lift-*.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      9. sqrt-prodN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z \cdot 2}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{2 \cdot z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{2 \cdot z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      12. count-2-revN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      13. lift-+.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z} \cdot \sqrt{2}\right) \cdot y \]
      14. sqrt-prodN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z \cdot 2}\right) \cdot y \]
      15. *-commutativeN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{2 \cdot z}\right) \cdot y \]
      16. lower-sqrt.f64N/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{2 \cdot z}\right) \cdot y \]
      17. count-2-revN/A

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot \frac{-1}{2} - \sqrt{z + z}\right) \cdot y \]
      18. lift-+.f6461.1

        \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot -0.5 - \sqrt{z + z}\right) \cdot y \]
    7. Applied rewrites61.1%

      \[\leadsto \left(\left(\left(t \cdot t\right) \cdot \sqrt{z + z}\right) \cdot -0.5 - \sqrt{z + z}\right) \cdot y \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 65.4% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{+31}:\\ \;\;\;\;\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot \mathsf{fma}\left(t, t, 1\right)}\right) \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t 5.5e+31)
   (* (sqrt (+ z z)) (- (* 0.5 x) y))
   (* (- (sqrt (* (+ z z) (fma t t 1.0)))) y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 5.5e+31) {
		tmp = sqrt((z + z)) * ((0.5 * x) - y);
	} else {
		tmp = -sqrt(((z + z) * fma(t, t, 1.0))) * y;
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (t <= 5.5e+31)
		tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(0.5 * x) - y));
	else
		tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * fma(t, t, 1.0)))) * y);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[t, 5.5e+31], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.5 \cdot 10^{+31}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot \mathsf{fma}\left(t, t, 1\right)}\right) \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.50000000000000002e31

    1. Initial program 99.4%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\sqrt{z} \cdot \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot x - y\right)} \]
      2. sqrt-prodN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right) \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot \frac{1}{2} - y\right) \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot \frac{1}{2} - y\right)} \]
      5. lift-sqrt.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x \cdot \frac{1}{2}} - y\right) \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      7. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      8. *-commutativeN/A

        \[\leadsto \sqrt{2 \cdot z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      9. count-2-revN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      10. lower-+.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      11. lift--.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(x \cdot \frac{1}{2} - \color{blue}{y}\right) \]
      12. *-commutativeN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\frac{1}{2} \cdot x - y\right) \]
      13. lower-*.f6468.2

        \[\leadsto \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \]
    4. Applied rewrites68.2%

      \[\leadsto \color{blue}{\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)} \]

    if 5.50000000000000002e31 < t

    1. Initial program 99.3%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites75.0%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
    5. Taylor expanded in t around 0

      \[\leadsto \left(-\sqrt{\left(z + z\right) \cdot \left(1 + {t}^{2}\right)}\right) \cdot y \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(-\sqrt{\left(z + z\right) \cdot \left({t}^{2} + 1\right)}\right) \cdot y \]
      2. pow2N/A

        \[\leadsto \left(-\sqrt{\left(z + z\right) \cdot \left(t \cdot t + 1\right)}\right) \cdot y \]
      3. lower-fma.f6455.6

        \[\leadsto \left(-\sqrt{\left(z + z\right) \cdot \mathsf{fma}\left(t, t, 1\right)}\right) \cdot y \]
    7. Applied rewrites55.6%

      \[\leadsto \left(-\sqrt{\left(z + z\right) \cdot \mathsf{fma}\left(t, t, 1\right)}\right) \cdot y \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 56.4% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- (* 0.5 x) y)))
double code(double x, double y, double z, double t) {
	return sqrt((z + z)) * ((0.5 * x) - y);
}
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, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = sqrt((z + z)) * ((0.5d0 * x) - y)
end function
public static double code(double x, double y, double z, double t) {
	return Math.sqrt((z + z)) * ((0.5 * x) - y);
}
def code(x, y, z, t):
	return math.sqrt((z + z)) * ((0.5 * x) - y)
function code(x, y, z, t)
	return Float64(sqrt(Float64(z + z)) * Float64(Float64(0.5 * x) - y))
end
function tmp = code(x, y, z, t)
	tmp = sqrt((z + z)) * ((0.5 * x) - y);
end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)
\end{array}
Derivation
  1. Initial program 99.3%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Taylor expanded in t around 0

    \[\leadsto \color{blue}{\sqrt{z} \cdot \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \]
  3. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot x - y\right)} \]
    2. sqrt-prodN/A

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right) \]
    3. *-commutativeN/A

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot \frac{1}{2} - y\right) \]
    4. lower-*.f64N/A

      \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot \frac{1}{2} - y\right)} \]
    5. lift-sqrt.f64N/A

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x \cdot \frac{1}{2}} - y\right) \]
    6. lift-*.f64N/A

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
    7. lift-*.f64N/A

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
    8. *-commutativeN/A

      \[\leadsto \sqrt{2 \cdot z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
    9. count-2-revN/A

      \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
    10. lower-+.f64N/A

      \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
    11. lift--.f64N/A

      \[\leadsto \sqrt{z + z} \cdot \left(x \cdot \frac{1}{2} - \color{blue}{y}\right) \]
    12. *-commutativeN/A

      \[\leadsto \sqrt{z + z} \cdot \left(\frac{1}{2} \cdot x - y\right) \]
    13. lower-*.f6456.4

      \[\leadsto \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \]
  4. Applied rewrites56.4%

    \[\leadsto \color{blue}{\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)} \]
  5. Add Preprocessing

Alternative 9: 42.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z + z}\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+51}:\\ \;\;\;\;\left(\left(\sqrt{2} \cdot x\right) \cdot 0.5\right) \cdot \sqrt{z}\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+109}:\\ \;\;\;\;\left(-t\_1\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot t\_1\right) \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ z z))))
   (if (<= x -1.2e+51)
     (* (* (* (sqrt 2.0) x) 0.5) (sqrt z))
     (if (<= x 8.5e+109) (* (- t_1) y) (* (* x t_1) 0.5)))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z + z));
	double tmp;
	if (x <= -1.2e+51) {
		tmp = ((sqrt(2.0) * x) * 0.5) * sqrt(z);
	} else if (x <= 8.5e+109) {
		tmp = -t_1 * y;
	} else {
		tmp = (x * t_1) * 0.5;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z + z))
    if (x <= (-1.2d+51)) then
        tmp = ((sqrt(2.0d0) * x) * 0.5d0) * sqrt(z)
    else if (x <= 8.5d+109) then
        tmp = -t_1 * y
    else
        tmp = (x * t_1) * 0.5d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z + z));
	double tmp;
	if (x <= -1.2e+51) {
		tmp = ((Math.sqrt(2.0) * x) * 0.5) * Math.sqrt(z);
	} else if (x <= 8.5e+109) {
		tmp = -t_1 * y;
	} else {
		tmp = (x * t_1) * 0.5;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z + z))
	tmp = 0
	if x <= -1.2e+51:
		tmp = ((math.sqrt(2.0) * x) * 0.5) * math.sqrt(z)
	elif x <= 8.5e+109:
		tmp = -t_1 * y
	else:
		tmp = (x * t_1) * 0.5
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z + z))
	tmp = 0.0
	if (x <= -1.2e+51)
		tmp = Float64(Float64(Float64(sqrt(2.0) * x) * 0.5) * sqrt(z));
	elseif (x <= 8.5e+109)
		tmp = Float64(Float64(-t_1) * y);
	else
		tmp = Float64(Float64(x * t_1) * 0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z + z));
	tmp = 0.0;
	if (x <= -1.2e+51)
		tmp = ((sqrt(2.0) * x) * 0.5) * sqrt(z);
	elseif (x <= 8.5e+109)
		tmp = -t_1 * y;
	else
		tmp = (x * t_1) * 0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.2e+51], N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision] * 0.5), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e+109], N[((-t$95$1) * y), $MachinePrecision], N[(N[(x * t$95$1), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+51}:\\
\;\;\;\;\left(\left(\sqrt{2} \cdot x\right) \cdot 0.5\right) \cdot \sqrt{z}\\

\mathbf{elif}\;x \leq 8.5 \cdot 10^{+109}:\\
\;\;\;\;\left(-t\_1\right) \cdot y\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot t\_1\right) \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1999999999999999e51

    1. Initial program 99.8%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Applied rewrites99.5%

      \[\leadsto \color{blue}{\left(\left(\sqrt{2} \cdot \left(0.5 \cdot x - y\right)\right) \cdot \sqrt{e^{t \cdot t}}\right) \cdot \sqrt{z}} \]
    3. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \cdot \sqrt{z} \]
    4. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \left(\sqrt{2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right)\right) \cdot \sqrt{z} \]
      2. lift--.f64N/A

        \[\leadsto \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - \color{blue}{y}\right)\right) \cdot \sqrt{z} \]
      3. lift-*.f64N/A

        \[\leadsto \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right) \cdot \sqrt{z} \]
      4. lift-*.f6459.6

        \[\leadsto \left(\sqrt{2} \cdot \color{blue}{\left(0.5 \cdot x - y\right)}\right) \cdot \sqrt{z} \]
    5. Applied rewrites59.6%

      \[\leadsto \color{blue}{\left(\sqrt{2} \cdot \left(0.5 \cdot x - y\right)\right)} \cdot \sqrt{z} \]
    6. Taylor expanded in x around inf

      \[\leadsto \left(\frac{1}{2} \cdot \color{blue}{\left(x \cdot \sqrt{2}\right)}\right) \cdot \sqrt{z} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \left(\left(\sqrt{2} \cdot x\right) \cdot \frac{1}{2}\right) \cdot \sqrt{z} \]
      5. lift-*.f6449.5

        \[\leadsto \left(\left(\sqrt{2} \cdot x\right) \cdot 0.5\right) \cdot \sqrt{z} \]
    8. Applied rewrites49.5%

      \[\leadsto \left(\left(\sqrt{2} \cdot x\right) \cdot \color{blue}{0.5}\right) \cdot \sqrt{z} \]

    if -1.1999999999999999e51 < x < 8.5000000000000004e109

    1. Initial program 99.1%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites75.9%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
    5. Taylor expanded in t around 0

      \[\leadsto \left(-\sqrt{2 \cdot z}\right) \cdot y \]
    6. Step-by-step derivation
      1. count-2-revN/A

        \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
      2. lift-+.f6438.1

        \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
    7. Applied rewrites38.1%

      \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]

    if 8.5000000000000004e109 < x

    1. Initial program 99.8%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\sqrt{z} \cdot \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot x - y\right)} \]
      2. sqrt-prodN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right) \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot \frac{1}{2} - y\right) \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot \frac{1}{2} - y\right)} \]
      5. lift-sqrt.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x \cdot \frac{1}{2}} - y\right) \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      7. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      8. *-commutativeN/A

        \[\leadsto \sqrt{2 \cdot z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      9. count-2-revN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      10. lower-+.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      11. lift--.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(x \cdot \frac{1}{2} - \color{blue}{y}\right) \]
      12. *-commutativeN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\frac{1}{2} \cdot x - y\right) \]
      13. lower-*.f6462.5

        \[\leadsto \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \]
    4. Applied rewrites62.5%

      \[\leadsto \color{blue}{\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)} \]
    5. Taylor expanded in x around inf

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

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      2. pow1/2N/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(\color{blue}{x} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      3. metadata-evalN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      4. pow-flipN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(\color{blue}{x} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      5. lift-+.f64N/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{\color{blue}{2}}\right) \cdot \sqrt{z}\right) \]
      7. *-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(\color{blue}{\left(x \cdot \sqrt{2}\right)} \cdot \sqrt{z}\right) \]
      8. *-commutativeN/A

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

        \[\leadsto \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \frac{1}{2} \]
      10. associate-*l*N/A

        \[\leadsto \left(x \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right) \cdot \frac{1}{2} \]
      11. *-commutativeN/A

        \[\leadsto \left(x \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{1}{2} \]
      12. lower-*.f64N/A

        \[\leadsto \left(x \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{1}{2} \]
      13. sqrt-prodN/A

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

        \[\leadsto \left(x \cdot \sqrt{2 \cdot z}\right) \cdot \frac{1}{2} \]
      15. lower-sqrt.f64N/A

        \[\leadsto \left(x \cdot \sqrt{2 \cdot z}\right) \cdot \frac{1}{2} \]
      16. count-2-revN/A

        \[\leadsto \left(x \cdot \sqrt{z + z}\right) \cdot \frac{1}{2} \]
      17. lift-+.f6452.7

        \[\leadsto \left(x \cdot \sqrt{z + z}\right) \cdot 0.5 \]
    7. Applied rewrites52.7%

      \[\leadsto \left(x \cdot \sqrt{z + z}\right) \cdot \color{blue}{0.5} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 42.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z + z}\\ t_2 := \left(x \cdot t\_1\right) \cdot 0.5\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+51}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+109}:\\ \;\;\;\;\left(-t\_1\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ z z))) (t_2 (* (* x t_1) 0.5)))
   (if (<= x -1.2e+51) t_2 (if (<= x 8.5e+109) (* (- t_1) y) t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z + z));
	double t_2 = (x * t_1) * 0.5;
	double tmp;
	if (x <= -1.2e+51) {
		tmp = t_2;
	} else if (x <= 8.5e+109) {
		tmp = -t_1 * y;
	} else {
		tmp = t_2;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((z + z))
    t_2 = (x * t_1) * 0.5d0
    if (x <= (-1.2d+51)) then
        tmp = t_2
    else if (x <= 8.5d+109) then
        tmp = -t_1 * y
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z + z));
	double t_2 = (x * t_1) * 0.5;
	double tmp;
	if (x <= -1.2e+51) {
		tmp = t_2;
	} else if (x <= 8.5e+109) {
		tmp = -t_1 * y;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z + z))
	t_2 = (x * t_1) * 0.5
	tmp = 0
	if x <= -1.2e+51:
		tmp = t_2
	elif x <= 8.5e+109:
		tmp = -t_1 * y
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z + z))
	t_2 = Float64(Float64(x * t_1) * 0.5)
	tmp = 0.0
	if (x <= -1.2e+51)
		tmp = t_2;
	elseif (x <= 8.5e+109)
		tmp = Float64(Float64(-t_1) * y);
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z + z));
	t_2 = (x * t_1) * 0.5;
	tmp = 0.0;
	if (x <= -1.2e+51)
		tmp = t_2;
	elseif (x <= 8.5e+109)
		tmp = -t_1 * y;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * t$95$1), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -1.2e+51], t$95$2, If[LessEqual[x, 8.5e+109], N[((-t$95$1) * y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \left(x \cdot t\_1\right) \cdot 0.5\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+51}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 8.5 \cdot 10^{+109}:\\
\;\;\;\;\left(-t\_1\right) \cdot y\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1999999999999999e51 or 8.5000000000000004e109 < x

    1. Initial program 99.8%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\sqrt{z} \cdot \left(\sqrt{2} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot x - y\right)} \]
      2. sqrt-prodN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{\frac{1}{2} \cdot x} - y\right) \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot \frac{1}{2} - y\right) \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot \frac{1}{2} - y\right)} \]
      5. lift-sqrt.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x \cdot \frac{1}{2}} - y\right) \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      7. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      8. *-commutativeN/A

        \[\leadsto \sqrt{2 \cdot z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      9. count-2-revN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      10. lower-+.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(\color{blue}{x} \cdot \frac{1}{2} - y\right) \]
      11. lift--.f64N/A

        \[\leadsto \sqrt{z + z} \cdot \left(x \cdot \frac{1}{2} - \color{blue}{y}\right) \]
      12. *-commutativeN/A

        \[\leadsto \sqrt{z + z} \cdot \left(\frac{1}{2} \cdot x - y\right) \]
      13. lower-*.f6461.0

        \[\leadsto \sqrt{z + z} \cdot \left(0.5 \cdot x - y\right) \]
    4. Applied rewrites61.0%

      \[\leadsto \color{blue}{\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)} \]
    5. Taylor expanded in x around inf

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

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      2. pow1/2N/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(\color{blue}{x} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      3. metadata-evalN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      4. pow-flipN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(\color{blue}{x} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      5. lift-+.f64N/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(\left(x \cdot \sqrt{\color{blue}{2}}\right) \cdot \sqrt{z}\right) \]
      7. *-commutativeN/A

        \[\leadsto \frac{1}{2} \cdot \left(\color{blue}{\left(x \cdot \sqrt{2}\right)} \cdot \sqrt{z}\right) \]
      8. *-commutativeN/A

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

        \[\leadsto \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \frac{1}{2} \]
      10. associate-*l*N/A

        \[\leadsto \left(x \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right) \cdot \frac{1}{2} \]
      11. *-commutativeN/A

        \[\leadsto \left(x \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{1}{2} \]
      12. lower-*.f64N/A

        \[\leadsto \left(x \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \frac{1}{2} \]
      13. sqrt-prodN/A

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

        \[\leadsto \left(x \cdot \sqrt{2 \cdot z}\right) \cdot \frac{1}{2} \]
      15. lower-sqrt.f64N/A

        \[\leadsto \left(x \cdot \sqrt{2 \cdot z}\right) \cdot \frac{1}{2} \]
      16. count-2-revN/A

        \[\leadsto \left(x \cdot \sqrt{z + z}\right) \cdot \frac{1}{2} \]
      17. lift-+.f6451.0

        \[\leadsto \left(x \cdot \sqrt{z + z}\right) \cdot 0.5 \]
    7. Applied rewrites51.0%

      \[\leadsto \left(x \cdot \sqrt{z + z}\right) \cdot \color{blue}{0.5} \]

    if -1.1999999999999999e51 < x < 8.5000000000000004e109

    1. Initial program 99.1%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
      7. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    4. Applied rewrites75.9%

      \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
    5. Taylor expanded in t around 0

      \[\leadsto \left(-\sqrt{2 \cdot z}\right) \cdot y \]
    6. Step-by-step derivation
      1. count-2-revN/A

        \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
      2. lift-+.f6438.1

        \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
    7. Applied rewrites38.1%

      \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 29.2% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \left(-\sqrt{z + z}\right) \cdot y \end{array} \]
(FPCore (x y z t) :precision binary64 (* (- (sqrt (+ z z))) y))
double code(double x, double y, double z, double t) {
	return -sqrt((z + z)) * y;
}
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, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -sqrt((z + z)) * y
end function
public static double code(double x, double y, double z, double t) {
	return -Math.sqrt((z + z)) * y;
}
def code(x, y, z, t):
	return -math.sqrt((z + z)) * y
function code(x, y, z, t)
	return Float64(Float64(-sqrt(Float64(z + z))) * y)
end
function tmp = code(x, y, z, t)
	tmp = -sqrt((z + z)) * y;
end
code[x_, y_, z_, t_] := N[((-N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision]
\begin{array}{l}

\\
\left(-\sqrt{z + z}\right) \cdot y
\end{array}
Derivation
  1. Initial program 99.3%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right)} \]
  3. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\left(y \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\right) \]
    2. associate-*l*N/A

      \[\leadsto \mathsf{neg}\left(y \cdot \left(\left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{neg}\left(y \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \]
    4. distribute-rgt-neg-inN/A

      \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right)} \]
    5. mul-1-negN/A

      \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)}\right) \]
    6. *-commutativeN/A

      \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
    7. lower-*.f64N/A

      \[\leadsto \left(-1 \cdot \left(\sqrt{z} \cdot \left(e^{\frac{1}{2} \cdot {t}^{2}} \cdot \sqrt{2}\right)\right)\right) \cdot \color{blue}{y} \]
  4. Applied rewrites62.9%

    \[\leadsto \color{blue}{\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y} \]
  5. Taylor expanded in t around 0

    \[\leadsto \left(-\sqrt{2 \cdot z}\right) \cdot y \]
  6. Step-by-step derivation
    1. count-2-revN/A

      \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
    2. lift-+.f6429.2

      \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
  7. Applied rewrites29.2%

    \[\leadsto \left(-\sqrt{z + z}\right) \cdot y \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2025114 
(FPCore (x y z t)
  :name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
  :precision binary64
  (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))