Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2

Percentage Accurate: 83.4% → 99.0%
Time: 2.7s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 83.4% accurate, 1.0× speedup?

\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}

Alternative 1: 99.0% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \cdot t\_0 \leq 2 \cdot 10^{-211}:\\ \;\;\;\;\frac{-t\_1}{z} \cdot \frac{\frac{t\_0}{-1 - z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_0}{z - -1} \cdot \frac{t\_1}{z}}{z}\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmax (fabs x) (fabs y))) (t_1 (fmin (fabs x) (fabs y))))
   (*
    (copysign 1.0 x)
    (*
     (copysign 1.0 y)
     (if (<= (* t_1 t_0) 2e-211)
       (* (/ (- t_1) z) (/ (/ t_0 (- -1.0 z)) z))
       (/ (* (/ t_0 (- z -1.0)) (/ t_1 z)) z))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = fmin(fabs(x), fabs(y));
	double tmp;
	if ((t_1 * t_0) <= 2e-211) {
		tmp = (-t_1 / z) * ((t_0 / (-1.0 - z)) / z);
	} else {
		tmp = ((t_0 / (z - -1.0)) * (t_1 / z)) / z;
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
public static double code(double x, double y, double z) {
	double t_0 = fmax(Math.abs(x), Math.abs(y));
	double t_1 = fmin(Math.abs(x), Math.abs(y));
	double tmp;
	if ((t_1 * t_0) <= 2e-211) {
		tmp = (-t_1 / z) * ((t_0 / (-1.0 - z)) / z);
	} else {
		tmp = ((t_0 / (z - -1.0)) * (t_1 / z)) / z;
	}
	return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * tmp);
}
def code(x, y, z):
	t_0 = fmax(math.fabs(x), math.fabs(y))
	t_1 = fmin(math.fabs(x), math.fabs(y))
	tmp = 0
	if (t_1 * t_0) <= 2e-211:
		tmp = (-t_1 / z) * ((t_0 / (-1.0 - z)) / z)
	else:
		tmp = ((t_0 / (z - -1.0)) * (t_1 / z)) / z
	return math.copysign(1.0, x) * (math.copysign(1.0, y) * tmp)
function code(x, y, z)
	t_0 = fmax(abs(x), abs(y))
	t_1 = fmin(abs(x), abs(y))
	tmp = 0.0
	if (Float64(t_1 * t_0) <= 2e-211)
		tmp = Float64(Float64(Float64(-t_1) / z) * Float64(Float64(t_0 / Float64(-1.0 - z)) / z));
	else
		tmp = Float64(Float64(Float64(t_0 / Float64(z - -1.0)) * Float64(t_1 / z)) / z);
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
function tmp_2 = code(x, y, z)
	t_0 = max(abs(x), abs(y));
	t_1 = min(abs(x), abs(y));
	tmp = 0.0;
	if ((t_1 * t_0) <= 2e-211)
		tmp = (-t_1 / z) * ((t_0 / (-1.0 - z)) / z);
	else
		tmp = ((t_0 / (z - -1.0)) * (t_1 / z)) / z;
	end
	tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * tmp);
end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 * t$95$0), $MachinePrecision], 2e-211], N[(N[((-t$95$1) / z), $MachinePrecision] * N[(N[(t$95$0 / N[(-1.0 - z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / N[(z - -1.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \cdot t\_0 \leq 2 \cdot 10^{-211}:\\
\;\;\;\;\frac{-t\_1}{z} \cdot \frac{\frac{t\_0}{-1 - z}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{z - -1} \cdot \frac{t\_1}{z}}{z}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < 2.00000000000000017e-211

    1. Initial program 83.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      5. associate-*l/N/A

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

        \[\leadsto \frac{x \cdot \frac{y}{z + 1}}{\color{blue}{z \cdot z}} \]
      7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000017e-211 < (*.f64 x y)

    1. Initial program 83.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      8. associate-*r/N/A

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \frac{\frac{y}{\color{blue}{z + 1}} \cdot \frac{x}{z}}{z} \]
      13. add-flipN/A

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

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

        \[\leadsto \frac{\frac{y}{z - \color{blue}{-1}} \cdot \frac{x}{z}}{z} \]
      16. lower-/.f6497.0

        \[\leadsto \frac{\frac{y}{z - -1} \cdot \color{blue}{\frac{x}{z}}}{z} \]
    3. Applied rewrites97.0%

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

Alternative 2: 99.0% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \frac{t\_0}{z}\\ t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\ t_3 := t\_2 \cdot t\_0\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq 2 \cdot 10^{-211}:\\ \;\;\;\;t\_1 \cdot \frac{t\_2}{\mathsf{fma}\left(z, z, z\right)}\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+206}:\\ \;\;\;\;\frac{\frac{t\_2}{z} \cdot t\_0}{\mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_2}{z - -1} \cdot \frac{t\_1}{z}\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmax (fabs x) (fabs y)))
        (t_1 (/ t_0 z))
        (t_2 (fmin (fabs x) (fabs y)))
        (t_3 (* t_2 t_0)))
   (*
    (copysign 1.0 x)
    (*
     (copysign 1.0 y)
     (if (<= t_3 2e-211)
       (* t_1 (/ t_2 (fma z z z)))
       (if (<= t_3 2e+206)
         (/ (* (/ t_2 z) t_0) (fma z z z))
         (* (/ t_2 (- z -1.0)) (/ t_1 z))))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = t_0 / z;
	double t_2 = fmin(fabs(x), fabs(y));
	double t_3 = t_2 * t_0;
	double tmp;
	if (t_3 <= 2e-211) {
		tmp = t_1 * (t_2 / fma(z, z, z));
	} else if (t_3 <= 2e+206) {
		tmp = ((t_2 / z) * t_0) / fma(z, z, z);
	} else {
		tmp = (t_2 / (z - -1.0)) * (t_1 / z);
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
function code(x, y, z)
	t_0 = fmax(abs(x), abs(y))
	t_1 = Float64(t_0 / z)
	t_2 = fmin(abs(x), abs(y))
	t_3 = Float64(t_2 * t_0)
	tmp = 0.0
	if (t_3 <= 2e-211)
		tmp = Float64(t_1 * Float64(t_2 / fma(z, z, z)));
	elseif (t_3 <= 2e+206)
		tmp = Float64(Float64(Float64(t_2 / z) * t_0) / fma(z, z, z));
	else
		tmp = Float64(Float64(t_2 / Float64(z - -1.0)) * Float64(t_1 / z));
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / z), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * t$95$0), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 2e-211], N[(t$95$1 * N[(t$95$2 / N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+206], N[(N[(N[(t$95$2 / z), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(z * z + z), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 / N[(z - -1.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \frac{t\_0}{z}\\
t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
t_3 := t\_2 \cdot t\_0\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq 2 \cdot 10^{-211}:\\
\;\;\;\;t\_1 \cdot \frac{t\_2}{\mathsf{fma}\left(z, z, z\right)}\\

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+206}:\\
\;\;\;\;\frac{\frac{t\_2}{z} \cdot t\_0}{\mathsf{fma}\left(z, z, z\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{z - -1} \cdot \frac{t\_1}{z}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < 2.00000000000000017e-211

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{z \cdot z + z \cdot 1}} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z \cdot z + \color{blue}{z}} \]
      14. lower-fma.f6494.5

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \]
    3. Applied rewrites94.5%

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

    if 2.00000000000000017e-211 < (*.f64 x y) < 2.0000000000000001e206

    1. Initial program 83.4%

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

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

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

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

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
      6. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z}} \cdot \frac{y}{z + 1} \]
      7. frac-timesN/A

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{z} \cdot y}{\color{blue}{z \cdot z + z \cdot 1}} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x}{z} \cdot y}{z \cdot z + \color{blue}{z}} \]
      14. lower-fma.f6494.4

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

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

    if 2.0000000000000001e206 < (*.f64 x y)

    1. Initial program 83.4%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{z \cdot z}}}{z + 1} \]
      7. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-y}{z} \cdot \frac{x}{z}}{-1 - z}} \]
      4. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\mathsf{neg}\left(\left(-1 - z\right)\right)} \cdot \frac{\frac{y}{z}}{z}} \]
    5. Applied rewrites93.6%

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

