Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H

Percentage Accurate: 95.5% → 97.6%
Time: 4.5s
Alternatives: 19
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\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 19 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: 95.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}

Alternative 1: 97.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + t\_1 \leq 5 \cdot 10^{+291}:\\ \;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ t (* (* z 3.0) y))))
   (if (<= (+ (- x (/ y (* z 3.0))) t_1) 5e+291)
     (+ (- x (/ (/ y 3.0) z)) t_1)
     (fma (/ (- y (/ t y)) z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
	double t_1 = t / ((z * 3.0) * y);
	double tmp;
	if (((x - (y / (z * 3.0))) + t_1) <= 5e+291) {
		tmp = (x - ((y / 3.0) / z)) + t_1;
	} else {
		tmp = fma(((y - (t / y)) / z), -0.3333333333333333, x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(t / Float64(Float64(z * 3.0) * y))
	tmp = 0.0
	if (Float64(Float64(x - Float64(y / Float64(z * 3.0))) + t_1) <= 5e+291)
		tmp = Float64(Float64(x - Float64(Float64(y / 3.0) / z)) + t_1);
	else
		tmp = fma(Float64(Float64(y - Float64(t / y)) / z), -0.3333333333333333, x);
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], 5e+291], N[(N[(x - N[(N[(y / 3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + t\_1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < 5.0000000000000001e291

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

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

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

        \[\leadsto \left(x - \frac{y}{\color{blue}{3 \cdot z}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      4. associate-/r*N/A

        \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{3}}{z}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      5. lower-/.f64N/A

        \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{3}}{z}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      6. lower-/.f6495.5

        \[\leadsto \left(x - \frac{\color{blue}{\frac{y}{3}}}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    3. Applied rewrites95.5%

      \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{3}}{z}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]

    if 5.0000000000000001e291 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y)))

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      3. mult-flip-revN/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right) \cdot \left(\frac{t}{y} - y\right)} + x \]
      5. mult-flip-revN/A

        \[\leadsto \color{blue}{\frac{\frac{1}{3}}{z}} \cdot \left(\frac{t}{y} - y\right) + x \]
      6. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{\mathsf{neg}\left(z\right)}} \cdot \left(\frac{t}{y} - y\right) + x \]
      7. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{3}}}{\mathsf{neg}\left(z\right)} \cdot \left(\frac{t}{y} - y\right) + x \]
      8. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \left(\frac{t}{y} - y\right)}{\mathsf{neg}\left(z\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{\frac{t}{y} - y}{\mathsf{neg}\left(z\right)}} + x \]
      10. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\frac{t}{y} - y}}{\mathsf{neg}\left(z\right)} + x \]
      11. sub-negate-revN/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)}}{\mathsf{neg}\left(z\right)} + x \]
      12. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right)}{\mathsf{neg}\left(z\right)} + x \]
      13. frac-2negN/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      15. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y - \frac{t}{y}}{z} \cdot \frac{-1}{3}} + x \]
      16. lower-fma.f6495.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
    7. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;t\_1 + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 5 \cdot 10^{+294}:\\ \;\;\;\;t\_1 + \frac{t}{\left(y \cdot z\right) \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= (+ t_1 (/ t (* (* z 3.0) y))) 5e+294)
     (+ t_1 (/ t (* (* y z) 3.0)))
     (fma (/ (- y (/ t y)) z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if ((t_1 + (t / ((z * 3.0) * y))) <= 5e+294) {
		tmp = t_1 + (t / ((y * z) * 3.0));
	} else {
		tmp = fma(((y - (t / y)) / z), -0.3333333333333333, x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (Float64(t_1 + Float64(t / Float64(Float64(z * 3.0) * y))) <= 5e+294)
		tmp = Float64(t_1 + Float64(t / Float64(Float64(y * z) * 3.0)));
	else
		tmp = fma(Float64(Float64(y - Float64(t / y)) / z), -0.3333333333333333, x);
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+294], N[(t$95$1 + N[(t / N[(N[(y * z), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t\_1 + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 5 \cdot 10^{+294}:\\
\;\;\;\;t\_1 + \frac{t}{\left(y \cdot z\right) \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < 4.9999999999999999e294

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \color{blue}{\left(z \cdot 3\right)}} \]
      4. associate-*r*N/A

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{\left(y \cdot z\right) \cdot 3}} \]
      5. lower-*.f64N/A

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{\left(y \cdot z\right) \cdot 3}} \]
      6. lower-*.f6495.5

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{\left(y \cdot z\right)} \cdot 3} \]
    3. Applied rewrites95.5%

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{\left(y \cdot z\right) \cdot 3}} \]

    if 4.9999999999999999e294 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y)))

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      3. mult-flip-revN/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right) \cdot \left(\frac{t}{y} - y\right)} + x \]
      5. mult-flip-revN/A

        \[\leadsto \color{blue}{\frac{\frac{1}{3}}{z}} \cdot \left(\frac{t}{y} - y\right) + x \]
      6. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{\mathsf{neg}\left(z\right)}} \cdot \left(\frac{t}{y} - y\right) + x \]
      7. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{3}}}{\mathsf{neg}\left(z\right)} \cdot \left(\frac{t}{y} - y\right) + x \]
      8. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \left(\frac{t}{y} - y\right)}{\mathsf{neg}\left(z\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{\frac{t}{y} - y}{\mathsf{neg}\left(z\right)}} + x \]
      10. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\frac{t}{y} - y}}{\mathsf{neg}\left(z\right)} + x \]
      11. sub-negate-revN/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)}}{\mathsf{neg}\left(z\right)} + x \]
      12. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right)}{\mathsf{neg}\left(z\right)} + x \]
      13. frac-2negN/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      15. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y - \frac{t}{y}}{z} \cdot \frac{-1}{3}} + x \]
      16. lower-fma.f6495.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
    7. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 97.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + t\_1 \leq 5 \cdot 10^{+291}:\\ \;\;\;\;\left(x - \frac{0.3333333333333333}{z} \cdot y\right) + t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ t (* (* z 3.0) y))))
   (if (<= (+ (- x (/ y (* z 3.0))) t_1) 5e+291)
     (+ (- x (* (/ 0.3333333333333333 z) y)) t_1)
     (fma (/ (- y (/ t y)) z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
	double t_1 = t / ((z * 3.0) * y);
	double tmp;
	if (((x - (y / (z * 3.0))) + t_1) <= 5e+291) {
		tmp = (x - ((0.3333333333333333 / z) * y)) + t_1;
	} else {
		tmp = fma(((y - (t / y)) / z), -0.3333333333333333, x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(t / Float64(Float64(z * 3.0) * y))
	tmp = 0.0
	if (Float64(Float64(x - Float64(y / Float64(z * 3.0))) + t_1) <= 5e+291)
		tmp = Float64(Float64(x - Float64(Float64(0.3333333333333333 / z) * y)) + t_1);
	else
		tmp = fma(Float64(Float64(y - Float64(t / y)) / z), -0.3333333333333333, x);
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], 5e+291], N[(N[(x - N[(N[(0.3333333333333333 / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\left(x - \frac{0.3333333333333333}{z} \cdot y\right) + t\_1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < 5.0000000000000001e291

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(x - \color{blue}{\frac{y}{z \cdot 3}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. div-flipN/A

        \[\leadsto \left(x - \color{blue}{\frac{1}{\frac{z \cdot 3}{y}}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-/r/N/A

        \[\leadsto \left(x - \color{blue}{\frac{1}{z \cdot 3} \cdot y}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      4. lower-*.f64N/A

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

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

        \[\leadsto \left(x - \frac{1}{\color{blue}{3 \cdot z}} \cdot y\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      7. associate-/r*N/A

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

        \[\leadsto \left(x - \color{blue}{\frac{\frac{1}{3}}{z}} \cdot y\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      9. metadata-eval95.4

        \[\leadsto \left(x - \frac{\color{blue}{0.3333333333333333}}{z} \cdot y\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    3. Applied rewrites95.4%

      \[\leadsto \left(x - \color{blue}{\frac{0.3333333333333333}{z} \cdot y}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]

    if 5.0000000000000001e291 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y)))

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      3. mult-flip-revN/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right) \cdot \left(\frac{t}{y} - y\right)} + x \]
      5. mult-flip-revN/A

        \[\leadsto \color{blue}{\frac{\frac{1}{3}}{z}} \cdot \left(\frac{t}{y} - y\right) + x \]
      6. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{\mathsf{neg}\left(z\right)}} \cdot \left(\frac{t}{y} - y\right) + x \]
      7. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{3}}}{\mathsf{neg}\left(z\right)} \cdot \left(\frac{t}{y} - y\right) + x \]
      8. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \left(\frac{t}{y} - y\right)}{\mathsf{neg}\left(z\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{\frac{t}{y} - y}{\mathsf{neg}\left(z\right)}} + x \]
      10. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\frac{t}{y} - y}}{\mathsf{neg}\left(z\right)} + x \]
      11. sub-negate-revN/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)}}{\mathsf{neg}\left(z\right)} + x \]
      12. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right)}{\mathsf{neg}\left(z\right)} + x \]
      13. frac-2negN/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      15. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y - \frac{t}{y}}{z} \cdot \frac{-1}{3}} + x \]
      16. lower-fma.f6495.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
    7. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 97.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 5 \cdot 10^{+291}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{y \cdot z}, 0.3333333333333333, x - \frac{y}{3 \cdot z}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))) 5e+291)
   (fma (/ t (* y z)) 0.3333333333333333 (- x (/ y (* 3.0 z))))
   (fma (/ (- y (/ t y)) z) -0.3333333333333333 x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))) <= 5e+291) {
		tmp = fma((t / (y * z)), 0.3333333333333333, (x - (y / (3.0 * z))));
	} else {
		tmp = fma(((y - (t / y)) / z), -0.3333333333333333, x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) <= 5e+291)
		tmp = fma(Float64(t / Float64(y * z)), 0.3333333333333333, Float64(x - Float64(y / Float64(3.0 * z))));
	else
		tmp = fma(Float64(Float64(y - Float64(t / y)) / z), -0.3333333333333333, x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+291], N[(N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y \cdot z}, 0.3333333333333333, x - \frac{y}{3 \cdot z}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < 5.0000000000000001e291

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \color{blue}{\frac{t}{\left(z \cdot 3\right) \cdot y}} + \left(x - \frac{y}{z \cdot 3}\right) \]
      4. mult-flipN/A

        \[\leadsto \color{blue}{t \cdot \frac{1}{\left(z \cdot 3\right) \cdot y}} + \left(x - \frac{y}{z \cdot 3}\right) \]
      5. associate-*r/N/A

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

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

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

        \[\leadsto \frac{t \cdot 1}{y \cdot \color{blue}{\left(z \cdot 3\right)}} + \left(x - \frac{y}{z \cdot 3}\right) \]
      9. associate-*r*N/A

        \[\leadsto \frac{t \cdot 1}{\color{blue}{\left(y \cdot z\right) \cdot 3}} + \left(x - \frac{y}{z \cdot 3}\right) \]
      10. times-fracN/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y \cdot z}, \frac{1}{3}, x - \frac{y}{z \cdot 3}\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y \cdot z}}, \frac{1}{3}, x - \frac{y}{z \cdot 3}\right) \]
      13. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{\color{blue}{y \cdot z}}, \frac{1}{3}, x - \frac{y}{z \cdot 3}\right) \]
      14. metadata-eval95.4

        \[\leadsto \mathsf{fma}\left(\frac{t}{y \cdot z}, \color{blue}{0.3333333333333333}, x - \frac{y}{z \cdot 3}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y \cdot z}, \frac{1}{3}, x - \frac{y}{\color{blue}{z \cdot 3}}\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y \cdot z}, \frac{1}{3}, x - \frac{y}{\color{blue}{3 \cdot z}}\right) \]
      17. lower-*.f6495.4

        \[\leadsto \mathsf{fma}\left(\frac{t}{y \cdot z}, 0.3333333333333333, x - \frac{y}{\color{blue}{3 \cdot z}}\right) \]
    3. Applied rewrites95.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y \cdot z}, 0.3333333333333333, x - \frac{y}{3 \cdot z}\right)} \]

    if 5.0000000000000001e291 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y)))

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      3. mult-flip-revN/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right) \cdot \left(\frac{t}{y} - y\right)} + x \]
      5. mult-flip-revN/A

        \[\leadsto \color{blue}{\frac{\frac{1}{3}}{z}} \cdot \left(\frac{t}{y} - y\right) + x \]
      6. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{\mathsf{neg}\left(z\right)}} \cdot \left(\frac{t}{y} - y\right) + x \]
      7. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{3}}}{\mathsf{neg}\left(z\right)} \cdot \left(\frac{t}{y} - y\right) + x \]
      8. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \left(\frac{t}{y} - y\right)}{\mathsf{neg}\left(z\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{\frac{t}{y} - y}{\mathsf{neg}\left(z\right)}} + x \]
      10. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\frac{t}{y} - y}}{\mathsf{neg}\left(z\right)} + x \]
      11. sub-negate-revN/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)}}{\mathsf{neg}\left(z\right)} + x \]
      12. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right)}{\mathsf{neg}\left(z\right)} + x \]
      13. frac-2negN/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      15. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y - \frac{t}{y}}{z} \cdot \frac{-1}{3}} + x \]
      16. lower-fma.f6495.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
    7. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 97.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{-64}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-138}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -2.9e-64)
   (fma (- (/ t y) y) (/ 0.3333333333333333 z) x)
   (if (<= y 7e-138)
     (/ (fma 0.3333333333333333 (/ t z) (* x y)) y)
     (- x (/ (- y (/ t y)) (* 3.0 z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2.9e-64) {
		tmp = fma(((t / y) - y), (0.3333333333333333 / z), x);
	} else if (y <= 7e-138) {
		tmp = fma(0.3333333333333333, (t / z), (x * y)) / y;
	} else {
		tmp = x - ((y - (t / y)) / (3.0 * z));
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -2.9e-64)
		tmp = fma(Float64(Float64(t / y) - y), Float64(0.3333333333333333 / z), x);
	elseif (y <= 7e-138)
		tmp = Float64(fma(0.3333333333333333, Float64(t / z), Float64(x * y)) / y);
	else
		tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z)));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.9e-64], N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 7e-138], N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)\\

