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

Percentage Accurate: 83.0% → 98.0%
Time: 12.1s
Alternatives: 9
Speedup: 0.8×

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))))
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), $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.0% 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))))
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), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}

Alternative 1: 98.0% accurate, 0.1× speedup?

\[\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \frac{\frac{\mathsf{max}\left(\left|x\right|, \left|y\right|\right)}{z - -1} \cdot \frac{\mathsf{min}\left(\left|x\right|, \left|y\right|\right)}{z}}{z}\right) \]
(FPCore (x y z)
  :precision binary64
  (*
 (copysign 1 x)
 (*
  (copysign 1 y)
  (/
   (*
    (/ (fmax (fabs x) (fabs y)) (- z -1))
    (/ (fmin (fabs x) (fabs y)) z))
   z))))
double code(double x, double y, double z) {
	return copysign(1.0, x) * (copysign(1.0, y) * (((fmax(fabs(x), fabs(y)) / (z - -1.0)) * (fmin(fabs(x), fabs(y)) / z)) / z));
}
public static double code(double x, double y, double z) {
	return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (((fmax(Math.abs(x), Math.abs(y)) / (z - -1.0)) * (fmin(Math.abs(x), Math.abs(y)) / z)) / z));
}
def code(x, y, z):
	return math.copysign(1.0, x) * (math.copysign(1.0, y) * (((fmax(math.fabs(x), math.fabs(y)) / (z - -1.0)) * (fmin(math.fabs(x), math.fabs(y)) / z)) / z))
function code(x, y, z)
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(Float64(Float64(fmax(abs(x), abs(y)) / Float64(z - -1.0)) * Float64(fmin(abs(x), abs(y)) / z)) / z)))
end
function tmp = code(x, y, z)
	tmp = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * (((max(abs(x), abs(y)) / (z - -1.0)) * (min(abs(x), abs(y)) / z)) / z));
end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[(N[(N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision] / N[(z - -1), $MachinePrecision]), $MachinePrecision] * N[(N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \frac{\frac{\mathsf{max}\left(\left|x\right|, \left|y\right|\right)}{z - -1} \cdot \frac{\mathsf{min}\left(\left|x\right|, \left|y\right|\right)}{z}}{z}\right)
Derivation
  1. Initial program 83.0%

    \[\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}} \]
  4. Add Preprocessing

