
(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 10 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 -1.95e+77) (* (/ x y) (- y z)) (/ x (/ y (- y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+77) {
tmp = (x / y) * (y - z);
} else {
tmp = x / (y / (y - z));
}
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.95d+77)) then
tmp = (x / y) * (y - z)
else
tmp = x / (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+77) {
tmp = (x / y) * (y - z);
} else {
tmp = x / (y / (y - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.95e+77: tmp = (x / y) * (y - z) else: tmp = x / (y / (y - z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.95e+77) tmp = Float64(Float64(x / y) * Float64(y - z)); else tmp = Float64(x / Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.95e+77) tmp = (x / y) * (y - z); else tmp = x / (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.95e+77], N[(N[(x / y), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{y} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\end{array}
\end{array}
if z < -1.9499999999999999e77Initial program 89.5%
associate-*l/95.7%
Simplified95.7%
if -1.9499999999999999e77 < z Initial program 83.4%
associate-*l/88.0%
Simplified88.0%
associate-/r/98.9%
Applied egg-rr98.9%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.8e-36) (not (<= z 4.4e+48))) (* x (/ (- z) y)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-36) || !(z <= 4.4e+48)) {
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 <= (-3.8d-36)) .or. (.not. (z <= 4.4d+48))) 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 <= -3.8e-36) || !(z <= 4.4e+48)) {
tmp = x * (-z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e-36) or not (z <= 4.4e+48): tmp = x * (-z / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e-36) || !(z <= 4.4e+48)) 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 <= -3.8e-36) || ~((z <= 4.4e+48))) tmp = x * (-z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e-36], N[Not[LessEqual[z, 4.4e+48]], $MachinePrecision]], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-36} \lor \neg \left(z \leq 4.4 \cdot 10^{+48}\right):\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.79999999999999971e-36 or 4.3999999999999999e48 < z Initial program 90.1%
*-commutative90.1%
associate-*l/91.5%
*-commutative91.5%
div-sub91.5%
*-inverses91.5%
Simplified91.5%
Taylor expanded in z around inf 73.7%
associate-*r/73.7%
mul-1-neg73.7%
distribute-rgt-neg-out73.7%
associate-*r/69.5%
Simplified69.5%
if -3.79999999999999971e-36 < z < 4.3999999999999999e48Initial program 78.3%
*-commutative78.3%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 78.4%
Final simplification73.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.1e-36) (not (<= z 4e+49))) (* z (/ (- x) y)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.1e-36) || !(z <= 4e+49)) {
tmp = z * (-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 ((z <= (-4.1d-36)) .or. (.not. (z <= 4d+49))) then
tmp = z * (-x / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.1e-36) || !(z <= 4e+49)) {
tmp = z * (-x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.1e-36) or not (z <= 4e+49): tmp = z * (-x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.1e-36) || !(z <= 4e+49)) tmp = Float64(z * Float64(Float64(-x) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.1e-36) || ~((z <= 4e+49))) tmp = z * (-x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.1e-36], N[Not[LessEqual[z, 4e+49]], $MachinePrecision]], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-36} \lor \neg \left(z \leq 4 \cdot 10^{+49}\right):\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.10000000000000013e-36 or 3.99999999999999979e49 < z Initial program 90.1%
*-commutative90.1%
associate-*l/91.5%
*-commutative91.5%
div-sub91.5%
*-inverses91.5%
Simplified91.5%
Taylor expanded in z around inf 73.7%
mul-1-neg73.7%
*-commutative73.7%
associate-*r/76.3%
distribute-lft-neg-out76.3%
Simplified76.3%
if -4.10000000000000013e-36 < z < 3.99999999999999979e49Initial program 78.3%
*-commutative78.3%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 78.4%
Final simplification77.3%
(FPCore (x y z) :precision binary64 (if (<= z -1.9e-36) (* z (/ (- x) y)) (if (<= z 4.5e+48) x (/ x (/ (- y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e-36) {
tmp = z * (-x / y);
} else if (z <= 4.5e+48) {
tmp = x;
} else {
tmp = x / (-y / z);
}
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.9d-36)) then
tmp = z * (-x / y)
else if (z <= 4.5d+48) then
tmp = x
else
tmp = x / (-y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e-36) {
tmp = z * (-x / y);
} else if (z <= 4.5e+48) {
tmp = x;
} else {
tmp = x / (-y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.9e-36: tmp = z * (-x / y) elif z <= 4.5e+48: tmp = x else: tmp = x / (-y / z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.9e-36) tmp = Float64(z * Float64(Float64(-x) / y)); elseif (z <= 4.5e+48) tmp = x; else tmp = Float64(x / Float64(Float64(-y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.9e-36) tmp = z * (-x / y); elseif (z <= 4.5e+48) tmp = x; else tmp = x / (-y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.9e-36], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+48], x, N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-36}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+48}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\end{array}
\end{array}
if z < -1.89999999999999985e-36Initial program 89.1%
*-commutative89.1%
associate-*l/87.8%
*-commutative87.8%
div-sub87.8%
*-inverses87.8%
Simplified87.8%
Taylor expanded in z around inf 71.5%
mul-1-neg71.5%
*-commutative71.5%
associate-*r/76.8%
distribute-lft-neg-out76.8%
Simplified76.8%
if -1.89999999999999985e-36 < z < 4.49999999999999995e48Initial program 78.3%
*-commutative78.3%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 78.4%
if 4.49999999999999995e48 < z Initial program 91.1%
associate-*l/89.0%
Simplified89.0%
associate-/r/96.7%
Applied egg-rr96.7%
Taylor expanded in y around 0 75.8%
neg-mul-175.8%
distribute-neg-frac75.8%
Simplified75.8%
Final simplification77.3%
(FPCore (x y z) :precision binary64 (if (<= z -2.85e-36) (* z (/ (- x) y)) (if (<= z 1.35e+51) x (/ (* z (- x)) y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.85e-36) {
tmp = z * (-x / y);
} else if (z <= 1.35e+51) {
tmp = x;
} 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 <= (-2.85d-36)) then
tmp = z * (-x / y)
else if (z <= 1.35d+51) then
tmp = x
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 <= -2.85e-36) {
tmp = z * (-x / y);
} else if (z <= 1.35e+51) {
tmp = x;
} else {
tmp = (z * -x) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.85e-36: tmp = z * (-x / y) elif z <= 1.35e+51: tmp = x else: tmp = (z * -x) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.85e-36) tmp = Float64(z * Float64(Float64(-x) / y)); elseif (z <= 1.35e+51) tmp = x; else tmp = Float64(Float64(z * Float64(-x)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.85e-36) tmp = z * (-x / y); elseif (z <= 1.35e+51) tmp = x; else tmp = (z * -x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.85e-36], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+51], x, N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.85 \cdot 10^{-36}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+51}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\end{array}
\end{array}
if z < -2.8499999999999999e-36Initial program 89.1%
*-commutative89.1%
associate-*l/87.8%
*-commutative87.8%
div-sub87.8%
*-inverses87.8%
Simplified87.8%
Taylor expanded in z around inf 71.5%
mul-1-neg71.5%
*-commutative71.5%
associate-*r/76.8%
distribute-lft-neg-out76.8%
Simplified76.8%
if -2.8499999999999999e-36 < z < 1.34999999999999996e51Initial program 78.3%
*-commutative78.3%
associate-*l/99.9%
*-commutative99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 78.4%
if 1.34999999999999996e51 < z Initial program 91.1%
Taylor expanded in y around 0 76.1%
mul-1-neg76.1%
distribute-rgt-neg-out76.1%
Simplified76.1%
Final simplification77.4%
(FPCore (x y z) :precision binary64 (if (<= z -2.9e+192) (* z (/ (- x) y)) (* x (- 1.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e+192) {
tmp = z * (-x / y);
} else {
tmp = x * (1.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
real(8) :: tmp
if (z <= (-2.9d+192)) then
tmp = z * (-x / y)
else
tmp = x * (1.0d0 - (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e+192) {
tmp = z * (-x / y);
} else {
tmp = x * (1.0 - (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.9e+192: tmp = z * (-x / y) else: tmp = x * (1.0 - (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.9e+192) tmp = Float64(z * Float64(Float64(-x) / y)); else tmp = Float64(x * Float64(1.0 - Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.9e+192) tmp = z * (-x / y); else tmp = x * (1.0 - (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.9e+192], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+192}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\end{array}
\end{array}
if z < -2.9000000000000001e192Initial program 85.6%
*-commutative85.6%
associate-*l/76.5%
*-commutative76.5%
div-sub76.5%
*-inverses76.5%
Simplified76.5%
Taylor expanded in z around inf 85.6%
mul-1-neg85.6%
*-commutative85.6%
associate-*r/99.9%
distribute-lft-neg-out99.9%
Simplified99.9%
if -2.9000000000000001e192 < z Initial program 84.4%
*-commutative84.4%
associate-*l/97.0%
*-commutative97.0%
div-sub97.0%
*-inverses97.0%
Simplified97.0%
Final simplification97.3%
(FPCore (x y z) :precision binary64 (if (<= z -4.4e+65) (* (/ x y) (- y z)) (* x (- 1.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.4e+65) {
tmp = (x / y) * (y - z);
} else {
tmp = x * (1.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
real(8) :: tmp
if (z <= (-4.4d+65)) then
tmp = (x / y) * (y - z)
else
tmp = x * (1.0d0 - (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.4e+65) {
tmp = (x / y) * (y - z);
} else {
tmp = x * (1.0 - (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.4e+65: tmp = (x / y) * (y - z) else: tmp = x * (1.0 - (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.4e+65) tmp = Float64(Float64(x / y) * Float64(y - z)); else tmp = Float64(x * Float64(1.0 - Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.4e+65) tmp = (x / y) * (y - z); else tmp = x * (1.0 - (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.4e+65], N[(N[(x / y), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+65}:\\
\;\;\;\;\frac{x}{y} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\end{array}
\end{array}
if z < -4.3999999999999997e65Initial program 89.9%
associate-*l/95.9%
Simplified95.9%
if -4.3999999999999997e65 < z Initial program 83.3%
*-commutative83.3%
associate-*l/98.5%
*-commutative98.5%
div-sub98.5%
*-inverses98.5%
Simplified98.5%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= x 6.5e+216) x (* y (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.5e+216) {
tmp = x;
} else {
tmp = y * (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 (x <= 6.5d+216) then
tmp = x
else
tmp = y * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 6.5e+216) {
tmp = x;
} else {
tmp = y * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 6.5e+216: tmp = x else: tmp = y * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 6.5e+216) tmp = x; else tmp = Float64(y * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 6.5e+216) tmp = x; else tmp = y * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 6.5e+216], x, N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+216}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < 6.50000000000000029e216Initial program 85.5%
*-commutative85.5%
associate-*l/95.0%
*-commutative95.0%
div-sub95.0%
*-inverses95.0%
Simplified95.0%
Taylor expanded in z around 0 50.9%
if 6.50000000000000029e216 < x Initial program 74.0%
Taylor expanded in y around inf 9.6%
associate-/l*31.4%
associate-/r/53.6%
Applied egg-rr53.6%
Final simplification51.1%
(FPCore (x y z) :precision binary64 (if (<= x 2.8e+178) x (/ y (/ y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2.8e+178) {
tmp = x;
} else {
tmp = y / (y / 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+178) then
tmp = x
else
tmp = y / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2.8e+178) {
tmp = x;
} else {
tmp = y / (y / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2.8e+178: tmp = x else: tmp = y / (y / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2.8e+178) tmp = x; else tmp = Float64(y / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2.8e+178) tmp = x; else tmp = y / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2.8e+178], x, N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{+178}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 2.79999999999999993e178Initial program 86.0%
*-commutative86.0%
associate-*l/94.9%
*-commutative94.9%
div-sub94.9%
*-inverses94.9%
Simplified94.9%
Taylor expanded in z around 0 50.2%
if 2.79999999999999993e178 < x Initial program 71.7%
Taylor expanded in y around inf 16.1%
associate-/l*41.0%
associate-/r/58.8%
Applied egg-rr58.8%
*-commutative58.8%
clear-num58.6%
div-inv58.8%
Applied egg-rr58.8%
Final simplification51.1%
(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 84.5%
*-commutative84.5%
associate-*l/95.4%
*-commutative95.4%
div-sub95.4%
*-inverses95.4%
Simplified95.4%
Taylor expanded in z around 0 49.3%
Final simplification49.3%
(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 2023332
(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))