\mathbf{elif}\;y \leq 7 \cdot 10^{-138}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.8999999999999999e-64

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]

    if -2.8999999999999999e-64 < y < 6.9999999999999997e-138

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around 0

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

        \[\leadsto \frac{\frac{1}{3} \cdot \frac{t}{z} + x \cdot y}{\color{blue}{y}} \]
      2. lower-fma.f64N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{z}, x \cdot y\right)}{y} \]
      4. lower-*.f6461.3

        \[\leadsto \frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y} \]
    4. Applied rewrites61.3%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y}} \]

    if 6.9999999999999997e-138 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 97.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{-64}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-138}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -2.9e-64)
   (fma (- (/ t y) y) (/ 0.3333333333333333 z) x)
   (if (<= y 8e-138)
     (/ (fma 0.3333333333333333 (/ t z) (* x y)) y)
     (fma (/ (- y (/ t y)) z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2.9e-64) {
		tmp = fma(((t / y) - y), (0.3333333333333333 / z), x);
	} else if (y <= 8e-138) {
		tmp = fma(0.3333333333333333, (t / z), (x * y)) / y;
	} else {
		tmp = fma(((y - (t / y)) / z), -0.3333333333333333, x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -2.9e-64)
		tmp = fma(Float64(Float64(t / y) - y), Float64(0.3333333333333333 / z), x);
	elseif (y <= 8e-138)
		tmp = Float64(fma(0.3333333333333333, Float64(t / z), Float64(x * y)) / y);
	else
		tmp = fma(Float64(Float64(y - Float64(t / y)) / z), -0.3333333333333333, x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.9e-64], N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 8e-138], N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)\\

\mathbf{elif}\;y \leq 8 \cdot 10^{-138}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.8999999999999999e-64

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]

    if -2.8999999999999999e-64 < y < 8.00000000000000054e-138

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around 0

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

        \[\leadsto \frac{\frac{1}{3} \cdot \frac{t}{z} + x \cdot y}{\color{blue}{y}} \]
      2. lower-fma.f64N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{z}, x \cdot y\right)}{y} \]
      4. lower-*.f6461.3

        \[\leadsto \frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y} \]
    4. Applied rewrites61.3%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, x \cdot y\right)}{y}} \]

    if 8.00000000000000054e-138 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      3. mult-flip-revN/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right) \cdot \left(\frac{t}{y} - y\right)} + x \]
      5. mult-flip-revN/A

        \[\leadsto \color{blue}{\frac{\frac{1}{3}}{z}} \cdot \left(\frac{t}{y} - y\right) + x \]
      6. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{\mathsf{neg}\left(z\right)}} \cdot \left(\frac{t}{y} - y\right) + x \]
      7. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{3}}}{\mathsf{neg}\left(z\right)} \cdot \left(\frac{t}{y} - y\right) + x \]
      8. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \left(\frac{t}{y} - y\right)}{\mathsf{neg}\left(z\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{\frac{t}{y} - y}{\mathsf{neg}\left(z\right)}} + x \]
      10. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\frac{t}{y} - y}}{\mathsf{neg}\left(z\right)} + x \]
      11. sub-negate-revN/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)}}{\mathsf{neg}\left(z\right)} + x \]
      12. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right)}{\mathsf{neg}\left(z\right)} + x \]
      13. frac-2negN/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
      15. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y - \frac{t}{y}}{z} \cdot \frac{-1}{3}} + x \]
      16. lower-fma.f6495.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
    7. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 95.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (/ (- y (/ t y)) z) -0.3333333333333333 x))