Alternative 2: 96.9% accurate, 0.0× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \left(z - -1\right) \cdot z\\ t_2 := \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}\;\frac{t\_2 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 10000000000000000213204190094543968723012578712679649467743338496:\\ \;\;\;\;\frac{\frac{t\_0}{t\_1}}{z} \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_2}{t\_1} \cdot t\_0}{z}\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (fmax (fabs x) (fabs y)))
       (t_1 (* (- z -1) z))
       (t_2 (fmin (fabs x) (fabs y))))
  (*
   (copysign 1 x)
   (*
    (copysign 1 y)
    (if (<=
         (/ (* t_2 t_0) (* (* z z) (+ z 1)))
         10000000000000000213204190094543968723012578712679649467743338496)
      (* (/ (/ t_0 t_1) z) t_2)
      (/ (* (/ t_2 t_1) t_0) z))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = (z - -1.0) * z;
	double t_2 = fmin(fabs(x), fabs(y));
	double tmp;
	if (((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e+64) {
		tmp = ((t_0 / t_1) / z) * t_2;
	} else {
		tmp = ((t_2 / t_1) * t_0) / 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 = (z - -1.0) * z;
	double t_2 = fmin(Math.abs(x), Math.abs(y));
	double tmp;
	if (((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e+64) {
		tmp = ((t_0 / t_1) / z) * t_2;
	} else {
		tmp = ((t_2 / t_1) * t_0) / 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 = (z - -1.0) * z
	t_2 = fmin(math.fabs(x), math.fabs(y))
	tmp = 0
	if ((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e+64:
		tmp = ((t_0 / t_1) / z) * t_2
	else:
		tmp = ((t_2 / t_1) * t_0) / 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 = Float64(Float64(z - -1.0) * z)
	t_2 = fmin(abs(x), abs(y))
	tmp = 0.0
	if (Float64(Float64(t_2 * t_0) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 1e+64)
		tmp = Float64(Float64(Float64(t_0 / t_1) / z) * t_2);
	else
		tmp = Float64(Float64(Float64(t_2 / t_1) * t_0) / 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 = (z - -1.0) * z;
	t_2 = min(abs(x), abs(y));
	tmp = 0.0;
	if (((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e+64)
		tmp = ((t_0 / t_1) / z) * t_2;
	else
		tmp = ((t_2 / t_1) * t_0) / 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[(N[(z - -1), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(t$95$2 * t$95$0), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 10000000000000000213204190094543968723012578712679649467743338496], N[(N[(N[(t$95$0 / t$95$1), $MachinePrecision] / z), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \left(z - -1\right) \cdot z\\
t_2 := \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}\;\frac{t\_2 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 10000000000000000213204190094543968723012578712679649467743338496:\\
\;\;\;\;\frac{\frac{t\_0}{t\_1}}{z} \cdot t\_2\\

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


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

    1. Initial program 83.0%

      \[\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-/.f6484.7%

        \[\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. *-commutativeN/A

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

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

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

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

        \[\leadsto \frac{y}{\left(\color{blue}{\left(z - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot z\right) \cdot z} \cdot x \]
      17. metadata-eval84.7%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(z - -1\right) \cdot z}}}{z} \cdot x \]
    5. Applied rewrites90.9%

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

    if 1e64 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

    1. Initial program 83.0%

      \[\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}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\left(\color{blue}{\frac{1}{z - -1}} \cdot y\right) \cdot \frac{x}{z}}{z} \]
    5. Applied rewrites97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
      18. lower-*.f6494.2%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
    7. Applied rewrites94.2%

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

Alternative 3: 95.3% accurate, 0.1× speedup?

\[\begin{array}{l} t_0 := \left(z - -1\right) \cdot z\\ \mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 20000000000000001016445696805993759409582178897019679576898416057743923428824704540156776745107920382581920574891563668662589154296936754315264:\\ \;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{z} \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{min}\left(x, y\right) \cdot \frac{\mathsf{max}\left(x, y\right)}{t\_0}}{z}\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (* (- z -1) z)))
  (if (<=
       (fmax x y)
       20000000000000001016445696805993759409582178897019679576898416057743923428824704540156776745107920382581920574891563668662589154296936754315264)
    (* (/ (fmax x y) z) (/ (fmin x y) t_0))
    (/ (* (fmin x y) (/ (fmax x y) t_0)) z))))
double code(double x, double y, double z) {
	double t_0 = (z - -1.0) * z;
	double tmp;
	if (fmax(x, y) <= 2e+142) {
		tmp = (fmax(x, y) / z) * (fmin(x, y) / t_0);
	} else {
		tmp = (fmin(x, y) * (fmax(x, y) / t_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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (z - (-1.0d0)) * z
    if (fmax(x, y) <= 2d+142) then
        tmp = (fmax(x, y) / z) * (fmin(x, y) / t_0)
    else
        tmp = (fmin(x, y) * (fmax(x, y) / t_0)) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (z - -1.0) * z;
	double tmp;
	if (fmax(x, y) <= 2e+142) {
		tmp = (fmax(x, y) / z) * (fmin(x, y) / t_0);
	} else {
		tmp = (fmin(x, y) * (fmax(x, y) / t_0)) / z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z - -1.0) * z
	tmp = 0
	if fmax(x, y) <= 2e+142:
		tmp = (fmax(x, y) / z) * (fmin(x, y) / t_0)
	else:
		tmp = (fmin(x, y) * (fmax(x, y) / t_0)) / z
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(z - -1.0) * z)
	tmp = 0.0
	if (fmax(x, y) <= 2e+142)
		tmp = Float64(Float64(fmax(x, y) / z) * Float64(fmin(x, y) / t_0));
	else
		tmp = Float64(Float64(fmin(x, y) * Float64(fmax(x, y) / t_0)) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z - -1.0) * z;
	tmp = 0.0;
	if (max(x, y) <= 2e+142)
		tmp = (max(x, y) / z) * (min(x, y) / t_0);
	else
		tmp = (min(x, y) * (max(x, y) / t_0)) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z - -1), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 20000000000000001016445696805993759409582178897019679576898416057743923428824704540156776745107920382581920574891563668662589154296936754315264], N[(N[(N[Max[x, y], $MachinePrecision] / z), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] * N[(N[Max[x, y], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(z - -1\right) \cdot z\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 20000000000000001016445696805993759409582178897019679576898416057743923428824704540156776745107920382581920574891563668662589154296936754315264:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{z} \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right) \cdot \frac{\mathsf{max}\left(x, y\right)}{t\_0}}{z}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.0000000000000001e142

    1. Initial program 83.0%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

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

    if 2.0000000000000001e142 < y

    1. Initial program 83.0%

      \[\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. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \frac{y}{\color{blue}{\left(z + 1\right) \cdot z}}}{z} \]
      12. lower-*.f6494.4%

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

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

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

        \[\leadsto \frac{x \cdot \frac{y}{\color{blue}{\left(z - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot z}}{z} \]
      16. metadata-eval94.4%

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

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

Alternative 4: 95.1% accurate, 0.0× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\ t_1 := \left(z - -1\right) \cdot z\\ t_2 := \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}\;\frac{t\_2 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq \frac{4784065733063811}{4784065733063810973581885157618788676291241975216665977767007373648750357731006099232824032039924032894289638403441329240212719241920971274455782595989040464660523567661989180298099889009174801022976}:\\ \;\;\;\;\frac{\frac{t\_0}{t\_1}}{z} \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{z} \cdot \frac{t\_2}{t\_1}\\ \end{array}\right) \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (fmax (fabs x) (fabs y)))
       (t_1 (* (- z -1) z))
       (t_2 (fmin (fabs x) (fabs y))))
  (*
   (copysign 1 x)
   (*
    (copysign 1 y)
    (if (<=
         (/ (* t_2 t_0) (* (* z z) (+ z 1)))
         4784065733063811/4784065733063810973581885157618788676291241975216665977767007373648750357731006099232824032039924032894289638403441329240212719241920971274455782595989040464660523567661989180298099889009174801022976)
      (* (/ (/ t_0 t_1) z) t_2)
      (* (/ t_0 z) (/ t_2 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = fmax(fabs(x), fabs(y));
	double t_1 = (z - -1.0) * z;
	double t_2 = fmin(fabs(x), fabs(y));
	double tmp;
	if (((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e-183) {
		tmp = ((t_0 / t_1) / z) * t_2;
	} else {
		tmp = (t_0 / z) * (t_2 / t_1);
	}
	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 = (z - -1.0) * z;
	double t_2 = fmin(Math.abs(x), Math.abs(y));
	double tmp;
	if (((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e-183) {
		tmp = ((t_0 / t_1) / z) * t_2;
	} else {
		tmp = (t_0 / z) * (t_2 / t_1);
	}
	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 = (z - -1.0) * z
	t_2 = fmin(math.fabs(x), math.fabs(y))
	tmp = 0
	if ((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e-183:
		tmp = ((t_0 / t_1) / z) * t_2
	else:
		tmp = (t_0 / z) * (t_2 / t_1)
	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 = Float64(Float64(z - -1.0) * z)
	t_2 = fmin(abs(x), abs(y))
	tmp = 0.0
	if (Float64(Float64(t_2 * t_0) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 1e-183)
		tmp = Float64(Float64(Float64(t_0 / t_1) / z) * t_2);
	else
		tmp = Float64(Float64(t_0 / z) * Float64(t_2 / t_1));
	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 = (z - -1.0) * z;
	t_2 = min(abs(x), abs(y));
	tmp = 0.0;
	if (((t_2 * t_0) / ((z * z) * (z + 1.0))) <= 1e-183)
		tmp = ((t_0 / t_1) / z) * t_2;
	else
		tmp = (t_0 / z) * (t_2 / t_1);
	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[(N[(z - -1), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(t$95$2 * t$95$0), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4784065733063811/4784065733063810973581885157618788676291241975216665977767007373648750357731006099232824032039924032894289638403441329240212719241920971274455782595989040464660523567661989180298099889009174801022976], N[(N[(N[(t$95$0 / t$95$1), $MachinePrecision] / z), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(t$95$0 / z), $MachinePrecision] * N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\\
t_1 := \left(z - -1\right) \cdot z\\
t_2 := \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}\;\frac{t\_2 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq \frac{4784065733063811}{4784065733063810973581885157618788676291241975216665977767007373648750357731006099232824032039924032894289638403441329240212719241920971274455782595989040464660523567661989180298099889009174801022976}:\\
\;\;\;\;\frac{\frac{t\_0}{t\_1}}{z} \cdot t\_2\\

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


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

    1. Initial program 83.0%

      \[\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-/.f6484.7%

        \[\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. *-commutativeN/A

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

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

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

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

        \[\leadsto \frac{y}{\left(\color{blue}{\left(z - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot z\right) \cdot z} \cdot x \]
      17. metadata-eval84.7%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(z - -1\right) \cdot z}}}{z} \cdot x \]
    5. Applied rewrites90.9%

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

    if 1e-183 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

    1. Initial program 83.0%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

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

Alternative 5: 94.5% accurate, 0.8× speedup?

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

    \[\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. *-commutativeN/A

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

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

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

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

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

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

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

Alternative 6: 90.4% accurate, 0.0× 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}\;\frac{t\_1 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 499999999999999980914845420907469931724617668138392575722702061727550202027827845338095855082297280184351144790266035545655630691827712:\\ \;\;\;\;\frac{t\_0}{\left(\left(z - -1\right) \cdot z\right) \cdot z} \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_1}{z} \cdot t\_0}{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 x)
   (*
    (copysign 1 y)
    (if (<=
         (/ (* t_1 t_0) (* (* z z) (+ z 1)))
         499999999999999980914845420907469931724617668138392575722702061727550202027827845338095855082297280184351144790266035545655630691827712)
      (* (/ t_0 (* (* (- z -1) z) z)) t_1)
      (/ (* (/ t_1 z) t_0) 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) / ((z * z) * (z + 1.0))) <= 5e+134) {
		tmp = (t_0 / (((z - -1.0) * z) * z)) * t_1;
	} else {
		tmp = ((t_1 / z) * t_0) / 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) / ((z * z) * (z + 1.0))) <= 5e+134) {
		tmp = (t_0 / (((z - -1.0) * z) * z)) * t_1;
	} else {
		tmp = ((t_1 / z) * t_0) / 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) / ((z * z) * (z + 1.0))) <= 5e+134:
		tmp = (t_0 / (((z - -1.0) * z) * z)) * t_1
	else:
		tmp = ((t_1 / z) * t_0) / 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(Float64(t_1 * t_0) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 5e+134)
		tmp = Float64(Float64(t_0 / Float64(Float64(Float64(z - -1.0) * z) * z)) * t_1);
	else
		tmp = Float64(Float64(Float64(t_1 / z) * t_0) / 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) / ((z * z) * (z + 1.0))) <= 5e+134)
		tmp = (t_0 / (((z - -1.0) * z) * z)) * t_1;
	else
		tmp = ((t_1 / z) * t_0) / 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 499999999999999980914845420907469931724617668138392575722702061727550202027827845338095855082297280184351144790266035545655630691827712], N[(N[(t$95$0 / N[(N[(N[(z - -1), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(t$95$1 / z), $MachinePrecision] * t$95$0), $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}\;\frac{t\_1 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 499999999999999980914845420907469931724617668138392575722702061727550202027827845338095855082297280184351144790266035545655630691827712:\\
\;\;\;\;\frac{t\_0}{\left(\left(z - -1\right) \cdot z\right) \cdot z} \cdot t\_1\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))) < 4.9999999999999998e134

    1. Initial program 83.0%

      \[\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-/.f6484.7%

        \[\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. *-commutativeN/A

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

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

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

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

        \[\leadsto \frac{y}{\left(\color{blue}{\left(z - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot z\right) \cdot z} \cdot x \]
      17. metadata-eval84.7%

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

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

    if 4.9999999999999998e134 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

    1. Initial program 83.0%

      \[\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}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\left(\color{blue}{\frac{1}{z - -1}} \cdot y\right) \cdot \frac{x}{z}}{z} \]
    5. Applied rewrites97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
      18. lower-*.f6494.2%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
    7. Applied rewrites94.2%

      \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z} \cdot y}}{z} \]
    8. Taylor expanded in z around 0

      \[\leadsto \frac{\color{blue}{\frac{x}{z}} \cdot y}{z} \]
    9. Step-by-step derivation
      1. lower-/.f6474.2%

        \[\leadsto \frac{\frac{x}{\color{blue}{z}} \cdot y}{z} \]
    10. Applied rewrites74.2%

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

Alternative 7: 88.7% accurate, 0.1× speedup?

\[\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;\frac{\left|x\right| \cdot \left|y\right|}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 399999999999999987819614071793278008371859228978996844859369901040438779531494853410754618301220342856148729636899364538023571524733514824321012998076331615720432379158562133553406184339792027801304062955170675602258086854656:\\ \;\;\;\;\frac{\left|x\right|}{\left(\left(z - -1\right) \cdot z\right) \cdot z} \cdot \left|y\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left|x\right|}{z} \cdot \left|y\right|}{z}\\ \end{array}\right) \]
(FPCore (x y z)
  :precision binary64
  (*
 (copysign 1 x)
 (*
  (copysign 1 y)
  (if (<=
       (/ (* (fabs x) (fabs y)) (* (* z z) (+ z 1)))
       399999999999999987819614071793278008371859228978996844859369901040438779531494853410754618301220342856148729636899364538023571524733514824321012998076331615720432379158562133553406184339792027801304062955170675602258086854656)
    (* (/ (fabs x) (* (* (- z -1) z) z)) (fabs y))
    (/ (* (/ (fabs x) z) (fabs y)) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (((fabs(x) * fabs(y)) / ((z * z) * (z + 1.0))) <= 4e+224) {
		tmp = (fabs(x) / (((z - -1.0) * z) * z)) * fabs(y);
	} else {
		tmp = ((fabs(x) / z) * fabs(y)) / z;
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
public static double code(double x, double y, double z) {
	double tmp;
	if (((Math.abs(x) * Math.abs(y)) / ((z * z) * (z + 1.0))) <= 4e+224) {
		tmp = (Math.abs(x) / (((z - -1.0) * z) * z)) * Math.abs(y);
	} else {
		tmp = ((Math.abs(x) / z) * Math.abs(y)) / z;
	}
	return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * tmp);
}
def code(x, y, z):
	tmp = 0
	if ((math.fabs(x) * math.fabs(y)) / ((z * z) * (z + 1.0))) <= 4e+224:
		tmp = (math.fabs(x) / (((z - -1.0) * z) * z)) * math.fabs(y)
	else:
		tmp = ((math.fabs(x) / z) * math.fabs(y)) / z
	return math.copysign(1.0, x) * (math.copysign(1.0, y) * tmp)
function code(x, y, z)
	tmp = 0.0
	if (Float64(Float64(abs(x) * abs(y)) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 4e+224)
		tmp = Float64(Float64(abs(x) / Float64(Float64(Float64(z - -1.0) * z) * z)) * abs(y));
	else
		tmp = Float64(Float64(Float64(abs(x) / z) * abs(y)) / z);
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((abs(x) * abs(y)) / ((z * z) * (z + 1.0))) <= 4e+224)
		tmp = (abs(x) / (((z - -1.0) * z) * z)) * abs(y);
	else
		tmp = ((abs(x) / z) * abs(y)) / z;
	end
	tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * tmp);
end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 399999999999999987819614071793278008371859228978996844859369901040438779531494853410754618301220342856148729636899364538023571524733514824321012998076331615720432379158562133553406184339792027801304062955170675602258086854656], N[(N[(N[Abs[x], $MachinePrecision] / N[(N[(N[(z - -1), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Abs[x], $MachinePrecision] / z), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|x\right| \cdot \left|y\right|}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 399999999999999987819614071793278008371859228978996844859369901040438779531494853410754618301220342856148729636899364538023571524733514824321012998076331615720432379158562133553406184339792027801304062955170675602258086854656:\\
\;\;\;\;\frac{\left|x\right|}{\left(\left(z - -1\right) \cdot z\right) \cdot z} \cdot \left|y\right|\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left|x\right|}{z} \cdot \left|y\right|}{z}\\


\end{array}\right)
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))) < 3.9999999999999999e224

    1. Initial program 83.0%

      \[\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}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.9999999999999999e224 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

    1. Initial program 83.0%

      \[\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}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

        \[\leadsto \frac{\left(\color{blue}{\frac{1}{z - -1}} \cdot y\right) \cdot \frac{x}{z}}{z} \]
    5. Applied rewrites97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
      18. lower-*.f6494.2%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
    7. Applied rewrites94.2%

      \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z} \cdot y}}{z} \]
    8. Taylor expanded in z around 0

      \[\leadsto \frac{\color{blue}{\frac{x}{z}} \cdot y}{z} \]
    9. Step-by-step derivation
      1. lower-/.f6474.2%

        \[\leadsto \frac{\frac{x}{\color{blue}{z}} \cdot y}{z} \]
    10. Applied rewrites74.2%

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

Alternative 8: 80.6% accurate, 0.0× 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}\;\frac{t\_1 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq \frac{1668739871813211}{8343699359066055009355553539724812947666814540455674882605631280555545803830627148527195652096}:\\ \;\;\;\;\frac{t\_1}{\left(1 \cdot z\right) \cdot z} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_1}{z} \cdot t\_0}{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 x)
   (*
    (copysign 1 y)
    (if (<=
         (/ (* t_1 t_0) (* (* z z) (+ z 1)))
         1668739871813211/8343699359066055009355553539724812947666814540455674882605631280555545803830627148527195652096)
      (* (/ t_1 (* (* 1 z) z)) t_0)
      (/ (* (/ t_1 z) t_0) 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) / ((z * z) * (z + 1.0))) <= 2e-79) {
		tmp = (t_1 / ((1.0 * z) * z)) * t_0;
	} else {
		tmp = ((t_1 / z) * t_0) / 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) / ((z * z) * (z + 1.0))) <= 2e-79) {
		tmp = (t_1 / ((1.0 * z) * z)) * t_0;
	} else {
		tmp = ((t_1 / z) * t_0) / 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) / ((z * z) * (z + 1.0))) <= 2e-79:
		tmp = (t_1 / ((1.0 * z) * z)) * t_0
	else:
		tmp = ((t_1 / z) * t_0) / 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(Float64(t_1 * t_0) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 2e-79)
		tmp = Float64(Float64(t_1 / Float64(Float64(1.0 * z) * z)) * t_0);
	else
		tmp = Float64(Float64(Float64(t_1 / z) * t_0) / 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) / ((z * z) * (z + 1.0))) <= 2e-79)
		tmp = (t_1 / ((1.0 * z) * z)) * t_0;
	else
		tmp = ((t_1 / z) * t_0) / 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], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1668739871813211/8343699359066055009355553539724812947666814540455674882605631280555545803830627148527195652096], N[(N[(t$95$1 / N[(N[(1 * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(t$95$1 / z), $MachinePrecision] * t$95$0), $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}\;\frac{t\_1 \cdot t\_0}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq \frac{1668739871813211}{8343699359066055009355553539724812947666814540455674882605631280555545803830627148527195652096}:\\
\;\;\;\;\frac{t\_1}{\left(1 \cdot z\right) \cdot z} \cdot t\_0\\

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


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

    1. Initial program 83.0%

      \[\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.5%

        \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      if 2e-79 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

      1. Initial program 83.0%

        \[\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}} \]
      4. Step-by-step derivation
        1. lift-/.f64N/A

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

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

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

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

          \[\leadsto \frac{\left(\color{blue}{\frac{1}{z - -1}} \cdot y\right) \cdot \frac{x}{z}}{z} \]
      5. Applied rewrites97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
        18. lower-*.f6494.2%

          \[\leadsto \frac{\frac{x}{\color{blue}{\left(z - -1\right) \cdot z}} \cdot y}{z} \]
      7. Applied rewrites94.2%

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(z - -1\right) \cdot z} \cdot y}}{z} \]
      8. Taylor expanded in z around 0

        \[\leadsto \frac{\color{blue}{\frac{x}{z}} \cdot y}{z} \]
      9. Step-by-step derivation
        1. lower-/.f6474.2%

          \[\leadsto \frac{\frac{x}{\color{blue}{z}} \cdot y}{z} \]
      10. Applied rewrites74.2%

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

    Alternative 9: 75.5% accurate, 0.1× speedup?

    \[\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\frac{\mathsf{min}\left(\left|x\right|, \left|y\right|\right)}{\left(1 \cdot z\right) \cdot z} \cdot \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\right)\right) \]
    (FPCore (x y z)
      :precision binary64
      (*
     (copysign 1 x)
     (*
      (copysign 1 y)
      (*
       (/ (fmin (fabs x) (fabs y)) (* (* 1 z) z))
       (fmax (fabs x) (fabs y))))))
    double code(double x, double y, double z) {
    	return copysign(1.0, x) * (copysign(1.0, y) * ((fmin(fabs(x), fabs(y)) / ((1.0 * z) * z)) * fmax(fabs(x), fabs(y))));
    }
    
    public static double code(double x, double y, double z) {
    	return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * ((fmin(Math.abs(x), Math.abs(y)) / ((1.0 * z) * z)) * fmax(Math.abs(x), Math.abs(y))));
    }
    
    def code(x, y, z):
    	return math.copysign(1.0, x) * (math.copysign(1.0, y) * ((fmin(math.fabs(x), math.fabs(y)) / ((1.0 * z) * z)) * fmax(math.fabs(x), math.fabs(y))))
    
    function code(x, y, z)
    	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(Float64(fmin(abs(x), abs(y)) / Float64(Float64(1.0 * z) * z)) * fmax(abs(x), abs(y)))))
    end
    
    function tmp = code(x, y, z)
    	tmp = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((min(abs(x), abs(y)) / ((1.0 * z) * z)) * max(abs(x), abs(y))));
    end
    
    code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[(N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision] / N[(N[(1 * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\frac{\mathsf{min}\left(\left|x\right|, \left|y\right|\right)}{\left(1 \cdot z\right) \cdot z} \cdot \mathsf{max}\left(\left|x\right|, \left|y\right|\right)\right)\right)
    
    Derivation
    1. Initial program 83.0%

      \[\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.5%

        \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      Reproduce

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