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

Percentage Accurate: 83.2% → 98.5%
Time: 2.9s
Alternatives: 11
Speedup: 0.4×

Specification

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

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 83.2% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{\frac{t\_1}{z - -1}}{z}}{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)))) < 2.0000000000000001e-133

    1. Initial program 83.2%

      \[\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.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{z}}}{\mathsf{fma}\left(z, z, z\right)} \cdot x \]
      6. lower-/.f6490.5

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

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

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

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
      3. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
    5. Applied rewrites96.7%

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

Alternative 2: 98.4% accurate, 0.3× speedup?

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

\mathbf{elif}\;z \leq 1.86 \cdot 10^{-75}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{t\_1}{z}}{z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.9999999999999998e-20 or 1.86e-75 < z

    1. Initial program 83.2%

      \[\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.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{z}}}{\mathsf{fma}\left(z, z, z\right)} \cdot x \]
      6. lower-/.f6490.5

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

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

    if -9.9999999999999998e-20 < z < 1.86e-75

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
      3. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
    5. Applied rewrites96.7%

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{t\_1}{\mathsf{fma}\left(z, z, z\right)}}{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)))) < 2.0000000000000001e-133

    1. Initial program 83.2%

      \[\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.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{z}}}{\mathsf{fma}\left(z, z, z\right)} \cdot x \]
      6. lower-/.f6490.5

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

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

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

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

Alternative 4: 96.5% accurate, 0.4× 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.0 x)
  (*
   (copysign 1.0 y)
   (/
    (* (/ (fmax (fabs x) (fabs y)) (- z -1.0)) (/ (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.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[(N[(N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision] / N[(z - -1.0), $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.2%

    \[\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.3

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

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

Alternative 5: 93.6% accurate, 0.4× speedup?

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

\mathbf{elif}\;z \leq 1.86 \cdot 10^{-75}:\\
\;\;\;\;\frac{t\_1 \cdot \frac{t\_0}{z}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2e-19

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
      3. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
    5. Applied rewrites96.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{\frac{x}{z - -1}}{z}} \]
      5. lower-/.f6496.6

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \]
      14. lower-/.f6494.5

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

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

    if -2e-19 < z < 1.86e-75

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
      3. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
    5. Applied rewrites96.7%

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

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

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

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

    if 1.86e-75 < z

    1. Initial program 83.2%

      \[\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.8

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.6% accurate, 0.4× 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)\\ t_2 := \frac{t\_0}{\mathsf{fma}\left(z, z, z\right) \cdot z} \cdot t\_1\\ \mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-19}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 1.86 \cdot 10^{-75}:\\ \;\;\;\;\frac{t\_0 \cdot \frac{t\_1}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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)))
        (t_2 (* (/ t_0 (* (fma z z z) z)) t_1)))
   (*
    (copysign 1.0 x)
    (*
     (copysign 1.0 y)
     (if (<= z -1e-19)
       t_2
       (if (<= z 1.86e-75) (/ (* t_0 (/ t_1 z)) z) t_2))))))
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 t_2 = (t_0 / (fma(z, z, z) * z)) * t_1;
	double tmp;
	if (z <= -1e-19) {
		tmp = t_2;
	} else if (z <= 1.86e-75) {
		tmp = (t_0 * (t_1 / z)) / z;
	} else {
		tmp = t_2;
	}
	return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
function code(x, y, z)
	t_0 = fmax(abs(x), abs(y))
	t_1 = fmin(abs(x), abs(y))
	t_2 = Float64(Float64(t_0 / Float64(fma(z, z, z) * z)) * t_1)
	tmp = 0.0
	if (z <= -1e-19)
		tmp = t_2;
	elseif (z <= 1.86e-75)
		tmp = Float64(Float64(t_0 * Float64(t_1 / z)) / z);
	else
		tmp = t_2;
	end
	return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp))
end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[x], $MachinePrecision], N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 / N[(N[(z * z + z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[z, -1e-19], t$95$2, If[LessEqual[z, 1.86e-75], N[(N[(t$95$0 * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$2]]), $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)\\
t_2 := \frac{t\_0}{\mathsf{fma}\left(z, z, z\right) \cdot z} \cdot t\_1\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 1.86 \cdot 10^{-75}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{t\_1}{z}}{z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.9999999999999998e-20 or 1.86e-75 < z

    1. Initial program 83.2%

      \[\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.8

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999998e-20 < z < 1.86e-75

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
      3. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
    5. Applied rewrites96.7%

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{t\_1}{z}}{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.67999999999999988e277

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 83.2%

      \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
      3. distribute-lft1-inN/A

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
    5. Applied rewrites96.7%

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{t\_1}{z}}{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)))) < 9.9999999999999997e-148

    1. Initial program 83.2%

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

        \[\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.1

          \[\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.1

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

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

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

      1. Initial program 83.2%

        \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
        3. distribute-lft1-inN/A

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

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

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

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

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

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

          \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
      5. Applied rewrites96.7%

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

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

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

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

    Alternative 9: 78.0% accurate, 0.3× speedup?

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

      1. Initial program 83.2%

        \[\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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z}}}{z} \]
        3. distribute-lft1-inN/A

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

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

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

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

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

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

          \[\leadsto \frac{y \cdot \frac{\color{blue}{\frac{x}{z - -1}}}{z}}{z} \]
      5. Applied rewrites96.7%

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

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

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

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

      if 9.9999999999999994e-37 < (*.f64 x y)

      1. Initial program 83.2%

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

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

          \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
        3. lower-*.f6483.2

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

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

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

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

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

          \[\leadsto \frac{y \cdot x}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \]
        12. lower-fma.f6483.2

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

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

        \[\leadsto \frac{y \cdot x}{\color{blue}{z} \cdot z} \]
      5. Step-by-step derivation
        1. Applied rewrites69.9%

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

      Alternative 10: 76.5% accurate, 0.5× speedup?

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

        1. Initial program 83.2%

          \[\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.3

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

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

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

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{z}}}{z} \]
          2. lower-*.f6470.7

            \[\leadsto \frac{\frac{x \cdot y}{z}}{z} \]
        6. Applied rewrites70.7%

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

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

            \[\leadsto \frac{\frac{x \cdot y}{z}}{z} \]
          3. associate-/l*N/A

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

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

            \[\leadsto \frac{\frac{y}{z} \cdot \color{blue}{x}}{z} \]
          6. lower-/.f6474.1

            \[\leadsto \frac{\frac{y}{z} \cdot x}{z} \]
        8. Applied rewrites74.1%

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

        if 9.99999999999999927e74 < y

        1. Initial program 83.2%

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

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

            \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
          3. lower-*.f6483.2

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

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

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

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

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

            \[\leadsto \frac{y \cdot x}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \]
          12. lower-fma.f6483.2

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

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

          \[\leadsto \frac{y \cdot x}{\color{blue}{z} \cdot z} \]
        5. Step-by-step derivation
          1. Applied rewrites69.9%

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

        Alternative 11: 69.9% accurate, 1.6× speedup?

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

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

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

            \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
          3. lower-*.f6483.2

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

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

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

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

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

            \[\leadsto \frac{y \cdot x}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \]
          12. lower-fma.f6483.2

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

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

          \[\leadsto \frac{y \cdot x}{\color{blue}{z} \cdot z} \]
        5. Step-by-step derivation
          1. Applied rewrites69.9%

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

          Reproduce

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