double code(double x, double y, double z, double t) {
	return fma(((y - (t / y)) / z), -0.3333333333333333, x);
}
function code(x, y, z, t)
	return fma(Float64(Float64(y - Float64(t / y)) / z), -0.3333333333333333, x)
end
code[x_, y_, z_, t_] := N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)
\end{array}
Derivation
  1. Initial program 95.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

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

      \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    3. associate-+l-N/A

      \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    4. lower--.f64N/A

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

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

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

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

      \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
    9. associate-/r*N/A

      \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
    10. sub-divN/A

      \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    11. lower-/.f64N/A

      \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    12. lower--.f64N/A

      \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
    13. lower-/.f6495.9

      \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
    14. lift-*.f64N/A

      \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
    15. *-commutativeN/A

      \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    16. lower-*.f6495.9

      \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
  3. Applied rewrites95.9%

    \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    2. sub-flipN/A

      \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
    4. lift-/.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
    5. mult-flipN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
    6. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
    7. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
    8. associate-/r*N/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
    9. metadata-evalN/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
    10. mult-flip-revN/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
    11. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
    12. lift--.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
    13. sub-negate-revN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
    14. lower--.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
    15. mult-flip-revN/A

      \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
    16. lower-/.f6495.9

      \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
  5. Applied rewrites95.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
  6. Step-by-step derivation
    1. lift-fma.f64N/A

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

      \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
    3. mult-flip-revN/A

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

      \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right) \cdot \left(\frac{t}{y} - y\right)} + x \]
    5. mult-flip-revN/A

      \[\leadsto \color{blue}{\frac{\frac{1}{3}}{z}} \cdot \left(\frac{t}{y} - y\right) + x \]
    6. frac-2negN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{\mathsf{neg}\left(z\right)}} \cdot \left(\frac{t}{y} - y\right) + x \]
    7. metadata-evalN/A

      \[\leadsto \frac{\color{blue}{\frac{-1}{3}}}{\mathsf{neg}\left(z\right)} \cdot \left(\frac{t}{y} - y\right) + x \]
    8. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \left(\frac{t}{y} - y\right)}{\mathsf{neg}\left(z\right)}} + x \]
    9. associate-*r/N/A

      \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{\frac{t}{y} - y}{\mathsf{neg}\left(z\right)}} + x \]
    10. lift--.f64N/A

      \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\frac{t}{y} - y}}{\mathsf{neg}\left(z\right)} + x \]
    11. sub-negate-revN/A

      \[\leadsto \frac{-1}{3} \cdot \frac{\color{blue}{\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)}}{\mathsf{neg}\left(z\right)} + x \]
    12. lift--.f64N/A

      \[\leadsto \frac{-1}{3} \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right)}{\mathsf{neg}\left(z\right)} + x \]
    13. frac-2negN/A

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
    14. lift-/.f64N/A

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y - \frac{t}{y}}{z}} + x \]
    15. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{y - \frac{t}{y}}{z} \cdot \frac{-1}{3}} + x \]
    16. lower-fma.f6495.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  7. Applied rewrites95.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \frac{t}{y}}{z}, -0.3333333333333333, x\right)} \]
  8. Add Preprocessing

Alternative 8: 95.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (- (/ t y) y) (/ 0.3333333333333333 z) x))
double code(double x, double y, double z, double t) {
	return fma(((t / y) - y), (0.3333333333333333 / z), x);
}
function code(x, y, z, t)
	return fma(Float64(Float64(t / y) - y), Float64(0.3333333333333333 / z), x)
end
code[x_, y_, z_, t_] := N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)
\end{array}
Derivation
  1. Initial program 95.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

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

      \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    3. associate-+l-N/A

      \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    4. lower--.f64N/A

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

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

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

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

      \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
    9. associate-/r*N/A

      \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
    10. sub-divN/A

      \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    11. lower-/.f64N/A

      \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    12. lower--.f64N/A

      \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
    13. lower-/.f6495.9

      \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
    14. lift-*.f64N/A

      \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
    15. *-commutativeN/A

      \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    16. lower-*.f6495.9

      \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
  3. Applied rewrites95.9%

    \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    2. sub-flipN/A

      \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
    4. lift-/.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
    5. mult-flipN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
    6. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
    7. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
    8. associate-/r*N/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
    9. metadata-evalN/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
    10. mult-flip-revN/A

      \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
    11. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
    12. lift--.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
    13. sub-negate-revN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
    14. lower--.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
    15. mult-flip-revN/A

      \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
    16. lower-/.f6495.9

      \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
  5. Applied rewrites95.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
  6. Add Preprocessing

