
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
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)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
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)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= z 2.2e+160) (- x (/ x (/ y z))) (/ (* x (- y z)) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.2e+160) {
tmp = x - (x / (y / z));
} else {
tmp = (x * (y - 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
real(8) :: tmp
if (z <= 2.2d+160) then
tmp = x - (x / (y / z))
else
tmp = (x * (y - z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2.2e+160) {
tmp = x - (x / (y / z));
} else {
tmp = (x * (y - z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.2e+160: tmp = x - (x / (y / z)) else: tmp = (x * (y - z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.2e+160) tmp = Float64(x - Float64(x / Float64(y / z))); else tmp = Float64(Float64(x * Float64(y - z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2.2e+160) tmp = x - (x / (y / z)); else tmp = (x * (y - z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.2e+160], N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.2 \cdot 10^{+160}:\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\end{array}
\end{array}
if z < 2.19999999999999992e160Initial program 81.7%
--rgt-identity81.7%
associate-*l/84.5%
sub-neg84.5%
distribute-rgt-in81.4%
*-commutative81.4%
distribute-lft-neg-out81.4%
unsub-neg81.4%
associate--r+81.4%
associate-*l/77.5%
associate-/l*93.9%
*-inverses93.9%
/-rgt-identity93.9%
+-rgt-identity93.9%
*-commutative93.9%
associate-/r/96.5%
Simplified96.5%
if 2.19999999999999992e160 < z Initial program 94.9%
Final simplification96.3%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.5e+86)
(and (not (<= z -1.2e+15))
(or (<= z -9.5e-88)
(and (not (<= z 1.9e-116))
(or (<= z 6.6e-92) (not (<= z 2.55e+69)))))))
(* x (/ (- z) y))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+86) || (!(z <= -1.2e+15) && ((z <= -9.5e-88) || (!(z <= 1.9e-116) && ((z <= 6.6e-92) || !(z <= 2.55e+69)))))) {
tmp = x * (-z / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.5d+86)) .or. (.not. (z <= (-1.2d+15))) .and. (z <= (-9.5d-88)) .or. (.not. (z <= 1.9d-116)) .and. (z <= 6.6d-92) .or. (.not. (z <= 2.55d+69))) then
tmp = x * (-z / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+86) || (!(z <= -1.2e+15) && ((z <= -9.5e-88) || (!(z <= 1.9e-116) && ((z <= 6.6e-92) || !(z <= 2.55e+69)))))) {
tmp = x * (-z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5e+86) or (not (z <= -1.2e+15) and ((z <= -9.5e-88) or (not (z <= 1.9e-116) and ((z <= 6.6e-92) or not (z <= 2.55e+69))))): tmp = x * (-z / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5e+86) || (!(z <= -1.2e+15) && ((z <= -9.5e-88) || (!(z <= 1.9e-116) && ((z <= 6.6e-92) || !(z <= 2.55e+69)))))) tmp = Float64(x * Float64(Float64(-z) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.5e+86) || (~((z <= -1.2e+15)) && ((z <= -9.5e-88) || (~((z <= 1.9e-116)) && ((z <= 6.6e-92) || ~((z <= 2.55e+69))))))) tmp = x * (-z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5e+86], And[N[Not[LessEqual[z, -1.2e+15]], $MachinePrecision], Or[LessEqual[z, -9.5e-88], And[N[Not[LessEqual[z, 1.9e-116]], $MachinePrecision], Or[LessEqual[z, 6.6e-92], N[Not[LessEqual[z, 2.55e+69]], $MachinePrecision]]]]]], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+86} \lor \neg \left(z \leq -1.2 \cdot 10^{+15}\right) \land \left(z \leq -9.5 \cdot 10^{-88} \lor \neg \left(z \leq 1.9 \cdot 10^{-116}\right) \land \left(z \leq 6.6 \cdot 10^{-92} \lor \neg \left(z \leq 2.55 \cdot 10^{+69}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.49999999999999988e86 or -1.2e15 < z < -9.5e-88 or 1.9000000000000001e-116 < z < 6.59999999999999996e-92 or 2.54999999999999999e69 < z Initial program 87.1%
associate-*r/88.6%
Simplified88.6%
Taylor expanded in y around 0 69.6%
neg-mul-169.6%
distribute-neg-frac69.6%
Simplified69.6%
if -1.49999999999999988e86 < z < -1.2e15 or -9.5e-88 < z < 1.9000000000000001e-116 or 6.59999999999999996e-92 < z < 2.54999999999999999e69Initial program 80.2%
associate-*r/97.6%
Simplified97.6%
Taylor expanded in y around inf 79.9%
Final simplification74.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ (- z) y))) (t_1 (* z (/ (- x) y))))
(if (<= z -2.2e+39)
t_1
(if (<= z -1.02e+15)
x
(if (<= z -8e-88)
t_0
(if (<= z 1.9e-116)
x
(if (<= z 2.5e-92) t_0 (if (<= z 2e+69) x t_1))))))))
double code(double x, double y, double z) {
double t_0 = x * (-z / y);
double t_1 = z * (-x / y);
double tmp;
if (z <= -2.2e+39) {
tmp = t_1;
} else if (z <= -1.02e+15) {
tmp = x;
} else if (z <= -8e-88) {
tmp = t_0;
} else if (z <= 1.9e-116) {
tmp = x;
} else if (z <= 2.5e-92) {
tmp = t_0;
} else if (z <= 2e+69) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
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) :: t_1
real(8) :: tmp
t_0 = x * (-z / y)
t_1 = z * (-x / y)
if (z <= (-2.2d+39)) then
tmp = t_1
else if (z <= (-1.02d+15)) then
tmp = x
else if (z <= (-8d-88)) then
tmp = t_0
else if (z <= 1.9d-116) then
tmp = x
else if (z <= 2.5d-92) then
tmp = t_0
else if (z <= 2d+69) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-z / y);
double t_1 = z * (-x / y);
double tmp;
if (z <= -2.2e+39) {
tmp = t_1;
} else if (z <= -1.02e+15) {
tmp = x;
} else if (z <= -8e-88) {
tmp = t_0;
} else if (z <= 1.9e-116) {
tmp = x;
} else if (z <= 2.5e-92) {
tmp = t_0;
} else if (z <= 2e+69) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-z / y) t_1 = z * (-x / y) tmp = 0 if z <= -2.2e+39: tmp = t_1 elif z <= -1.02e+15: tmp = x elif z <= -8e-88: tmp = t_0 elif z <= 1.9e-116: tmp = x elif z <= 2.5e-92: tmp = t_0 elif z <= 2e+69: tmp = x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(-z) / y)) t_1 = Float64(z * Float64(Float64(-x) / y)) tmp = 0.0 if (z <= -2.2e+39) tmp = t_1; elseif (z <= -1.02e+15) tmp = x; elseif (z <= -8e-88) tmp = t_0; elseif (z <= 1.9e-116) tmp = x; elseif (z <= 2.5e-92) tmp = t_0; elseif (z <= 2e+69) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-z / y); t_1 = z * (-x / y); tmp = 0.0; if (z <= -2.2e+39) tmp = t_1; elseif (z <= -1.02e+15) tmp = x; elseif (z <= -8e-88) tmp = t_0; elseif (z <= 1.9e-116) tmp = x; elseif (z <= 2.5e-92) tmp = t_0; elseif (z <= 2e+69) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+39], t$95$1, If[LessEqual[z, -1.02e+15], x, If[LessEqual[z, -8e-88], t$95$0, If[LessEqual[z, 1.9e-116], x, If[LessEqual[z, 2.5e-92], t$95$0, If[LessEqual[z, 2e+69], x, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-z}{y}\\
t_1 := z \cdot \frac{-x}{y}\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{+15}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-88}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-116}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-92}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+69}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.2000000000000001e39 or 2.0000000000000001e69 < z Initial program 89.0%
associate-*r/84.1%
Simplified84.1%
Taylor expanded in y around 0 80.5%
associate-*r/81.4%
associate-*r*81.4%
neg-mul-181.4%
*-commutative81.4%
Simplified81.4%
if -2.2000000000000001e39 < z < -1.02e15 or -7.99999999999999947e-88 < z < 1.9000000000000001e-116 or 2.50000000000000006e-92 < z < 2.0000000000000001e69Initial program 78.8%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around inf 82.7%
if -1.02e15 < z < -7.99999999999999947e-88 or 1.9000000000000001e-116 < z < 2.50000000000000006e-92Initial program 82.8%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 63.7%
neg-mul-163.7%
distribute-neg-frac63.7%
Simplified63.7%
Final simplification80.0%
(FPCore (x y z) :precision binary64 (if (<= z 1.36e+178) (* x (/ (- y z) y)) (* z (/ (- x) y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.36e+178) {
tmp = x * ((y - z) / y);
} else {
tmp = z * (-x / 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
real(8) :: tmp
if (z <= 1.36d+178) then
tmp = x * ((y - z) / y)
else
tmp = z * (-x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.36e+178) {
tmp = x * ((y - z) / y);
} else {
tmp = z * (-x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.36e+178: tmp = x * ((y - z) / y) else: tmp = z * (-x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.36e+178) tmp = Float64(x * Float64(Float64(y - z) / y)); else tmp = Float64(z * Float64(Float64(-x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.36e+178) tmp = x * ((y - z) / y); else tmp = z * (-x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.36e+178], N[(x * N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.36 \cdot 10^{+178}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\end{array}
\end{array}
if z < 1.35999999999999992e178Initial program 82.1%
associate-*r/96.1%
Simplified96.1%
if 1.35999999999999992e178 < z Initial program 94.3%
associate-*r/73.1%
Simplified73.1%
Taylor expanded in y around 0 91.7%
associate-*r/92.3%
associate-*r*92.3%
neg-mul-192.3%
*-commutative92.3%
Simplified92.3%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (<= z 2.3e+119) (* x (/ (- y z) y)) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.3e+119) {
tmp = x * ((y - z) / y);
} else {
tmp = (y - z) * (x / 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
real(8) :: tmp
if (z <= 2.3d+119) then
tmp = x * ((y - z) / y)
else
tmp = (y - z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2.3e+119) {
tmp = x * ((y - z) / y);
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.3e+119: tmp = x * ((y - z) / y) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.3e+119) tmp = Float64(x * Float64(Float64(y - z) / y)); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2.3e+119) tmp = x * ((y - z) / y); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.3e+119], N[(x * N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+119}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < 2.3000000000000001e119Initial program 83.3%
associate-*r/96.3%
Simplified96.3%
if 2.3000000000000001e119 < z Initial program 85.8%
*-commutative85.8%
associate-*r/93.0%
Simplified93.0%
Final simplification95.7%
(FPCore (x y z) :precision binary64 (if (<= z 7e+118) (- x (/ x (/ y z))) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 7e+118) {
tmp = x - (x / (y / z));
} else {
tmp = (y - z) * (x / 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
real(8) :: tmp
if (z <= 7d+118) then
tmp = x - (x / (y / z))
else
tmp = (y - z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 7e+118) {
tmp = x - (x / (y / z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 7e+118: tmp = x - (x / (y / z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 7e+118) tmp = Float64(x - Float64(x / Float64(y / z))); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 7e+118) tmp = x - (x / (y / z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 7e+118], N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{+118}:\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < 7.00000000000000033e118Initial program 83.3%
--rgt-identity83.3%
associate-*l/83.9%
sub-neg83.9%
distribute-rgt-in80.7%
*-commutative80.7%
distribute-lft-neg-out80.7%
unsub-neg80.7%
associate--r+80.7%
associate-*l/78.5%
associate-/l*93.6%
*-inverses93.6%
/-rgt-identity93.6%
+-rgt-identity93.6%
*-commutative93.6%
associate-/r/96.8%
Simplified96.8%
if 7.00000000000000033e118 < z Initial program 85.8%
*-commutative85.8%
associate-*r/93.0%
Simplified93.0%
Final simplification96.1%
(FPCore (x y z) :precision binary64 (if (<= x -2.8e+211) (* y (/ x y)) x))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.8e+211) {
tmp = y * (x / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.8d+211)) then
tmp = y * (x / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.8e+211) {
tmp = y * (x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.8e+211: tmp = y * (x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.8e+211) tmp = Float64(y * Float64(x / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.8e+211) tmp = y * (x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.8e+211], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+211}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.8e211Initial program 76.7%
Taylor expanded in y around inf 18.1%
associate-/l*61.8%
div-inv66.1%
clear-num66.2%
Applied egg-rr66.2%
if -2.8e211 < x Initial program 84.3%
associate-*r/92.3%
Simplified92.3%
Taylor expanded in y around inf 49.6%
Final simplification50.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 83.7%
associate-*r/92.9%
Simplified92.9%
Taylor expanded in y around inf 48.5%
Final simplification48.5%
(FPCore (x y z) :precision binary64 (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / 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
real(8) :: tmp
if (z < (-2.060202331921739d+104)) then
tmp = x - ((z * x) / y)
else if (z < 1.6939766013828526d+213) then
tmp = x / (y / (y - z))
else
tmp = (y - z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < -2.060202331921739e+104: tmp = x - ((z * x) / y) elif z < 1.6939766013828526e+213: tmp = x / (y / (y - z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z < -2.060202331921739e+104) tmp = Float64(x - Float64(Float64(z * x) / y)); elseif (z < 1.6939766013828526e+213) tmp = Float64(x / Float64(y / Float64(y - z))); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < -2.060202331921739e+104) tmp = x - ((z * x) / y); elseif (z < 1.6939766013828526e+213) tmp = x / (y / (y - z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, -2.060202331921739e+104], N[(x - N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[Less[z, 1.6939766013828526e+213], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < -2.060202331921739 \cdot 10^{+104}:\\
\;\;\;\;x - \frac{z \cdot x}{y}\\
\mathbf{elif}\;z < 1.6939766013828526 \cdot 10^{+213}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
herbie shell --seed 2023268
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))