
(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 (- x (* x (/ z y))))
double code(double x, double y, double z) {
return x - (x * (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 - (x * (z / y))
end function
public static double code(double x, double y, double z) {
return x - (x * (z / y));
}
def code(x, y, z): return x - (x * (z / y))
function code(x, y, z) return Float64(x - Float64(x * Float64(z / y))) end
function tmp = code(x, y, z) tmp = x - (x * (z / y)); end
code[x_, y_, z_] := N[(x - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - x \cdot \frac{z}{y}
\end{array}
Initial program 83.0%
associate-*l/87.5%
distribute-rgt-out--83.8%
associate-*r/79.7%
associate-*l/94.6%
*-inverses94.6%
*-lft-identity94.6%
Simplified94.6%
Taylor expanded in z around 0 96.2%
associate-/l*95.1%
associate-/r/97.7%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(if (or (<= z -8.7e-47)
(not (or (<= z 2.6e-14) (and (not (<= z 3.1e+15)) (<= z 1.35e+116)))))
(* (/ z y) (- x))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.7e-47) || !((z <= 2.6e-14) || (!(z <= 3.1e+15) && (z <= 1.35e+116)))) {
tmp = (z / y) * -x;
} 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 <= (-8.7d-47)) .or. (.not. (z <= 2.6d-14) .or. (.not. (z <= 3.1d+15)) .and. (z <= 1.35d+116))) then
tmp = (z / y) * -x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8.7e-47) || !((z <= 2.6e-14) || (!(z <= 3.1e+15) && (z <= 1.35e+116)))) {
tmp = (z / y) * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.7e-47) or not ((z <= 2.6e-14) or (not (z <= 3.1e+15) and (z <= 1.35e+116))): tmp = (z / y) * -x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.7e-47) || !((z <= 2.6e-14) || (!(z <= 3.1e+15) && (z <= 1.35e+116)))) tmp = Float64(Float64(z / y) * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.7e-47) || ~(((z <= 2.6e-14) || (~((z <= 3.1e+15)) && (z <= 1.35e+116))))) tmp = (z / y) * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.7e-47], N[Not[Or[LessEqual[z, 2.6e-14], And[N[Not[LessEqual[z, 3.1e+15]], $MachinePrecision], LessEqual[z, 1.35e+116]]]], $MachinePrecision]], N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.7 \cdot 10^{-47} \lor \neg \left(z \leq 2.6 \cdot 10^{-14} \lor \neg \left(z \leq 3.1 \cdot 10^{+15}\right) \land z \leq 1.35 \cdot 10^{+116}\right):\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.7000000000000001e-47 or 2.59999999999999997e-14 < z < 3.1e15 or 1.35e116 < z Initial program 92.3%
Taylor expanded in y around 0 81.7%
mul-1-neg81.7%
associate-*l/79.3%
*-commutative79.3%
distribute-rgt-neg-in79.3%
distribute-frac-neg79.3%
Simplified79.3%
if -8.7000000000000001e-47 < z < 2.59999999999999997e-14 or 3.1e15 < z < 1.35e116Initial program 74.2%
Taylor expanded in y around inf 81.2%
Final simplification80.3%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.35e-46)
(not (or (<= z 4.9e-15) (and (not (<= z 1.25e+15)) (<= z 1.6e+117)))))
(* z (/ (- x) y))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.35e-46) || !((z <= 4.9e-15) || (!(z <= 1.25e+15) && (z <= 1.6e+117)))) {
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 <= (-1.35d-46)) .or. (.not. (z <= 4.9d-15) .or. (.not. (z <= 1.25d+15)) .and. (z <= 1.6d+117))) 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 <= -1.35e-46) || !((z <= 4.9e-15) || (!(z <= 1.25e+15) && (z <= 1.6e+117)))) {
tmp = z * (-x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.35e-46) or not ((z <= 4.9e-15) or (not (z <= 1.25e+15) and (z <= 1.6e+117))): tmp = z * (-x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.35e-46) || !((z <= 4.9e-15) || (!(z <= 1.25e+15) && (z <= 1.6e+117)))) 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 <= -1.35e-46) || ~(((z <= 4.9e-15) || (~((z <= 1.25e+15)) && (z <= 1.6e+117))))) tmp = z * (-x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.35e-46], N[Not[Or[LessEqual[z, 4.9e-15], And[N[Not[LessEqual[z, 1.25e+15]], $MachinePrecision], LessEqual[z, 1.6e+117]]]], $MachinePrecision]], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-46} \lor \neg \left(z \leq 4.9 \cdot 10^{-15} \lor \neg \left(z \leq 1.25 \cdot 10^{+15}\right) \land z \leq 1.6 \cdot 10^{+117}\right):\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.35e-46 or 4.8999999999999999e-15 < z < 1.25e15 or 1.60000000000000002e117 < z Initial program 92.3%
Taylor expanded in y around 0 81.7%
mul-1-neg81.7%
associate-*r/81.2%
*-commutative81.2%
distribute-rgt-neg-in81.2%
Simplified81.2%
if -1.35e-46 < z < 4.8999999999999999e-15 or 1.25e15 < z < 1.60000000000000002e117Initial program 74.2%
Taylor expanded in y around inf 81.2%
Final simplification81.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (/ (- y) x))))
(if (<= z -1.45e-46)
t_0
(if (<= z 1.65e-14)
x
(if (<= z 1.6e+15) (* z (/ (- x) y)) (if (<= z 4.6e+116) x t_0))))))
double code(double x, double y, double z) {
double t_0 = z / (-y / x);
double tmp;
if (z <= -1.45e-46) {
tmp = t_0;
} else if (z <= 1.65e-14) {
tmp = x;
} else if (z <= 1.6e+15) {
tmp = z * (-x / y);
} else if (z <= 4.6e+116) {
tmp = x;
} else {
tmp = t_0;
}
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) :: tmp
t_0 = z / (-y / x)
if (z <= (-1.45d-46)) then
tmp = t_0
else if (z <= 1.65d-14) then
tmp = x
else if (z <= 1.6d+15) then
tmp = z * (-x / y)
else if (z <= 4.6d+116) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (-y / x);
double tmp;
if (z <= -1.45e-46) {
tmp = t_0;
} else if (z <= 1.65e-14) {
tmp = x;
} else if (z <= 1.6e+15) {
tmp = z * (-x / y);
} else if (z <= 4.6e+116) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z / (-y / x) tmp = 0 if z <= -1.45e-46: tmp = t_0 elif z <= 1.65e-14: tmp = x elif z <= 1.6e+15: tmp = z * (-x / y) elif z <= 4.6e+116: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z / Float64(Float64(-y) / x)) tmp = 0.0 if (z <= -1.45e-46) tmp = t_0; elseif (z <= 1.65e-14) tmp = x; elseif (z <= 1.6e+15) tmp = Float64(z * Float64(Float64(-x) / y)); elseif (z <= 4.6e+116) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (-y / x); tmp = 0.0; if (z <= -1.45e-46) tmp = t_0; elseif (z <= 1.65e-14) tmp = x; elseif (z <= 1.6e+15) tmp = z * (-x / y); elseif (z <= 4.6e+116) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[((-y) / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e-46], t$95$0, If[LessEqual[z, 1.65e-14], x, If[LessEqual[z, 1.6e+15], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+116], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{\frac{-y}{x}}\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{-46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+15}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.45000000000000002e-46 or 4.5999999999999999e116 < z Initial program 92.3%
Taylor expanded in y around 0 81.8%
mul-1-neg81.8%
associate-*l/78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
distribute-frac-neg78.7%
Simplified78.7%
*-commutative78.7%
associate-*l/81.8%
associate-*r/80.7%
add-sqr-sqrt46.1%
sqrt-unprod38.4%
sqr-neg38.4%
sqrt-unprod0.7%
add-sqr-sqrt1.5%
clear-num1.5%
div-inv1.5%
frac-2neg1.5%
add-sqr-sqrt0.8%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod34.3%
add-sqr-sqrt80.8%
Applied egg-rr80.8%
if -1.45000000000000002e-46 < z < 1.6499999999999999e-14 or 1.6e15 < z < 4.5999999999999999e116Initial program 74.2%
Taylor expanded in y around inf 81.2%
if 1.6499999999999999e-14 < z < 1.6e15Initial program 91.6%
Taylor expanded in y around 0 79.9%
mul-1-neg79.9%
associate-*r/88.0%
*-commutative88.0%
distribute-rgt-neg-in88.0%
Simplified88.0%
Final simplification81.3%
(FPCore (x y z)
:precision binary64
(if (<= z -1.45e-46)
(/ (* x (- z)) y)
(if (<= z 5.1e-16)
x
(if (<= z 21500000000000.0)
(* z (/ (- x) y))
(if (<= z 1.35e+116) x (/ z (/ (- y) x)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.45e-46) {
tmp = (x * -z) / y;
} else if (z <= 5.1e-16) {
tmp = x;
} else if (z <= 21500000000000.0) {
tmp = z * (-x / y);
} else if (z <= 1.35e+116) {
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 <= (-1.45d-46)) then
tmp = (x * -z) / y
else if (z <= 5.1d-16) then
tmp = x
else if (z <= 21500000000000.0d0) then
tmp = z * (-x / y)
else if (z <= 1.35d+116) 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 <= -1.45e-46) {
tmp = (x * -z) / y;
} else if (z <= 5.1e-16) {
tmp = x;
} else if (z <= 21500000000000.0) {
tmp = z * (-x / y);
} else if (z <= 1.35e+116) {
tmp = x;
} else {
tmp = z / (-y / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.45e-46: tmp = (x * -z) / y elif z <= 5.1e-16: tmp = x elif z <= 21500000000000.0: tmp = z * (-x / y) elif z <= 1.35e+116: tmp = x else: tmp = z / (-y / x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.45e-46) tmp = Float64(Float64(x * Float64(-z)) / y); elseif (z <= 5.1e-16) tmp = x; elseif (z <= 21500000000000.0) tmp = Float64(z * Float64(Float64(-x) / y)); elseif (z <= 1.35e+116) tmp = x; else tmp = Float64(z / Float64(Float64(-y) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.45e-46) tmp = (x * -z) / y; elseif (z <= 5.1e-16) tmp = x; elseif (z <= 21500000000000.0) tmp = z * (-x / y); elseif (z <= 1.35e+116) tmp = x; else tmp = z / (-y / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.45e-46], N[(N[(x * (-z)), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 5.1e-16], x, If[LessEqual[z, 21500000000000.0], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+116], x, N[(z / N[((-y) / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-46}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{y}\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 21500000000000:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{-y}{x}}\\
\end{array}
\end{array}
if z < -1.45000000000000002e-46Initial program 95.3%
Taylor expanded in y around 0 86.3%
associate-*r/86.3%
neg-mul-186.3%
distribute-rgt-neg-in86.3%
Simplified86.3%
if -1.45000000000000002e-46 < z < 5.1e-16 or 2.15e13 < z < 1.35e116Initial program 74.2%
Taylor expanded in y around inf 81.2%
if 5.1e-16 < z < 2.15e13Initial program 91.6%
Taylor expanded in y around 0 79.9%
mul-1-neg79.9%
associate-*r/88.0%
*-commutative88.0%
distribute-rgt-neg-in88.0%
Simplified88.0%
if 1.35e116 < z Initial program 88.6%
Taylor expanded in y around 0 76.1%
mul-1-neg76.1%
associate-*l/74.5%
*-commutative74.5%
distribute-rgt-neg-in74.5%
distribute-frac-neg74.5%
Simplified74.5%
*-commutative74.5%
associate-*l/76.1%
associate-*r/78.2%
add-sqr-sqrt0.0%
sqrt-unprod0.9%
sqr-neg0.9%
sqrt-unprod1.6%
add-sqr-sqrt1.6%
clear-num1.6%
div-inv1.6%
frac-2neg1.6%
add-sqr-sqrt0.0%
sqrt-unprod41.4%
sqr-neg41.4%
sqrt-unprod77.9%
add-sqr-sqrt78.2%
Applied egg-rr78.2%
Final simplification82.1%
(FPCore (x y z) :precision binary64 (if (<= x 6.1e+184) x (* y (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.1e+184) {
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.1d+184) 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.1e+184) {
tmp = x;
} else {
tmp = y * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 6.1e+184: tmp = x else: tmp = y * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 6.1e+184) 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.1e+184) tmp = x; else tmp = y * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 6.1e+184], x, N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.1 \cdot 10^{+184}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < 6.10000000000000009e184Initial program 83.9%
Taylor expanded in y around inf 50.1%
if 6.10000000000000009e184 < x Initial program 73.8%
Taylor expanded in y around inf 29.6%
associate-/l*76.1%
div-inv77.3%
clear-num77.5%
Applied egg-rr77.5%
Final simplification52.8%
(FPCore (x y z) :precision binary64 (- x (* z (/ x y))))
double code(double x, double y, double z) {
return x - (z * (x / 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 - (z * (x / y))
end function
public static double code(double x, double y, double z) {
return x - (z * (x / y));
}
def code(x, y, z): return x - (z * (x / y))
function code(x, y, z) return Float64(x - Float64(z * Float64(x / y))) end
function tmp = code(x, y, z) tmp = x - (z * (x / y)); end
code[x_, y_, z_] := N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - z \cdot \frac{x}{y}
\end{array}
Initial program 83.0%
associate-*l/87.5%
distribute-rgt-out--83.8%
associate-*r/79.7%
associate-*l/94.6%
*-inverses94.6%
*-lft-identity94.6%
Simplified94.6%
Final simplification94.6%
(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.0%
Taylor expanded in y around inf 50.7%
Final simplification50.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 2023238
(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))