Alternative 9: 89.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;y \leq -1.15 \cdot 10^{+14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+46}:\\ \;\;\;\;x - -0.3333333333333333 \cdot \frac{t}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= y -1.15e+14)
     t_1
     (if (<= y 3.5e+46) (- x (* -0.3333333333333333 (/ t (* y z)))) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.15e+14) {
		tmp = t_1;
	} else if (y <= 3.5e+46) {
		tmp = x - (-0.3333333333333333 * (t / (y * z)));
	} else {
		tmp = t_1;
	}
	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 = x - (y / (z * 3.0d0))
    if (y <= (-1.15d+14)) then
        tmp = t_1
    else if (y <= 3.5d+46) then
        tmp = x - ((-0.3333333333333333d0) * (t / (y * z)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.15e+14) {
		tmp = t_1;
	} else if (y <= 3.5e+46) {
		tmp = x - (-0.3333333333333333 * (t / (y * z)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x - (y / (z * 3.0))
	tmp = 0
	if y <= -1.15e+14:
		tmp = t_1
	elif y <= 3.5e+46:
		tmp = x - (-0.3333333333333333 * (t / (y * z)))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (y <= -1.15e+14)
		tmp = t_1;
	elseif (y <= 3.5e+46)
		tmp = Float64(x - Float64(-0.3333333333333333 * Float64(t / Float64(y * z))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (y / (z * 3.0));
	tmp = 0.0;
	if (y <= -1.15e+14)
		tmp = t_1;
	elseif (y <= 3.5e+46)
		tmp = x - (-0.3333333333333333 * (t / (y * z)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.15e+14], t$95$1, If[LessEqual[y, 3.5e+46], N[(x - N[(-0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+46}:\\
\;\;\;\;x - -0.3333333333333333 \cdot \frac{t}{y \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.15e14 or 3.49999999999999985e46 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

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

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

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

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

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
      5. *-commutativeN/A

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
      7. metadata-evalN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
      8. lower-fma.f6460.1

        \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    6. Applied rewrites60.1%

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
      4. sum-to-multN/A

        \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
      5. associate-*l*N/A

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

        \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      7. associate-/l/N/A

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

        \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      9. sum-to-multN/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      12. lift-/.f64N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      13. mult-flipN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      15. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      17. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      18. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      19. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      20. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right) + x \]
      21. +-commutativeN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right)} \]
    8. Applied rewrites64.4%

      \[\leadsto x - \color{blue}{\frac{y}{z \cdot 3}} \]

    if -1.15e14 < y < 3.49999999999999985e46

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Taylor expanded in y around 0

      \[\leadsto x - \color{blue}{\frac{-1}{3} \cdot \frac{t}{y \cdot z}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x - \frac{-1}{3} \cdot \color{blue}{\frac{t}{y \cdot z}} \]
      2. lower-/.f64N/A

        \[\leadsto x - \frac{-1}{3} \cdot \frac{t}{\color{blue}{y \cdot z}} \]
      3. lower-*.f6463.1

        \[\leadsto x - -0.3333333333333333 \cdot \frac{t}{y \cdot \color{blue}{z}} \]
    6. Applied rewrites63.1%

      \[\leadsto x - \color{blue}{-0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 89.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;y \leq -2.35 \cdot 10^{+14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+46}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{y}, \frac{0.3333333333333333}{z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= y -2.35e+14)
     t_1
     (if (<= y 3.5e+46) (fma (/ t y) (/ 0.3333333333333333 z) x) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -2.35e+14) {
		tmp = t_1;
	} else if (y <= 3.5e+46) {
		tmp = fma((t / y), (0.3333333333333333 / z), x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (y <= -2.35e+14)
		tmp = t_1;
	elseif (y <= 3.5e+46)
		tmp = fma(Float64(t / y), Float64(0.3333333333333333 / z), x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.35e+14], t$95$1, If[LessEqual[y, 3.5e+46], N[(N[(t / y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;y \leq -2.35 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y}, \frac{0.3333333333333333}{z}, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.35e14 or 3.49999999999999985e46 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

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

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

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

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

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
      5. *-commutativeN/A

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
      7. metadata-evalN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
      8. lower-fma.f6460.1

        \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    6. Applied rewrites60.1%

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
      4. sum-to-multN/A

        \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
      5. associate-*l*N/A

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

        \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      7. associate-/l/N/A

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

        \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      9. sum-to-multN/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      12. lift-/.f64N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      13. mult-flipN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      15. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      17. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      18. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      19. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      20. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right) + x \]
      21. +-commutativeN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right)} \]
    8. Applied rewrites64.4%

      \[\leadsto x - \color{blue}{\frac{y}{z \cdot 3}} \]

    if -2.35e14 < y < 3.49999999999999985e46

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(x - \frac{y}{z \cdot 3}\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      3. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      4. lower--.f64N/A

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

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

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

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

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \frac{t}{\color{blue}{y \cdot \left(z \cdot 3\right)}}\right) \]
      9. associate-/r*N/A

        \[\leadsto x - \left(\frac{y}{z \cdot 3} - \color{blue}{\frac{\frac{t}{y}}{z \cdot 3}}\right) \]
      10. sub-divN/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      11. lower-/.f64N/A

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
      12. lower--.f64N/A

        \[\leadsto x - \frac{\color{blue}{y - \frac{t}{y}}}{z \cdot 3} \]
      13. lower-/.f6495.9

        \[\leadsto x - \frac{y - \color{blue}{\frac{t}{y}}}{z \cdot 3} \]
      14. lift-*.f64N/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{z \cdot 3}} \]
      15. *-commutativeN/A

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
      16. lower-*.f6495.9

        \[\leadsto x - \frac{y - \frac{t}{y}}{\color{blue}{3 \cdot z}} \]
    3. Applied rewrites95.9%

      \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{3 \cdot z}} \]
      2. sub-flipN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{y - \frac{t}{y}}{3 \cdot z}\right)\right) + x} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{y - \frac{t}{y}}{3 \cdot z}}\right)\right) + x \]
      5. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{1}{3 \cdot z}}\right)\right) + x \]
      6. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{3 \cdot z}} + x \]
      7. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{1}{\color{blue}{3 \cdot z}} + x \]
      8. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{z}} + x \]
      9. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} + x \]
      10. mult-flip-revN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{z}\right)} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y - \frac{t}{y}\right)\right), \frac{1}{3} \cdot \frac{1}{z}, x\right)} \]
      12. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y - \frac{t}{y}\right)}\right), \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      13. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y} - y}, \frac{1}{3} \cdot \frac{1}{z}, x\right) \]
      15. mult-flip-revN/A

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{\frac{1}{3}}{z}}, x\right) \]
      16. lower-/.f6495.9

        \[\leadsto \mathsf{fma}\left(\frac{t}{y} - y, \color{blue}{\frac{0.3333333333333333}{z}}, x\right) \]
    5. Applied rewrites95.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{y} - y, \frac{0.3333333333333333}{z}, x\right)} \]
    6. Taylor expanded in y around 0

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y}}, \frac{\frac{1}{3}}{z}, x\right) \]
    7. Step-by-step derivation
      1. lower-/.f6462.7

        \[\leadsto \mathsf{fma}\left(\frac{t}{\color{blue}{y}}, \frac{0.3333333333333333}{z}, x\right) \]
    8. Applied rewrites62.7%

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{t}{y}}, \frac{0.3333333333333333}{z}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 77.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{-84}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-96}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= y -1.35e-84)
     t_1
     (if (<= y 1.85e-96) (* 0.3333333333333333 (/ (/ t z) y)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.35e-84) {
		tmp = t_1;
	} else if (y <= 1.85e-96) {
		tmp = 0.3333333333333333 * ((t / z) / y);
	} else {
		tmp = t_1;
	}
	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 = x - (y / (z * 3.0d0))
    if (y <= (-1.35d-84)) then
        tmp = t_1
    else if (y <= 1.85d-96) then
        tmp = 0.3333333333333333d0 * ((t / z) / y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.35e-84) {
		tmp = t_1;
	} else if (y <= 1.85e-96) {
		tmp = 0.3333333333333333 * ((t / z) / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x - (y / (z * 3.0))
	tmp = 0
	if y <= -1.35e-84:
		tmp = t_1
	elif y <= 1.85e-96:
		tmp = 0.3333333333333333 * ((t / z) / y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (y <= -1.35e-84)
		tmp = t_1;
	elseif (y <= 1.85e-96)
		tmp = Float64(0.3333333333333333 * Float64(Float64(t / z) / y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (y / (z * 3.0));
	tmp = 0.0;
	if (y <= -1.35e-84)
		tmp = t_1;
	elseif (y <= 1.85e-96)
		tmp = 0.3333333333333333 * ((t / z) / y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.35e-84], t$95$1, If[LessEqual[y, 1.85e-96], N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-96}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.35e-84 or 1.84999999999999993e-96 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

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

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

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

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

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
      5. *-commutativeN/A

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
      7. metadata-evalN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
      8. lower-fma.f6460.1

        \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    6. Applied rewrites60.1%

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
      4. sum-to-multN/A

        \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
      5. associate-*l*N/A

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

        \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      7. associate-/l/N/A

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

        \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      9. sum-to-multN/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      12. lift-/.f64N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      13. mult-flipN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      15. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      17. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      18. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      19. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      20. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right) + x \]
      21. +-commutativeN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right)} \]
    8. Applied rewrites64.4%

      \[\leadsto x - \color{blue}{\frac{y}{z \cdot 3}} \]

    if -1.35e-84 < y < 1.84999999999999993e-96

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \color{blue}{\frac{t}{y \cdot z}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{\color{blue}{y \cdot z}} \]
      3. lower-*.f6434.8

        \[\leadsto 0.3333333333333333 \cdot \frac{t}{y \cdot \color{blue}{z}} \]
    4. Applied rewrites34.8%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{\color{blue}{y \cdot z}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{y \cdot \color{blue}{z}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{z \cdot \color{blue}{y}} \]
      4. associate-/r*N/A

        \[\leadsto \frac{1}{3} \cdot \frac{\frac{t}{z}}{\color{blue}{y}} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{\frac{t}{z}}{\color{blue}{y}} \]
      6. lower-/.f6438.1

        \[\leadsto 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y} \]
    6. Applied rewrites38.1%

      \[\leadsto 0.3333333333333333 \cdot \frac{\frac{t}{z}}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 76.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{-84}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.78 \cdot 10^{-96}:\\ \;\;\;\;\frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= y -1.35e-84) t_1 (if (<= y 1.78e-96) (/ t (* (* z 3.0) y)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.35e-84) {
		tmp = t_1;
	} else if (y <= 1.78e-96) {
		tmp = t / ((z * 3.0) * y);
	} else {
		tmp = t_1;
	}
	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 = x - (y / (z * 3.0d0))
    if (y <= (-1.35d-84)) then
        tmp = t_1
    else if (y <= 1.78d-96) then
        tmp = t / ((z * 3.0d0) * y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.35e-84) {
		tmp = t_1;
	} else if (y <= 1.78e-96) {
		tmp = t / ((z * 3.0) * y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x - (y / (z * 3.0))
	tmp = 0
	if y <= -1.35e-84:
		tmp = t_1
	elif y <= 1.78e-96:
		tmp = t / ((z * 3.0) * y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (y <= -1.35e-84)
		tmp = t_1;
	elseif (y <= 1.78e-96)
		tmp = Float64(t / Float64(Float64(z * 3.0) * y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (y / (z * 3.0));
	tmp = 0.0;
	if (y <= -1.35e-84)
		tmp = t_1;
	elseif (y <= 1.78e-96)
		tmp = t / ((z * 3.0) * y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.35e-84], t$95$1, If[LessEqual[y, 1.78e-96], N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.78 \cdot 10^{-96}:\\
\;\;\;\;\frac{t}{\left(z \cdot 3\right) \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.35e-84 or 1.78000000000000008e-96 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

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

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

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

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

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
      5. *-commutativeN/A

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
      7. metadata-evalN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
      8. lower-fma.f6460.1

        \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    6. Applied rewrites60.1%

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
      4. sum-to-multN/A

        \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
      5. associate-*l*N/A

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

        \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      7. associate-/l/N/A

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

        \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      9. sum-to-multN/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      12. lift-/.f64N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      13. mult-flipN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      15. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      17. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      18. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      19. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      20. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right) + x \]
      21. +-commutativeN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right)} \]
    8. Applied rewrites64.4%

      \[\leadsto x - \color{blue}{\frac{y}{z \cdot 3}} \]

    if -1.35e-84 < y < 1.78000000000000008e-96

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \color{blue}{\frac{t}{y \cdot z}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{\color{blue}{y \cdot z}} \]
      3. lower-*.f6434.8

        \[\leadsto 0.3333333333333333 \cdot \frac{t}{y \cdot \color{blue}{z}} \]
    4. Applied rewrites34.8%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{\color{blue}{y \cdot z}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{y \cdot \color{blue}{z}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{z \cdot \color{blue}{y}} \]
      4. associate-/r*N/A

        \[\leadsto \frac{1}{3} \cdot \frac{\frac{t}{z}}{\color{blue}{y}} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{\frac{t}{z}}{\color{blue}{y}} \]
      6. lower-/.f6438.1

        \[\leadsto 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y} \]
    6. Applied rewrites38.1%

      \[\leadsto 0.3333333333333333 \cdot \frac{\frac{t}{z}}{\color{blue}{y}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \color{blue}{\frac{\frac{t}{z}}{y}} \]
      2. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{-1}{3}\right)\right) \cdot \frac{\color{blue}{\frac{t}{z}}}{y} \]
      3. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{neg}\left(\frac{-1}{3} \cdot \frac{\frac{t}{z}}{y}\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{neg}\left({-3}^{-1} \cdot \frac{\frac{t}{z}}{y}\right) \]
      5. lift-/.f64N/A

        \[\leadsto \mathsf{neg}\left({-3}^{-1} \cdot \frac{\frac{t}{z}}{y}\right) \]
      6. lift-/.f64N/A

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

        \[\leadsto \mathsf{neg}\left({-3}^{-1} \cdot \frac{t}{z \cdot y}\right) \]
      8. div-flipN/A

        \[\leadsto \mathsf{neg}\left({-3}^{-1} \cdot \frac{1}{\frac{z \cdot y}{t}}\right) \]
      9. inv-powN/A

        \[\leadsto \mathsf{neg}\left({-3}^{-1} \cdot {\left(\frac{z \cdot y}{t}\right)}^{-1}\right) \]
      10. unpow-prod-downN/A

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

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

        \[\leadsto \mathsf{neg}\left({\left(\frac{\left(-3 \cdot z\right) \cdot y}{t}\right)}^{-1}\right) \]
      13. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left({\left(\frac{\left(-3 \cdot z\right) \cdot y}{t}\right)}^{-1}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left({\left(\frac{\left(-3 \cdot z\right) \cdot y}{t}\right)}^{-1}\right) \]
      15. inv-powN/A

        \[\leadsto \mathsf{neg}\left(\frac{1}{\frac{\left(-3 \cdot z\right) \cdot y}{t}}\right) \]
      16. div-flipN/A

        \[\leadsto \mathsf{neg}\left(\frac{t}{\left(-3 \cdot z\right) \cdot y}\right) \]
      17. distribute-neg-frac2N/A

        \[\leadsto \frac{t}{\color{blue}{\mathsf{neg}\left(\left(-3 \cdot z\right) \cdot y\right)}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{t}{\mathsf{neg}\left(\left(-3 \cdot z\right) \cdot y\right)} \]
      19. lift-*.f64N/A

        \[\leadsto \frac{t}{\mathsf{neg}\left(\left(-3 \cdot z\right) \cdot y\right)} \]
      20. associate-*l*N/A

        \[\leadsto \frac{t}{\mathsf{neg}\left(-3 \cdot \left(z \cdot y\right)\right)} \]
      21. distribute-lft-neg-inN/A

        \[\leadsto \frac{t}{\left(\mathsf{neg}\left(-3\right)\right) \cdot \color{blue}{\left(z \cdot y\right)}} \]
      22. metadata-evalN/A

        \[\leadsto \frac{t}{3 \cdot \left(\color{blue}{z} \cdot y\right)} \]
      23. associate-*l*N/A

        \[\leadsto \frac{t}{\left(3 \cdot z\right) \cdot \color{blue}{y}} \]
      24. *-commutativeN/A

        \[\leadsto \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    8. Applied rewrites34.8%

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

Alternative 13: 76.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{-84}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.78 \cdot 10^{-96}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= y -1.35e-84)
     t_1
     (if (<= y 1.78e-96) (* 0.3333333333333333 (/ t (* y z))) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.35e-84) {
		tmp = t_1;
	} else if (y <= 1.78e-96) {
		tmp = 0.3333333333333333 * (t / (y * z));
	} else {
		tmp = t_1;
	}
	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 = x - (y / (z * 3.0d0))
    if (y <= (-1.35d-84)) then
        tmp = t_1
    else if (y <= 1.78d-96) then
        tmp = 0.3333333333333333d0 * (t / (y * z))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (y <= -1.35e-84) {
		tmp = t_1;
	} else if (y <= 1.78e-96) {
		tmp = 0.3333333333333333 * (t / (y * z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x - (y / (z * 3.0))
	tmp = 0
	if y <= -1.35e-84:
		tmp = t_1
	elif y <= 1.78e-96:
		tmp = 0.3333333333333333 * (t / (y * z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (y <= -1.35e-84)
		tmp = t_1;
	elseif (y <= 1.78e-96)
		tmp = Float64(0.3333333333333333 * Float64(t / Float64(y * z)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (y / (z * 3.0));
	tmp = 0.0;
	if (y <= -1.35e-84)
		tmp = t_1;
	elseif (y <= 1.78e-96)
		tmp = 0.3333333333333333 * (t / (y * z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.35e-84], t$95$1, If[LessEqual[y, 1.78e-96], N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.78 \cdot 10^{-96}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t}{y \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.35e-84 or 1.78000000000000008e-96 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

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

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

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

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

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
      5. *-commutativeN/A

        \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
      7. metadata-evalN/A

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
      8. lower-fma.f6460.1

        \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    6. Applied rewrites60.1%

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
      4. sum-to-multN/A

        \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
      5. associate-*l*N/A

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

        \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      7. associate-/l/N/A

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

        \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
      9. sum-to-multN/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      12. lift-/.f64N/A

        \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
      13. mult-flipN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      14. lift-/.f64N/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
      15. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      17. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
      18. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      19. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
      20. associate-/r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right) + x \]
      21. +-commutativeN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right)} \]
    8. Applied rewrites64.4%

      \[\leadsto x - \color{blue}{\frac{y}{z \cdot 3}} \]

    if -1.35e-84 < y < 1.78000000000000008e-96

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \color{blue}{\frac{t}{y \cdot z}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \frac{t}{\color{blue}{y \cdot z}} \]
      3. lower-*.f6434.8

        \[\leadsto 0.3333333333333333 \cdot \frac{t}{y \cdot \color{blue}{z}} \]
    4. Applied rewrites34.8%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 64.4% accurate, 2.2× speedup?

\[\begin{array}{l} \\ x - \frac{y}{z \cdot 3} \end{array} \]
(FPCore (x y z t) :precision binary64 (- x (/ y (* z 3.0))))
double code(double x, double y, double z, double t) {
	return x - (y / (z * 3.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 - (y / (z * 3.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return x - (y / (z * 3.0));
}
def code(x, y, z, t):
	return x - (y / (z * 3.0))
function code(x, y, z, t)
	return Float64(x - Float64(y / Float64(z * 3.0)))
end
function tmp = code(x, y, z, t)
	tmp = x - (y / (z * 3.0));
end
code[x_, y_, z_, t_] := N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \frac{y}{z \cdot 3}
\end{array}
Derivation
  1. Initial program 95.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Taylor expanded in y around inf

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

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

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

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

      \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
    5. lower-/.f6460.1

      \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
  4. Applied rewrites60.1%

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

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

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

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

      \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
    5. *-commutativeN/A

      \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
    6. distribute-rgt-neg-inN/A

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
    7. metadata-evalN/A

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
    8. lower-fma.f6460.1

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
  6. Applied rewrites60.1%

    \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

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

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

      \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
    4. sum-to-multN/A

      \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
    5. associate-*l*N/A

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

      \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
    7. associate-/l/N/A

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

      \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
    9. sum-to-multN/A

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

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
    11. associate-*l*N/A

      \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
    12. lift-/.f64N/A

      \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
    13. mult-flipN/A

      \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
    14. lift-/.f64N/A

      \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
    15. metadata-evalN/A

      \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + x \]
    16. distribute-rgt-neg-outN/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
    17. metadata-evalN/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right)\right) + x \]
    18. mult-flipN/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
    19. lift-/.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right)\right) + x \]
    20. associate-/r*N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right) + x \]
    21. +-commutativeN/A

      \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z \cdot 3}\right)\right)} \]
  8. Applied rewrites64.4%

    \[\leadsto x - \color{blue}{\frac{y}{z \cdot 3}} \]
  9. Add Preprocessing