Alternative 3: 98.9% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \cdot t\_0 \leq 2 \cdot 10^{-211}:\\ \;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_1}{\mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_0}{z - -1} \cdot \frac{t\_1}{z}}{z}\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmax (fabs x) (fabs y))) (t_1 (fmin (fabs x) (fabs y))))
   (*
    (copysign 1.0 x)
    (*
     (copysign 1.0 y)
     (if (<= (* t_1 t_0) 2e-211)
       (* (/ t_0 z) (/ t_1 (fma z z z)))
       (/ (* (/ t_0 (- z -1.0)) (/ t_1 z)) z))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = fmin(fabs(x), fabs(y));
	double tmp;
	if ((t_1 * t_0) <= 2e-211) {
		tmp = (t_0 / z) * (t_1 / fma(z, z, z));
	} else {
		tmp = ((t_0 / (z - -1.0)) * (t_1 / z)) / z;
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
function code(x, y, z)
	t_0 = fmax(abs(x), abs(y))
	t_1 = fmin(abs(x), abs(y))
	tmp = 0.0
	if (Float64(t_1 * t_0) <= 2e-211)
		tmp = Float64(Float64(t_0 / z) * Float64(t_1 / fma(z, z, z)));
	else
		tmp = Float64(Float64(Float64(t_0 / Float64(z - -1.0)) * Float64(t_1 / z)) / z);
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 * t$95$0), $MachinePrecision], 2e-211], N[(N[(t$95$0 / z), $MachinePrecision] * N[(t$95$1 / N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / N[(z - -1.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \cdot t\_0 \leq 2 \cdot 10^{-211}:\\
\;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_1}{\mathsf{fma}\left(z, z, z\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{z - -1} \cdot \frac{t\_1}{z}}{z}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < 2.00000000000000017e-211

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{z \cdot z + z \cdot 1}} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z \cdot z + \color{blue}{z}} \]
      14. lower-fma.f6494.5

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \]
    3. Applied rewrites94.5%

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

    if 2.00000000000000017e-211 < (*.f64 x y)

    1. Initial program 83.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      8. associate-*r/N/A

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
      10. lower-*.f64N/A

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

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

        \[\leadsto \frac{\frac{y}{\color{blue}{z + 1}} \cdot \frac{x}{z}}{z} \]
      13. add-flipN/A

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

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

        \[\leadsto \frac{\frac{y}{z - \color{blue}{-1}} \cdot \frac{x}{z}}{z} \]
      16. lower-/.f6497.0

        \[\leadsto \frac{\frac{y}{z - -1} \cdot \color{blue}{\frac{x}{z}}}{z} \]
    3. Applied rewrites97.0%

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

Alternative 4: 96.1% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \cdot t\_0 \leq 2 \cdot 10^{-211}:\\ \;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_1}{\mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_1}{z} \cdot t\_0}{\mathsf{fma}\left(z, z, z\right)}\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmax (fabs x) (fabs y))) (t_1 (fmin (fabs x) (fabs y))))
   (*
    (copysign 1.0 x)
    (*
     (copysign 1.0 y)
     (if (<= (* t_1 t_0) 2e-211)
       (* (/ t_0 z) (/ t_1 (fma z z z)))
       (/ (* (/ t_1 z) t_0) (fma z z z)))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = fmin(fabs(x), fabs(y));
	double tmp;
	if ((t_1 * t_0) <= 2e-211) {
		tmp = (t_0 / z) * (t_1 / fma(z, z, z));
	} else {
		tmp = ((t_1 / z) * t_0) / fma(z, z, z);
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
function code(x, y, z)
	t_0 = fmax(abs(x), abs(y))
	t_1 = fmin(abs(x), abs(y))
	tmp = 0.0
	if (Float64(t_1 * t_0) <= 2e-211)
		tmp = Float64(Float64(t_0 / z) * Float64(t_1 / fma(z, z, z)));
	else
		tmp = Float64(Float64(Float64(t_1 / z) * t_0) / fma(z, z, z));
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 * t$95$0), $MachinePrecision], 2e-211], N[(N[(t$95$0 / z), $MachinePrecision] * N[(t$95$1 / N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 / z), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(z * z + z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \cdot t\_0 \leq 2 \cdot 10^{-211}:\\
\;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_1}{\mathsf{fma}\left(z, z, z\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{z} \cdot t\_0}{\mathsf{fma}\left(z, z, z\right)}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < 2.00000000000000017e-211

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{z \cdot z + z \cdot 1}} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{y}{z} \cdot \frac{x}{z \cdot z + \color{blue}{z}} \]
      14. lower-fma.f6494.5

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \]
    3. Applied rewrites94.5%

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

    if 2.00000000000000017e-211 < (*.f64 x y)

    1. Initial program 83.4%

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

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

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

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

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
      6. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z}} \cdot \frac{y}{z + 1} \]
      7. frac-timesN/A

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{z} \cdot y}{\color{blue}{z \cdot z + z \cdot 1}} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x}{z} \cdot y}{z \cdot z + \color{blue}{z}} \]
      14. lower-fma.f6494.4

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

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

