?

Average Accuracy: 77.4% → 94.8%
Time: 13.4s
Precision: binary64
Cost: 1100

?

\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
\[\begin{array}{l} t_0 := \frac{\frac{x}{z}}{z}\\ \mathbf{if}\;z \leq -7.5 \cdot 10^{-98}:\\ \;\;\;\;\frac{y \cdot t_0}{z + 1}\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-163}:\\ \;\;\;\;\frac{\frac{y}{z}}{\frac{z}{x}}\\ \mathbf{elif}\;z \leq 10^{+26}:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\frac{z}{y}}\\ \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (/ x z) z)))
   (if (<= z -7.5e-98)
     (/ (* y t_0) (+ z 1.0))
     (if (<= z 1.32e-163)
       (/ (/ y z) (/ z x))
       (if (<= z 1e+26) (/ (* y (/ x z)) (+ z (* z z))) (/ t_0 (/ z y)))))))
double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
double code(double x, double y, double z) {
	double t_0 = (x / z) / z;
	double tmp;
	if (z <= -7.5e-98) {
		tmp = (y * t_0) / (z + 1.0);
	} else if (z <= 1.32e-163) {
		tmp = (y / z) / (z / x);
	} else if (z <= 1e+26) {
		tmp = (y * (x / z)) / (z + (z * z));
	} else {
		tmp = t_0 / (z / y);
	}
	return tmp;
}
real(8) function code(x, y, z)
    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
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x / z) / z
    if (z <= (-7.5d-98)) then
        tmp = (y * t_0) / (z + 1.0d0)
    else if (z <= 1.32d-163) then
        tmp = (y / z) / (z / x)
    else if (z <= 1d+26) then
        tmp = (y * (x / z)) / (z + (z * z))
    else
        tmp = t_0 / (z / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
public static double code(double x, double y, double z) {
	double t_0 = (x / z) / z;
	double tmp;
	if (z <= -7.5e-98) {
		tmp = (y * t_0) / (z + 1.0);
	} else if (z <= 1.32e-163) {
		tmp = (y / z) / (z / x);
	} else if (z <= 1e+26) {
		tmp = (y * (x / z)) / (z + (z * z));
	} else {
		tmp = t_0 / (z / y);
	}
	return tmp;
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
def code(x, y, z):
	t_0 = (x / z) / z
	tmp = 0
	if z <= -7.5e-98:
		tmp = (y * t_0) / (z + 1.0)
	elif z <= 1.32e-163:
		tmp = (y / z) / (z / x)
	elif z <= 1e+26:
		tmp = (y * (x / z)) / (z + (z * z))
	else:
		tmp = t_0 / (z / y)
	return tmp
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function code(x, y, z)
	t_0 = Float64(Float64(x / z) / z)
	tmp = 0.0
	if (z <= -7.5e-98)
		tmp = Float64(Float64(y * t_0) / Float64(z + 1.0));
	elseif (z <= 1.32e-163)
		tmp = Float64(Float64(y / z) / Float64(z / x));
	elseif (z <= 1e+26)
		tmp = Float64(Float64(y * Float64(x / z)) / Float64(z + Float64(z * z)));
	else
		tmp = Float64(t_0 / Float64(z / y));
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
function tmp_2 = code(x, y, z)
	t_0 = (x / z) / z;
	tmp = 0.0;
	if (z <= -7.5e-98)
		tmp = (y * t_0) / (z + 1.0);
	elseif (z <= 1.32e-163)
		tmp = (y / z) / (z / x);
	elseif (z <= 1e+26)
		tmp = (y * (x / z)) / (z + (z * z));
	else
		tmp = t_0 / (z / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -7.5e-98], N[(N[(y * t$95$0), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.32e-163], N[(N[(y / z), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+26], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
t_0 := \frac{\frac{x}{z}}{z}\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{y \cdot t_0}{z + 1}\\

\mathbf{elif}\;z \leq 1.32 \cdot 10^{-163}:\\
\;\;\;\;\frac{\frac{y}{z}}{\frac{z}{x}}\\

\mathbf{elif}\;z \leq 10^{+26}:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{\frac{z}{y}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original77.4%
Target93.6%
Herbie94.8%
\[\begin{array}{l} \mathbf{if}\;z < 249.6182814532307:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\ \end{array} \]

Derivation?

  1. Split input into 4 regimes
  2. if z < -7.5000000000000006e-98

    1. Initial program 85.4%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Simplified92.2%

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

      [Start]85.4

      \[ \frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]

      times-frac [=>]92.2

      \[ \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    3. Applied egg-rr95.4%

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

      [Start]92.2

      \[ \frac{x}{z \cdot z} \cdot \frac{y}{z + 1} \]

      associate-*r/ [=>]91.9

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

      associate-/r* [=>]95.4

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

    if -7.5000000000000006e-98 < z < 1.32e-163

    1. Initial program 25.7%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Simplified62.8%

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

      [Start]25.7

      \[ \frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]

      *-commutative [=>]25.7

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

      associate-*r/ [<=]25.0

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

      associate-*l* [=>]25.0

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

      associate-/r* [=>]62.8

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

      distribute-rgt-in [=>]62.8

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

      *-lft-identity [=>]62.8

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

      fma-def [=>]62.8

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{{z}^{2}}} \]
    4. Simplified89.5%

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

      [Start]25.7

      \[ \frac{y \cdot x}{{z}^{2}} \]

      *-commutative [=>]25.7

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

      unpow2 [=>]25.7

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

      times-frac [=>]89.5

      \[ \color{blue}{\frac{x}{z} \cdot \frac{y}{z}} \]
    5. Applied egg-rr90.0%

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

      [Start]89.5

      \[ \frac{x}{z} \cdot \frac{y}{z} \]

      clear-num [=>]89.4

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

      associate-*l/ [=>]90.0

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

      *-un-lft-identity [<=]90.0

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

    if 1.32e-163 < z < 1.00000000000000005e26

    1. Initial program 88.9%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Simplified88.3%

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

      [Start]88.9

      \[ \frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]

      times-frac [=>]88.3

      \[ \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    3. Applied egg-rr93.5%

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

      [Start]88.3

      \[ \frac{x}{z \cdot z} \cdot \frac{y}{z + 1} \]

      associate-*r/ [=>]88.4

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

      associate-/r* [=>]89.7

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

      associate-*l/ [=>]93.5

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

      associate-/l/ [=>]93.5

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

      distribute-lft1-in [<=]93.5

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

      +-commutative [=>]93.5

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

    if 1.00000000000000005e26 < z

    1. Initial program 81.9%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Simplified92.2%

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

      [Start]81.9

      \[ \frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]

      times-frac [=>]92.2

      \[ \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    3. Taylor expanded in z around inf 92.2%

      \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{\frac{y}{z}} \]
    4. Applied egg-rr96.4%

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

      [Start]92.2

      \[ \frac{x}{z \cdot z} \cdot \frac{y}{z} \]

      associate-*r/ [=>]92.1

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

      associate-/l* [=>]92.0

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

      associate-/r* [=>]96.4

      \[ \frac{\color{blue}{\frac{\frac{x}{z}}{z}}}{\frac{z}{y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification94.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{-98}:\\ \;\;\;\;\frac{y \cdot \frac{\frac{x}{z}}{z}}{z + 1}\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-163}:\\ \;\;\;\;\frac{\frac{y}{z}}{\frac{z}{x}}\\ \mathbf{elif}\;z \leq 10^{+26}:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{z}}{z}}{\frac{z}{y}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy92.9%
Cost1608
\[\begin{array}{l} t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ \mathbf{if}\;t_0 \leq -500:\\ \;\;\;\;\frac{\frac{\frac{x}{z}}{z}}{\frac{z}{y}}\\ \mathbf{elif}\;t_0 \leq 0.1:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\ \end{array} \]
Alternative 2
Accuracy94.6%
Cost964
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-78}:\\ \;\;\;\;\frac{y \cdot \frac{\frac{x}{z}}{z}}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z + 1}{y}}\\ \end{array} \]
Alternative 3
Accuracy90.3%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \end{array} \]
Alternative 4
Accuracy92.8%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \end{array} \]
Alternative 5
Accuracy92.9%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \end{array} \]
Alternative 6
Accuracy90.1%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x \cdot \frac{y}{z}}{z \cdot z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z \cdot z}\\ \end{array} \]
Alternative 7
Accuracy90.1%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z \cdot z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z \cdot z}\\ \end{array} \]
Alternative 8
Accuracy92.6%
Cost836
\[\begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+172}:\\ \;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \end{array} \]
Alternative 9
Accuracy71.6%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{-111} \lor \neg \left(y \leq 7 \cdot 10^{+49}\right):\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \end{array} \]
Alternative 10
Accuracy70.7%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 7.3 \cdot 10^{+49}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\ \end{array} \]
Alternative 11
Accuracy72.2%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 10^{+14}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \]
Alternative 12
Accuracy72.2%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z \cdot z}{x}}\\ \end{array} \]
Alternative 13
Accuracy65.1%
Cost448
\[y \cdot \frac{\frac{x}{z}}{z} \]
Alternative 14
Accuracy28.4%
Cost384
\[\frac{-y}{\frac{z}{x}} \]

Error

Reproduce?

herbie shell --seed 2023131 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))

  (/ (* x y) (* (* z z) (+ z 1.0))))