Alternative 15: 64.3% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma (/ y z) -0.3333333333333333 x))
double code(double x, double y, double z, double t) {
	return fma((y / z), -0.3333333333333333, x);
}
function code(x, y, z, t)
	return fma(Float64(y / z), -0.3333333333333333, x)
end
code[x_, y_, z_, t_] := N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)
\end{array}
Derivation
  1. Initial program 95.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Taylor expanded in y around inf

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

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

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

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

      \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
    5. lower-/.f6460.1

      \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
  4. Applied rewrites60.1%

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

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

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

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

      \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right) \]
    5. *-commutativeN/A

      \[\leadsto y \cdot \left(\left(\mathsf{neg}\left(\frac{1}{z} \cdot \frac{1}{3}\right)\right) + \frac{x}{y}\right) \]
    6. distribute-rgt-neg-inN/A

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) + \frac{\color{blue}{x}}{y}\right) \]
    7. metadata-evalN/A

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \]
    8. lower-fma.f6460.1

      \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
  6. Applied rewrites60.1%

    \[\leadsto y \cdot \mathsf{fma}\left(\frac{1}{z}, \color{blue}{-0.3333333333333333}, \frac{x}{y}\right) \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

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

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

      \[\leadsto \left(\frac{1}{z} \cdot \frac{-1}{3} + \frac{x}{y}\right) \cdot y \]
    4. sum-to-multN/A

      \[\leadsto \left(\left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right)\right) \cdot y \]
    5. associate-*l*N/A

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

      \[\leadsto \left(1 + \frac{\frac{x}{y}}{\frac{1}{z} \cdot \frac{-1}{3}}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
    7. associate-/l/N/A

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

      \[\leadsto \left(1 + \frac{x}{\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y}\right) \cdot \left(\left(\frac{1}{z} \cdot \frac{-1}{3}\right) \cdot y\right) \]
    9. sum-to-multN/A

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

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) + x \]
    11. associate-*l*N/A

      \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
    12. lift-/.f64N/A

      \[\leadsto \left(y \cdot \frac{1}{z}\right) \cdot \frac{-1}{3} + x \]
    13. mult-flipN/A

      \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
    14. lift-/.f64N/A

      \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} + x \]
    15. lower-fma.f6464.3

      \[\leadsto \mathsf{fma}\left(\frac{y}{z}, \color{blue}{-0.3333333333333333}, x\right) \]
  8. Applied rewrites64.3%

    \[\leadsto \mathsf{fma}\left(\frac{y}{z}, \color{blue}{-0.3333333333333333}, x\right) \]
  9. Add Preprocessing

