
(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 9 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 8.1e+96) (/ x (/ y (- y z))) (/ (* x (- y z)) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= 8.1e+96) {
tmp = x / (y / (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 <= 8.1d+96) then
tmp = x / (y / (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 <= 8.1e+96) {
tmp = x / (y / (y - z));
} else {
tmp = (x * (y - z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 8.1e+96: tmp = x / (y / (y - z)) else: tmp = (x * (y - z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 8.1e+96) tmp = Float64(x / Float64(y / 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 <= 8.1e+96) tmp = x / (y / (y - z)); else tmp = (x * (y - z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 8.1e+96], N[(x / N[(y / 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 8.1 \cdot 10^{+96}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\end{array}
\end{array}
if z < 8.1000000000000002e96Initial program 85.5%
associate-*l/84.0%
Simplified84.0%
associate-/r/99.3%
Applied egg-rr99.3%
if 8.1000000000000002e96 < z Initial program 97.6%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e-30) (not (<= z 2.6e+103))) (* (- x) (/ z y)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e-30) || !(z <= 2.6e+103)) {
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 <= (-4.2d-30)) .or. (.not. (z <= 2.6d+103))) 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 <= -4.2e-30) || !(z <= 2.6e+103)) {
tmp = -x * (z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e-30) or not (z <= 2.6e+103): tmp = -x * (z / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e-30) || !(z <= 2.6e+103)) tmp = Float64(Float64(-x) * Float64(z / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.2e-30) || ~((z <= 2.6e+103))) tmp = -x * (z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e-30], N[Not[LessEqual[z, 2.6e+103]], $MachinePrecision]], N[((-x) * N[(z / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-30} \lor \neg \left(z \leq 2.6 \cdot 10^{+103}\right):\\
\;\;\;\;\left(-x\right) \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.2000000000000004e-30 or 2.6000000000000002e103 < z Initial program 90.8%
*-commutative90.8%
associate-*l/92.5%
*-commutative92.5%
div-sub92.5%
*-inverses92.5%
Simplified92.5%
Taylor expanded in z around inf 78.0%
*-commutative78.0%
associate-/l*75.0%
associate-/r/74.3%
associate-*l*74.3%
*-commutative74.3%
associate-*l*74.3%
neg-mul-174.3%
Simplified74.3%
if -4.2000000000000004e-30 < z < 2.6000000000000002e103Initial program 85.3%
*-commutative85.3%
associate-*l/99.3%
*-commutative99.3%
div-sub99.3%
*-inverses99.3%
Simplified99.3%
Taylor expanded in z around 0 75.2%
Final simplification74.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.4e-30) (not (<= z 2.6e+103))) (/ x (/ (- y) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.4e-30) || !(z <= 2.6e+103)) {
tmp = x / (-y / z);
} 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.4d-30)) .or. (.not. (z <= 2.6d+103))) then
tmp = x / (-y / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.4e-30) || !(z <= 2.6e+103)) {
tmp = x / (-y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.4e-30) or not (z <= 2.6e+103): tmp = x / (-y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.4e-30) || !(z <= 2.6e+103)) tmp = Float64(x / Float64(Float64(-y) / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.4e-30) || ~((z <= 2.6e+103))) tmp = x / (-y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.4e-30], N[Not[LessEqual[z, 2.6e+103]], $MachinePrecision]], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-30} \lor \neg \left(z \leq 2.6 \cdot 10^{+103}\right):\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.39999999999999967e-30 or 2.6000000000000002e103 < z Initial program 90.8%
associate-*l/86.7%
Simplified86.7%
associate-/r/93.5%
Applied egg-rr93.5%
Taylor expanded in y around 0 75.2%
neg-mul-175.2%
distribute-neg-frac75.2%
Simplified75.2%
if -4.39999999999999967e-30 < z < 2.6000000000000002e103Initial program 85.3%
*-commutative85.3%
associate-*l/99.3%
*-commutative99.3%
div-sub99.3%
*-inverses99.3%
Simplified99.3%
Taylor expanded in z around 0 75.2%
Final simplification75.2%
(FPCore (x y z) :precision binary64 (if (<= z -4.1e-30) (/ x (/ (- y) z)) (if (<= z 2.6e+103) x (/ (- z) (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e-30) {
tmp = x / (-y / z);
} else if (z <= 2.6e+103) {
tmp = x;
} else {
tmp = -z / (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 (z <= (-4.1d-30)) then
tmp = x / (-y / z)
else if (z <= 2.6d+103) then
tmp = x
else
tmp = -z / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e-30) {
tmp = x / (-y / z);
} else if (z <= 2.6e+103) {
tmp = x;
} else {
tmp = -z / (y / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.1e-30: tmp = x / (-y / z) elif z <= 2.6e+103: tmp = x else: tmp = -z / (y / x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.1e-30) tmp = Float64(x / Float64(Float64(-y) / z)); elseif (z <= 2.6e+103) tmp = x; else tmp = Float64(Float64(-z) / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.1e-30) tmp = x / (-y / z); elseif (z <= 2.6e+103) tmp = x; else tmp = -z / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.1e-30], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+103], x, N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+103}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -4.1000000000000003e-30Initial program 86.7%
associate-*l/86.3%
Simplified86.3%
associate-/r/98.3%
Applied egg-rr98.3%
Taylor expanded in y around 0 71.7%
neg-mul-171.7%
distribute-neg-frac71.7%
Simplified71.7%
if -4.1000000000000003e-30 < z < 2.6000000000000002e103Initial program 85.3%
*-commutative85.3%
associate-*l/99.3%
*-commutative99.3%
div-sub99.3%
*-inverses99.3%
Simplified99.3%
Taylor expanded in z around 0 75.2%
if 2.6000000000000002e103 < z Initial program 97.4%
*-commutative97.4%
associate-*l/83.1%
*-commutative83.1%
div-sub83.1%
*-inverses83.1%
Simplified83.1%
Taylor expanded in z around inf 95.1%
*-commutative95.1%
associate-/l*82.7%
associate-/r/78.4%
associate-*l*78.4%
*-commutative78.4%
associate-*l*78.4%
neg-mul-178.4%
Simplified78.4%
associate-*l/95.1%
*-un-lft-identity95.1%
times-frac85.0%
add-sqr-sqrt51.2%
sqrt-unprod39.7%
sqr-neg39.7%
sqrt-unprod0.4%
add-sqr-sqrt1.1%
*-un-lft-identity1.1%
*-commutative1.1%
metadata-eval1.1%
div-inv1.1%
associate-/r*1.1%
*-un-lft-identity1.1%
associate-/r/1.1%
clear-num1.1%
frac-2neg1.1%
div-inv1.1%
distribute-lft-neg-in1.1%
*-inverses1.1%
associate-/r*1.3%
*-commutative1.3%
clear-num1.3%
*-commutative1.3%
associate-/l*1.1%
associate-/r/1.1%
*-inverses1.1%
*-un-lft-identity1.1%
add-sqr-sqrt0.4%
sqrt-unprod39.8%
sqr-neg39.8%
Applied egg-rr82.7%
Final simplification75.5%
(FPCore (x y z) :precision binary64 (if (<= z -4.4e-30) (/ x (/ (- y) z)) (if (<= z 3.25e+103) x (/ (* z (- x)) y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.4e-30) {
tmp = x / (-y / z);
} else if (z <= 3.25e+103) {
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 <= (-4.4d-30)) then
tmp = x / (-y / z)
else if (z <= 3.25d+103) 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 <= -4.4e-30) {
tmp = x / (-y / z);
} else if (z <= 3.25e+103) {
tmp = x;
} else {
tmp = (z * -x) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.4e-30: tmp = x / (-y / z) elif z <= 3.25e+103: tmp = x else: tmp = (z * -x) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.4e-30) tmp = Float64(x / Float64(Float64(-y) / z)); elseif (z <= 3.25e+103) 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 <= -4.4e-30) tmp = x / (-y / z); elseif (z <= 3.25e+103) tmp = x; else tmp = (z * -x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.4e-30], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.25e+103], x, N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{elif}\;z \leq 3.25 \cdot 10^{+103}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\end{array}
\end{array}
if z < -4.39999999999999967e-30Initial program 86.7%
associate-*l/86.3%
Simplified86.3%
associate-/r/98.3%
Applied egg-rr98.3%
Taylor expanded in y around 0 71.7%
neg-mul-171.7%
distribute-neg-frac71.7%
Simplified71.7%
if -4.39999999999999967e-30 < z < 3.25000000000000001e103Initial program 85.3%
*-commutative85.3%
associate-*l/99.3%
*-commutative99.3%
div-sub99.3%
*-inverses99.3%
Simplified99.3%
Taylor expanded in z around 0 75.2%
if 3.25000000000000001e103 < z Initial program 97.4%
Taylor expanded in y around 0 95.1%
associate-*r*95.1%
neg-mul-195.1%
Simplified95.1%
Final simplification77.4%
(FPCore (x y z) :precision binary64 (if (<= y -2.6e-143) x (if (<= y 1.8e-74) (* y (/ x y)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.6e-143) {
tmp = x;
} else if (y <= 1.8e-74) {
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 (y <= (-2.6d-143)) then
tmp = x
else if (y <= 1.8d-74) 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 (y <= -2.6e-143) {
tmp = x;
} else if (y <= 1.8e-74) {
tmp = y * (x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.6e-143: tmp = x elif y <= 1.8e-74: tmp = y * (x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.6e-143) tmp = x; elseif (y <= 1.8e-74) tmp = Float64(y * Float64(x / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.6e-143) tmp = x; elseif (y <= 1.8e-74) tmp = y * (x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.6e-143], x, If[LessEqual[y, 1.8e-74], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-143}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-74}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.59999999999999987e-143 or 1.8000000000000001e-74 < y Initial program 84.3%
*-commutative84.3%
associate-*l/99.3%
*-commutative99.3%
div-sub99.3%
*-inverses99.3%
Simplified99.3%
Taylor expanded in z around 0 71.7%
if -2.59999999999999987e-143 < y < 1.8000000000000001e-74Initial program 93.5%
Taylor expanded in y around inf 15.8%
associate-/l*19.8%
associate-/r/29.8%
Applied egg-rr29.8%
Final simplification57.2%
(FPCore (x y z) :precision binary64 (if (<= z 7.5e+106) (* x (- 1.0 (/ z y))) (/ (* z (- x)) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= 7.5e+106) {
tmp = x * (1.0 - (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 <= 7.5d+106) then
tmp = x * (1.0d0 - (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 <= 7.5e+106) {
tmp = x * (1.0 - (z / y));
} else {
tmp = (z * -x) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 7.5e+106: tmp = x * (1.0 - (z / y)) else: tmp = (z * -x) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 7.5e+106) tmp = Float64(x * Float64(1.0 - Float64(z / y))); else tmp = Float64(Float64(z * Float64(-x)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 7.5e+106) tmp = x * (1.0 - (z / y)); else tmp = (z * -x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 7.5e+106], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.5 \cdot 10^{+106}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\end{array}
\end{array}
if z < 7.50000000000000058e106Initial program 85.7%
*-commutative85.7%
associate-*l/99.0%
*-commutative99.0%
div-sub99.0%
*-inverses99.0%
Simplified99.0%
if 7.50000000000000058e106 < z Initial program 97.4%
Taylor expanded in y around 0 95.1%
associate-*r*95.1%
neg-mul-195.1%
Simplified95.1%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= z 6.8e+193) (/ x (/ y (- y z))) (/ (* z (- x)) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= 6.8e+193) {
tmp = x / (y / (y - z));
} 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 <= 6.8d+193) then
tmp = x / (y / (y - z))
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 <= 6.8e+193) {
tmp = x / (y / (y - z));
} else {
tmp = (z * -x) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 6.8e+193: tmp = x / (y / (y - z)) else: tmp = (z * -x) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 6.8e+193) tmp = Float64(x / Float64(y / Float64(y - z))); else tmp = Float64(Float64(z * Float64(-x)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 6.8e+193) tmp = x / (y / (y - z)); else tmp = (z * -x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 6.8e+193], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.8 \cdot 10^{+193}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\end{array}
\end{array}
if z < 6.79999999999999972e193Initial program 86.1%
associate-*l/83.5%
Simplified83.5%
associate-/r/98.9%
Applied egg-rr98.9%
if 6.79999999999999972e193 < z Initial program 99.9%
Taylor expanded in y around 0 99.8%
associate-*r*99.8%
neg-mul-199.8%
Simplified99.8%
Final simplification99.0%
(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 87.5%
*-commutative87.5%
associate-*l/96.6%
*-commutative96.6%
div-sub96.6%
*-inverses96.6%
Simplified96.6%
Taylor expanded in z around 0 53.7%
Final simplification53.7%
(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 2024018
(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))