Alternative 5: 94.5% accurate, 1.0× speedup?

\[\frac{y}{z} \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)} \]
(FPCore (x y z) :precision binary64 (* (/ y z) (/ x (fma z z z))))
double code(double x, double y, double z) {
	return (y / z) * (x / fma(z, z, z));
}
function code(x, y, z)
	return Float64(Float64(y / z) * Float64(x / fma(z, z, z)))
end
code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(x / N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{y}{z} \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}
Derivation
  1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{z \cdot z + z \cdot 1}} \]
    13. *-rgt-identityN/A

      \[\leadsto \frac{y}{z} \cdot \frac{x}{z \cdot z + \color{blue}{z}} \]
    14. lower-fma.f6494.5

      \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \]
  3. Applied rewrites94.5%

    \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}} \]
  4. Add Preprocessing

Alternative 6: 92.7% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \mathsf{fma}\left(z, z, z\right) \cdot z\\ t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\ t_3 := \left(z \cdot z\right) \cdot \left(z + 1\right)\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq -1 \cdot 10^{+24}:\\ \;\;\;\;\frac{t\_0}{t\_1} \cdot t\_2\\ \mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-309}:\\ \;\;\;\;\frac{t\_0 \cdot \frac{t\_2}{1 \cdot z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_2}{t\_1} \cdot t\_0\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmax (fabs x) (fabs y)))
        (t_1 (* (fma z z z) z))
        (t_2 (fmin (fabs x) (fabs y)))
        (t_3 (* (* z z) (+ z 1.0))))
   (*
    (copysign 1.0 x)
    (*
     (copysign 1.0 y)
     (if (<= t_3 -1e+24)
       (* (/ t_0 t_1) t_2)
       (if (<= t_3 4e-309)
         (/ (* t_0 (/ t_2 (* 1.0 z))) z)
         (* (/ t_2 t_1) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = fma(z, z, z) * z;
	double t_2 = fmin(fabs(x), fabs(y));
	double t_3 = (z * z) * (z + 1.0);
	double tmp;
	if (t_3 <= -1e+24) {
		tmp = (t_0 / t_1) * t_2;
	} else if (t_3 <= 4e-309) {
		tmp = (t_0 * (t_2 / (1.0 * z))) / z;
	} else {
		tmp = (t_2 / t_1) * t_0;
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
function code(x, y, z)
	t_0 = fmax(abs(x), abs(y))
	t_1 = Float64(fma(z, z, z) * z)
	t_2 = fmin(abs(x), abs(y))
	t_3 = Float64(Float64(z * z) * Float64(z + 1.0))
	tmp = 0.0
	if (t_3 <= -1e+24)
		tmp = Float64(Float64(t_0 / t_1) * t_2);
	elseif (t_3 <= 4e-309)
		tmp = Float64(Float64(t_0 * Float64(t_2 / Float64(1.0 * z))) / z);
	else
		tmp = Float64(Float64(t_2 / t_1) * t_0);
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(z * z + z), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, -1e+24], N[(N[(t$95$0 / t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 4e-309], N[(N[(t$95$0 * N[(t$95$2 / N[(1.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \mathsf{fma}\left(z, z, z\right) \cdot z\\
t_2 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
t_3 := \left(z \cdot z\right) \cdot \left(z + 1\right)\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+24}:\\
\;\;\;\;\frac{t\_0}{t\_1} \cdot t\_2\\

\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{t\_2}{1 \cdot z}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{t\_1} \cdot t\_0\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -9.9999999999999998e23

    1. Initial program 83.4%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot x} \]
      6. lower-/.f6485.1

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \cdot x \]
      15. lower-fma.f6485.1

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

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

    if -9.9999999999999998e23 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 3.9999999999999977e-309

    1. Initial program 83.4%

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

      \[\leadsto \frac{x \cdot y}{\left(z \cdot z\right) \cdot \color{blue}{1}} \]
    3. Step-by-step derivation
      1. Applied rewrites70.8%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z \cdot 1}} \]
        8. associate-*l/N/A

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

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

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

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

          \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{1 \cdot z}}}{z} \]
        13. lower-*.f6474.5

          \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{1 \cdot z}}}{z} \]
      3. Applied rewrites74.5%

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

      if 3.9999999999999977e-309 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

      1. Initial program 83.4%

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \cdot y \]
        9. lower-/.f6484.9

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

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

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

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

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

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

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

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

          \[\leadsto \frac{x}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \cdot y \]
        18. lower-fma.f6484.9

          \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)} \cdot z} \cdot y \]
      3. Applied rewrites84.9%

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

    Alternative 7: 89.8% accurate, 0.3× speedup?

    \[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \cdot t\_0 \leq 10^{-204}:\\ \;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{\mathsf{fma}\left(z, z, z\right) \cdot z} \cdot t\_0\\ \end{array}\right) \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (fmax (fabs x) (fabs y))) (t_1 (fmin (fabs x) (fabs y))))
       (*
        (copysign 1.0 x)
        (*
         (copysign 1.0 y)
         (if (<= (* t_1 t_0) 1e-204)
           (* (/ t_0 z) (/ t_1 z))
           (* (/ t_1 (* (fma z z z) z)) t_0))))))
    double code(double x, double y, double z) {
    	double t_0 = fmax(fabs(x), fabs(y));
    	double t_1 = fmin(fabs(x), fabs(y));
    	double tmp;
    	if ((t_1 * t_0) <= 1e-204) {
    		tmp = (t_0 / z) * (t_1 / z);
    	} else {
    		tmp = (t_1 / (fma(z, z, z) * z)) * t_0;
    	}
    	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
    }
    
    function code(x, y, z)
    	t_0 = fmax(abs(x), abs(y))
    	t_1 = fmin(abs(x), abs(y))
    	tmp = 0.0
    	if (Float64(t_1 * t_0) <= 1e-204)
    		tmp = Float64(Float64(t_0 / z) * Float64(t_1 / z));
    	else
    		tmp = Float64(Float64(t_1 / Float64(fma(z, z, z) * z)) * t_0);
    	end
    	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 * t$95$0), $MachinePrecision], 1e-204], N[(N[(t$95$0 / z), $MachinePrecision] * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(N[(z * z + z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
    t_1 := \mathsf{min}\left(\left|x\right|, \left|y\right|\right)\\
    \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
    \mathbf{if}\;t\_1 \cdot t\_0 \leq 10^{-204}:\\
    \;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_1}{z}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{t\_1}{\mathsf{fma}\left(z, z, z\right) \cdot z} \cdot t\_0\\
    
    
    \end{array}\right)
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 x y) < 1e-204

      1. Initial program 83.4%

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

        \[\leadsto \frac{x \cdot y}{\left(z \cdot z\right) \cdot \color{blue}{1}} \]
      3. Step-by-step derivation
        1. Applied rewrites70.8%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{y}{\color{blue}{1 \cdot z}} \cdot \frac{x}{z} \]
          13. lower-*.f6475.0

            \[\leadsto \frac{y}{\color{blue}{1 \cdot z}} \cdot \frac{x}{z} \]
        3. Applied rewrites75.0%

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

          \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
        5. Step-by-step derivation
          1. lower-/.f6475.0

            \[\leadsto \frac{y}{\color{blue}{z}} \cdot \frac{x}{z} \]
        6. Applied rewrites75.0%

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

        if 1e-204 < (*.f64 x y)

        1. Initial program 83.4%

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \cdot y \]
          9. lower-/.f6484.9

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

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

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

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

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

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

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

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

            \[\leadsto \frac{x}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \cdot y \]
          18. lower-fma.f6484.9

            \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)} \cdot z} \cdot y \]
        3. Applied rewrites84.9%

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

      Alternative 8: 80.2% accurate, 0.4× speedup?

      \[\begin{array}{l} t_0 := \mathsf{min}\left(\left|x\right|, y\right)\\ t_1 := \mathsf{max}\left(\left|x\right|, y\right)\\ \mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 4.2 \cdot 10^{+45}:\\ \;\;\;\;\frac{t\_1}{z} \cdot \frac{t\_0}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \frac{t\_0}{\left(1 \cdot z\right) \cdot z}\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (fmin (fabs x) y)) (t_1 (fmax (fabs x) y)))
         (*
          (copysign 1.0 x)
          (if (<= t_1 4.2e+45)
            (* (/ t_1 z) (/ t_0 z))
            (* t_1 (/ t_0 (* (* 1.0 z) z)))))))
      double code(double x, double y, double z) {
      	double t_0 = fmin(fabs(x), y);
      	double t_1 = fmax(fabs(x), y);
      	double tmp;
      	if (t_1 <= 4.2e+45) {
      		tmp = (t_1 / z) * (t_0 / z);
      	} else {
      		tmp = t_1 * (t_0 / ((1.0 * z) * z));
      	}
      	return copysign(1.0, x) * tmp;
      }
      
      public static double code(double x, double y, double z) {
      	double t_0 = fmin(Math.abs(x), y);
      	double t_1 = fmax(Math.abs(x), y);
      	double tmp;
      	if (t_1 <= 4.2e+45) {
      		tmp = (t_1 / z) * (t_0 / z);
      	} else {
      		tmp = t_1 * (t_0 / ((1.0 * z) * z));
      	}
      	return Math.copySign(1.0, x) * tmp;
      }
      
      def code(x, y, z):
      	t_0 = fmin(math.fabs(x), y)
      	t_1 = fmax(math.fabs(x), y)
      	tmp = 0
      	if t_1 <= 4.2e+45:
      		tmp = (t_1 / z) * (t_0 / z)
      	else:
      		tmp = t_1 * (t_0 / ((1.0 * z) * z))
      	return math.copysign(1.0, x) * tmp
      
      function code(x, y, z)
      	t_0 = fmin(abs(x), y)
      	t_1 = fmax(abs(x), y)
      	tmp = 0.0
      	if (t_1 <= 4.2e+45)
      		tmp = Float64(Float64(t_1 / z) * Float64(t_0 / z));
      	else
      		tmp = Float64(t_1 * Float64(t_0 / Float64(Float64(1.0 * z) * z)));
      	end
      	return Float64(copysign(1.0, x) * tmp)
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = min(abs(x), y);
      	t_1 = max(abs(x), y);
      	tmp = 0.0;
      	if (t_1 <= 4.2e+45)
      		tmp = (t_1 / z) * (t_0 / z);
      	else
      		tmp = t_1 * (t_0 / ((1.0 * z) * z));
      	end
      	tmp_2 = (sign(x) * abs(1.0)) * tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Abs[x], $MachinePrecision], y], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[x], $MachinePrecision], y], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 4.2e+45], N[(N[(t$95$1 / z), $MachinePrecision] * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 / N[(N[(1.0 * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
      
      \begin{array}{l}
      t_0 := \mathsf{min}\left(\left|x\right|, y\right)\\
      t_1 := \mathsf{max}\left(\left|x\right|, y\right)\\
      \mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
      \mathbf{if}\;t\_1 \leq 4.2 \cdot 10^{+45}:\\
      \;\;\;\;\frac{t\_1}{z} \cdot \frac{t\_0}{z}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1 \cdot \frac{t\_0}{\left(1 \cdot z\right) \cdot z}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 4.1999999999999999e45

        1. Initial program 83.4%

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

          \[\leadsto \frac{x \cdot y}{\left(z \cdot z\right) \cdot \color{blue}{1}} \]
        3. Step-by-step derivation
          1. Applied rewrites70.8%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{y}{\color{blue}{1 \cdot z}} \cdot \frac{x}{z} \]
            13. lower-*.f6475.0

              \[\leadsto \frac{y}{\color{blue}{1 \cdot z}} \cdot \frac{x}{z} \]
          3. Applied rewrites75.0%

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

            \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
          5. Step-by-step derivation
            1. lower-/.f6475.0

              \[\leadsto \frac{y}{\color{blue}{z}} \cdot \frac{x}{z} \]
          6. Applied rewrites75.0%

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

          if 4.1999999999999999e45 < y

          1. Initial program 83.4%

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

            \[\leadsto \frac{x \cdot y}{\left(z \cdot z\right) \cdot \color{blue}{1}} \]
          3. Step-by-step derivation
            1. Applied rewrites70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 \cdot z\right)} \cdot z} \]
              15. lower-*.f6472.8

                \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 \cdot z\right)} \cdot z} \]
            3. Applied rewrites72.8%

              \[\leadsto \color{blue}{y \cdot \frac{x}{\left(1 \cdot z\right) \cdot z}} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 9: 75.0% accurate, 1.5× speedup?

          \[\frac{y}{z} \cdot \frac{x}{z} \]
          (FPCore (x y z) :precision binary64 (* (/ y z) (/ x z)))
          double code(double x, double y, double z) {
          	return (y / z) * (x / 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)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              code = (y / z) * (x / z)
          end function
          
          public static double code(double x, double y, double z) {
          	return (y / z) * (x / z);
          }
          
          def code(x, y, z):
          	return (y / z) * (x / z)
          
          function code(x, y, z)
          	return Float64(Float64(y / z) * Float64(x / z))
          end
          
          function tmp = code(x, y, z)
          	tmp = (y / z) * (x / z);
          end
          
          code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]
          
          \frac{y}{z} \cdot \frac{x}{z}
          
          Derivation
          1. Initial program 83.4%

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

            \[\leadsto \frac{x \cdot y}{\left(z \cdot z\right) \cdot \color{blue}{1}} \]
          3. Step-by-step derivation
            1. Applied rewrites70.8%

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{y}{\color{blue}{1 \cdot z}} \cdot \frac{x}{z} \]
              13. lower-*.f6475.0

                \[\leadsto \frac{y}{\color{blue}{1 \cdot z}} \cdot \frac{x}{z} \]
            3. Applied rewrites75.0%

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

              \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
            5. Step-by-step derivation
              1. lower-/.f6475.0

                \[\leadsto \frac{y}{\color{blue}{z}} \cdot \frac{x}{z} \]
            6. Applied rewrites75.0%

              \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
            7. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2025175 
            (FPCore (x y z)
              :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
              :precision binary64
              (/ (* x y) (* (* z z) (+ z 1.0))))