Alternative 16: 44.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.18 \cdot 10^{+33}:\\ \;\;\;\;\frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{-3 \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.18e+33)
   (/ -0.3333333333333333 (/ z y))
   (if (<= y 3.1e-12) (* y (/ x y)) (/ y (* -3.0 z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.18e+33) {
		tmp = -0.3333333333333333 / (z / y);
	} else if (y <= 3.1e-12) {
		tmp = y * (x / y);
	} else {
		tmp = y / (-3.0 * z);
	}
	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) :: tmp
    if (y <= (-1.18d+33)) then
        tmp = (-0.3333333333333333d0) / (z / y)
    else if (y <= 3.1d-12) then
        tmp = y * (x / y)
    else
        tmp = y / ((-3.0d0) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.18e+33) {
		tmp = -0.3333333333333333 / (z / y);
	} else if (y <= 3.1e-12) {
		tmp = y * (x / y);
	} else {
		tmp = y / (-3.0 * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -1.18e+33:
		tmp = -0.3333333333333333 / (z / y)
	elif y <= 3.1e-12:
		tmp = y * (x / y)
	else:
		tmp = y / (-3.0 * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.18e+33)
		tmp = Float64(-0.3333333333333333 / Float64(z / y));
	elseif (y <= 3.1e-12)
		tmp = Float64(y * Float64(x / y));
	else
		tmp = Float64(y / Float64(-3.0 * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.18e+33)
		tmp = -0.3333333333333333 / (z / y);
	elseif (y <= 3.1e-12)
		tmp = y * (x / y);
	else
		tmp = y / (-3.0 * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.18e+33], N[(-0.3333333333333333 / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e-12], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(-3.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.18 \cdot 10^{+33}:\\
\;\;\;\;\frac{-0.3333333333333333}{\frac{z}{y}}\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{-12}:\\
\;\;\;\;y \cdot \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{-3 \cdot z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.17999999999999993e33

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. lower-/.f6435.3

        \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
    7. Applied rewrites35.3%

      \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
    8. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
      2. lower-/.f6435.3

        \[\leadsto -0.3333333333333333 \cdot \frac{y}{z} \]
    10. Applied rewrites35.3%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{z} \]
      3. div-flipN/A

        \[\leadsto \frac{-1}{3} \cdot \frac{1}{\frac{z}{\color{blue}{y}}} \]
      4. mult-flip-revN/A

        \[\leadsto \frac{\frac{-1}{3}}{\frac{z}{\color{blue}{y}}} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\frac{-1}{3}}{\frac{z}{\color{blue}{y}}} \]
      6. lower-/.f6435.3

        \[\leadsto \frac{-0.3333333333333333}{\frac{z}{y}} \]
    12. Applied rewrites35.3%

      \[\leadsto \frac{-0.3333333333333333}{\frac{z}{\color{blue}{y}}} \]

    if -1.17999999999999993e33 < y < 3.1000000000000001e-12

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. lower-/.f6435.3

        \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
    7. Applied rewrites35.3%

      \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
    8. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto y \cdot \frac{\frac{-1}{3}}{z} \]
      2. metadata-evalN/A

        \[\leadsto y \cdot \frac{1 \cdot \frac{-1}{3}}{z} \]
      3. associate-*l/N/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) \]
      5. lower-*.f6435.2

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot -0.3333333333333333\right) \]
    9. Applied rewrites35.2%

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot -0.3333333333333333\right) \]
    10. Taylor expanded in x around inf

      \[\leadsto y \cdot \frac{x}{\color{blue}{y}} \]
    11. Step-by-step derivation
      1. lower-/.f6426.9

        \[\leadsto y \cdot \frac{x}{y} \]
    12. Applied rewrites26.9%

      \[\leadsto y \cdot \frac{x}{\color{blue}{y}} \]

    if 3.1000000000000001e-12 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. lower-/.f6435.3

        \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
    7. Applied rewrites35.3%

      \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
    8. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
      2. lower-/.f6435.3

        \[\leadsto -0.3333333333333333 \cdot \frac{y}{z} \]
    10. Applied rewrites35.3%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} \]
      3. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \]
      4. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right) \]
      6. mult-flipN/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right) \]
      7. lift-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{neg}\left(\frac{y}{z \cdot 3}\right) \]
      9. distribute-neg-frac2N/A

        \[\leadsto \frac{y}{\mathsf{neg}\left(z \cdot 3\right)} \]
      10. lower-/.f64N/A

        \[\leadsto \frac{y}{\mathsf{neg}\left(z \cdot 3\right)} \]
      11. *-commutativeN/A

        \[\leadsto \frac{y}{\mathsf{neg}\left(3 \cdot z\right)} \]
      12. distribute-lft-neg-inN/A

        \[\leadsto \frac{y}{\left(\mathsf{neg}\left(3\right)\right) \cdot z} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{y}{\left(\mathsf{neg}\left(3\right)\right) \cdot z} \]
      14. metadata-eval35.3

        \[\leadsto \frac{y}{-3 \cdot z} \]
    12. Applied rewrites35.3%

      \[\leadsto \frac{y}{-3 \cdot \color{blue}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 17: 44.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.18 \cdot 10^{+33}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{-3 \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.18e+33)
   (* y (/ -0.3333333333333333 z))
   (if (<= y 3.1e-12) (* y (/ x y)) (/ y (* -3.0 z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.18e+33) {
		tmp = y * (-0.3333333333333333 / z);
	} else if (y <= 3.1e-12) {
		tmp = y * (x / y);
	} else {
		tmp = y / (-3.0 * z);
	}
	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) :: tmp
    if (y <= (-1.18d+33)) then
        tmp = y * ((-0.3333333333333333d0) / z)
    else if (y <= 3.1d-12) then
        tmp = y * (x / y)
    else
        tmp = y / ((-3.0d0) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.18e+33) {
		tmp = y * (-0.3333333333333333 / z);
	} else if (y <= 3.1e-12) {
		tmp = y * (x / y);
	} else {
		tmp = y / (-3.0 * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -1.18e+33:
		tmp = y * (-0.3333333333333333 / z)
	elif y <= 3.1e-12:
		tmp = y * (x / y)
	else:
		tmp = y / (-3.0 * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.18e+33)
		tmp = Float64(y * Float64(-0.3333333333333333 / z));
	elseif (y <= 3.1e-12)
		tmp = Float64(y * Float64(x / y));
	else
		tmp = Float64(y / Float64(-3.0 * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.18e+33)
		tmp = y * (-0.3333333333333333 / z);
	elseif (y <= 3.1e-12)
		tmp = y * (x / y);
	else
		tmp = y / (-3.0 * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.18e+33], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e-12], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(-3.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.18 \cdot 10^{+33}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{-12}:\\
\;\;\;\;y \cdot \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{-3 \cdot z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.17999999999999993e33

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. lower-/.f6435.3

        \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
    7. Applied rewrites35.3%

      \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]

    if -1.17999999999999993e33 < y < 3.1000000000000001e-12

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. lower-/.f6435.3

        \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
    7. Applied rewrites35.3%

      \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
    8. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto y \cdot \frac{\frac{-1}{3}}{z} \]
      2. metadata-evalN/A

        \[\leadsto y \cdot \frac{1 \cdot \frac{-1}{3}}{z} \]
      3. associate-*l/N/A

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

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot \frac{-1}{3}\right) \]
      5. lower-*.f6435.2

        \[\leadsto y \cdot \left(\frac{1}{z} \cdot -0.3333333333333333\right) \]
    9. Applied rewrites35.2%

      \[\leadsto y \cdot \left(\frac{1}{z} \cdot -0.3333333333333333\right) \]
    10. Taylor expanded in x around inf

      \[\leadsto y \cdot \frac{x}{\color{blue}{y}} \]
    11. Step-by-step derivation
      1. lower-/.f6426.9

        \[\leadsto y \cdot \frac{x}{y} \]
    12. Applied rewrites26.9%

      \[\leadsto y \cdot \frac{x}{\color{blue}{y}} \]

    if 3.1000000000000001e-12 < y

    1. Initial program 95.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Taylor expanded in y around inf

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
      5. lower-/.f6460.1

        \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
    4. Applied rewrites60.1%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. lower-/.f6435.3

        \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
    7. Applied rewrites35.3%

      \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
    8. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
      2. lower-/.f6435.3

        \[\leadsto -0.3333333333333333 \cdot \frac{y}{z} \]
    10. Applied rewrites35.3%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} \]
      3. metadata-evalN/A

        \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \]
      4. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right) \]
      6. mult-flipN/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right) \]
      7. lift-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{neg}\left(\frac{y}{z \cdot 3}\right) \]
      9. distribute-neg-frac2N/A

        \[\leadsto \frac{y}{\mathsf{neg}\left(z \cdot 3\right)} \]
      10. lower-/.f64N/A

        \[\leadsto \frac{y}{\mathsf{neg}\left(z \cdot 3\right)} \]
      11. *-commutativeN/A

        \[\leadsto \frac{y}{\mathsf{neg}\left(3 \cdot z\right)} \]
      12. distribute-lft-neg-inN/A

        \[\leadsto \frac{y}{\left(\mathsf{neg}\left(3\right)\right) \cdot z} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{y}{\left(\mathsf{neg}\left(3\right)\right) \cdot z} \]
      14. metadata-eval35.3

        \[\leadsto \frac{y}{-3 \cdot z} \]
    12. Applied rewrites35.3%

      \[\leadsto \frac{y}{-3 \cdot \color{blue}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 18: 35.3% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \frac{y}{-3 \cdot z} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ y (* -3.0 z)))
double code(double x, double y, double z, double t) {
	return y / (-3.0 * z);
}
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 = y / ((-3.0d0) * z)
end function
public static double code(double x, double y, double z, double t) {
	return y / (-3.0 * z);
}
def code(x, y, z, t):
	return y / (-3.0 * z)
function code(x, y, z, t)
	return Float64(y / Float64(-3.0 * z))
end
function tmp = code(x, y, z, t)
	tmp = y / (-3.0 * z);
end
code[x_, y_, z_, t_] := N[(y / N[(-3.0 * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{y}{-3 \cdot z}
\end{array}
Derivation
  1. Initial program 95.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Taylor expanded in y around inf

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

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

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

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

      \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
    5. lower-/.f6460.1

      \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
  4. Applied rewrites60.1%

    \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
  5. Taylor expanded in x around 0

    \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
  6. Step-by-step derivation
    1. lower-/.f6435.3

      \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
  7. Applied rewrites35.3%

    \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
  8. Taylor expanded in x around 0

    \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
  9. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
    2. lower-/.f6435.3

      \[\leadsto -0.3333333333333333 \cdot \frac{y}{z} \]
  10. Applied rewrites35.3%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
  11. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{y}{z} \cdot \frac{-1}{3} \]
    3. metadata-evalN/A

      \[\leadsto \frac{y}{z} \cdot \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \]
    4. distribute-rgt-neg-outN/A

      \[\leadsto \mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{neg}\left(\frac{y}{z} \cdot \frac{1}{3}\right) \]
    6. mult-flipN/A

      \[\leadsto \mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right) \]
    7. lift-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\frac{\frac{y}{z}}{3}\right) \]
    8. associate-/r*N/A

      \[\leadsto \mathsf{neg}\left(\frac{y}{z \cdot 3}\right) \]
    9. distribute-neg-frac2N/A

      \[\leadsto \frac{y}{\mathsf{neg}\left(z \cdot 3\right)} \]
    10. lower-/.f64N/A

      \[\leadsto \frac{y}{\mathsf{neg}\left(z \cdot 3\right)} \]
    11. *-commutativeN/A

      \[\leadsto \frac{y}{\mathsf{neg}\left(3 \cdot z\right)} \]
    12. distribute-lft-neg-inN/A

      \[\leadsto \frac{y}{\left(\mathsf{neg}\left(3\right)\right) \cdot z} \]
    13. lower-*.f64N/A

      \[\leadsto \frac{y}{\left(\mathsf{neg}\left(3\right)\right) \cdot z} \]
    14. metadata-eval35.3

      \[\leadsto \frac{y}{-3 \cdot z} \]
  12. Applied rewrites35.3%

    \[\leadsto \frac{y}{-3 \cdot \color{blue}{z}} \]
  13. Add Preprocessing

Alternative 19: 35.3% accurate, 3.0× speedup?

\[\begin{array}{l} \\ -0.3333333333333333 \cdot \frac{y}{z} \end{array} \]
(FPCore (x y z t) :precision binary64 (* -0.3333333333333333 (/ y z)))
double code(double x, double y, double z, double t) {
	return -0.3333333333333333 * (y / z);
}
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 = (-0.3333333333333333d0) * (y / z)
end function
public static double code(double x, double y, double z, double t) {
	return -0.3333333333333333 * (y / z);
}
def code(x, y, z, t):
	return -0.3333333333333333 * (y / z)
function code(x, y, z, t)
	return Float64(-0.3333333333333333 * Float64(y / z))
end
function tmp = code(x, y, z, t)
	tmp = -0.3333333333333333 * (y / z);
end
code[x_, y_, z_, t_] := N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-0.3333333333333333 \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 95.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Taylor expanded in y around inf

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

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

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

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

      \[\leadsto y \cdot \left(\frac{x}{y} - \frac{1}{3} \cdot \color{blue}{\frac{1}{z}}\right) \]
    5. lower-/.f6460.1

      \[\leadsto y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{\color{blue}{z}}\right) \]
  4. Applied rewrites60.1%

    \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} - 0.3333333333333333 \cdot \frac{1}{z}\right)} \]
  5. Taylor expanded in x around 0

    \[\leadsto y \cdot \frac{\frac{-1}{3}}{\color{blue}{z}} \]
  6. Step-by-step derivation
    1. lower-/.f6435.3

      \[\leadsto y \cdot \frac{-0.3333333333333333}{z} \]
  7. Applied rewrites35.3%

    \[\leadsto y \cdot \frac{-0.3333333333333333}{\color{blue}{z}} \]
  8. Taylor expanded in x around 0

    \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
  9. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{3} \cdot \frac{y}{\color{blue}{z}} \]
    2. lower-/.f6435.3

      \[\leadsto -0.3333333333333333 \cdot \frac{y}{z} \]
  10. Applied rewrites35.3%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2025156 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64
  (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))