
(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 -5e+24) (- x (* z (/ x y))) (- x (/ x (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5e+24) {
tmp = x - (z * (x / y));
} else {
tmp = x - (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 <= (-5d+24)) then
tmp = x - (z * (x / y))
else
tmp = x - (x / (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5e+24) {
tmp = x - (z * (x / y));
} else {
tmp = x - (x / (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5e+24: tmp = x - (z * (x / y)) else: tmp = x - (x / (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5e+24) tmp = Float64(x - Float64(z * Float64(x / y))); else tmp = Float64(x - Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e+24) tmp = x - (z * (x / y)); else tmp = x - (x / (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5e+24], N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+24}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if z < -5.00000000000000045e24Initial program 90.9%
associate-*l/92.3%
distribute-rgt-out--82.7%
associate-*r/90.3%
associate-*l/97.8%
*-inverses97.8%
*-lft-identity97.8%
Simplified97.8%
if -5.00000000000000045e24 < z Initial program 86.2%
associate-*l/85.5%
distribute-rgt-out--81.8%
associate-*r/82.0%
associate-*l/94.1%
*-inverses94.1%
*-lft-identity94.1%
Simplified94.1%
Taylor expanded in z around 0 96.9%
*-commutative96.9%
associate-/l*98.9%
Simplified98.9%
Final simplification98.6%
(FPCore (x y z)
:precision binary64
(if (<= y -3.5e-43)
x
(if (or (<= y 1.35e+61) (and (not (<= y 8.5e+92)) (<= y 7e+108)))
(* z (/ (- x) y))
x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e-43) {
tmp = x;
} else if ((y <= 1.35e+61) || (!(y <= 8.5e+92) && (y <= 7e+108))) {
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 (y <= (-3.5d-43)) then
tmp = x
else if ((y <= 1.35d+61) .or. (.not. (y <= 8.5d+92)) .and. (y <= 7d+108)) 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 (y <= -3.5e-43) {
tmp = x;
} else if ((y <= 1.35e+61) || (!(y <= 8.5e+92) && (y <= 7e+108))) {
tmp = z * (-x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.5e-43: tmp = x elif (y <= 1.35e+61) or (not (y <= 8.5e+92) and (y <= 7e+108)): tmp = z * (-x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.5e-43) tmp = x; elseif ((y <= 1.35e+61) || (!(y <= 8.5e+92) && (y <= 7e+108))) 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 (y <= -3.5e-43) tmp = x; elseif ((y <= 1.35e+61) || (~((y <= 8.5e+92)) && (y <= 7e+108))) tmp = z * (-x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.5e-43], x, If[Or[LessEqual[y, 1.35e+61], And[N[Not[LessEqual[y, 8.5e+92]], $MachinePrecision], LessEqual[y, 7e+108]]], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-43}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+61} \lor \neg \left(y \leq 8.5 \cdot 10^{+92}\right) \land y \leq 7 \cdot 10^{+108}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.49999999999999997e-43 or 1.3500000000000001e61 < y < 8.5000000000000001e92 or 7.0000000000000005e108 < y Initial program 77.9%
associate-*l/76.8%
distribute-rgt-out--76.7%
associate-*r/73.5%
associate-*l/94.7%
*-inverses94.7%
*-lft-identity94.7%
Simplified94.7%
Taylor expanded in z around 0 80.3%
if -3.49999999999999997e-43 < y < 1.3500000000000001e61 or 8.5000000000000001e92 < y < 7.0000000000000005e108Initial program 94.6%
associate-*l/95.1%
distribute-rgt-out--86.1%
associate-*r/92.0%
associate-*l/95.1%
*-inverses95.1%
*-lft-identity95.1%
Simplified95.1%
Taylor expanded in z around 0 97.2%
*-commutative97.2%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in y around 0 81.3%
mul-1-neg81.3%
associate-*r/80.2%
distribute-rgt-neg-in80.2%
distribute-frac-neg80.2%
Simplified80.2%
Final simplification80.2%
(FPCore (x y z)
:precision binary64
(if (<= y -3.9e-44)
x
(if (<= y 2.65e+62)
(/ (- z) (/ y x))
(if (<= y 1.2e+93) x (if (<= y 7e+108) (* z (/ (- x) y)) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.9e-44) {
tmp = x;
} else if (y <= 2.65e+62) {
tmp = -z / (y / x);
} else if (y <= 1.2e+93) {
tmp = x;
} else if (y <= 7e+108) {
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 (y <= (-3.9d-44)) then
tmp = x
else if (y <= 2.65d+62) then
tmp = -z / (y / x)
else if (y <= 1.2d+93) then
tmp = x
else if (y <= 7d+108) 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 (y <= -3.9e-44) {
tmp = x;
} else if (y <= 2.65e+62) {
tmp = -z / (y / x);
} else if (y <= 1.2e+93) {
tmp = x;
} else if (y <= 7e+108) {
tmp = z * (-x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.9e-44: tmp = x elif y <= 2.65e+62: tmp = -z / (y / x) elif y <= 1.2e+93: tmp = x elif y <= 7e+108: tmp = z * (-x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.9e-44) tmp = x; elseif (y <= 2.65e+62) tmp = Float64(Float64(-z) / Float64(y / x)); elseif (y <= 1.2e+93) tmp = x; elseif (y <= 7e+108) 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 (y <= -3.9e-44) tmp = x; elseif (y <= 2.65e+62) tmp = -z / (y / x); elseif (y <= 1.2e+93) tmp = x; elseif (y <= 7e+108) tmp = z * (-x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.9e-44], x, If[LessEqual[y, 2.65e+62], N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+93], x, If[LessEqual[y, 7e+108], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{+62}:\\
\;\;\;\;\frac{-z}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+93}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+108}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.9000000000000002e-44 or 2.6500000000000001e62 < y < 1.20000000000000005e93 or 7.0000000000000005e108 < y Initial program 77.9%
associate-*l/76.8%
distribute-rgt-out--76.7%
associate-*r/73.5%
associate-*l/94.7%
*-inverses94.7%
*-lft-identity94.7%
Simplified94.7%
Taylor expanded in z around 0 80.3%
if -3.9000000000000002e-44 < y < 2.6500000000000001e62Initial program 94.4%
associate-*l/94.9%
distribute-rgt-out--85.6%
associate-*r/91.8%
associate-*l/95.0%
*-inverses95.0%
*-lft-identity95.0%
Simplified95.0%
Taylor expanded in z around inf 80.7%
mul-1-neg80.7%
associate-*l/74.8%
distribute-rgt-neg-in74.8%
Simplified74.8%
distribute-rgt-neg-out74.8%
associate-/r/79.5%
distribute-neg-frac79.5%
Applied egg-rr79.5%
if 1.20000000000000005e93 < y < 7.0000000000000005e108Initial program 99.7%
associate-*l/100.0%
distribute-rgt-out--100.0%
associate-*r/100.0%
associate-*l/100.0%
*-inverses100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 99.7%
*-commutative99.7%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in y around 0 99.7%
mul-1-neg99.7%
associate-*r/100.0%
distribute-rgt-neg-in100.0%
distribute-frac-neg100.0%
Simplified100.0%
Final simplification80.2%
(FPCore (x y z)
:precision binary64
(if (<= y -1.15e-40)
x
(if (<= y 5.5e+60)
(/ (* z (- x)) y)
(if (<= y 1.22e+93) x (if (<= y 7e+108) (* z (/ (- x) y)) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e-40) {
tmp = x;
} else if (y <= 5.5e+60) {
tmp = (z * -x) / y;
} else if (y <= 1.22e+93) {
tmp = x;
} else if (y <= 7e+108) {
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 (y <= (-1.15d-40)) then
tmp = x
else if (y <= 5.5d+60) then
tmp = (z * -x) / y
else if (y <= 1.22d+93) then
tmp = x
else if (y <= 7d+108) 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 (y <= -1.15e-40) {
tmp = x;
} else if (y <= 5.5e+60) {
tmp = (z * -x) / y;
} else if (y <= 1.22e+93) {
tmp = x;
} else if (y <= 7e+108) {
tmp = z * (-x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e-40: tmp = x elif y <= 5.5e+60: tmp = (z * -x) / y elif y <= 1.22e+93: tmp = x elif y <= 7e+108: tmp = z * (-x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e-40) tmp = x; elseif (y <= 5.5e+60) tmp = Float64(Float64(z * Float64(-x)) / y); elseif (y <= 1.22e+93) tmp = x; elseif (y <= 7e+108) 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 (y <= -1.15e-40) tmp = x; elseif (y <= 5.5e+60) tmp = (z * -x) / y; elseif (y <= 1.22e+93) tmp = x; elseif (y <= 7e+108) tmp = z * (-x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e-40], x, If[LessEqual[y, 5.5e+60], N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.22e+93], x, If[LessEqual[y, 7e+108], N[(z * N[((-x) / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+60}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{+93}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+108}:\\
\;\;\;\;z \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.15e-40 or 5.5000000000000001e60 < y < 1.21999999999999995e93 or 7.0000000000000005e108 < y Initial program 77.9%
associate-*l/76.8%
distribute-rgt-out--76.7%
associate-*r/73.5%
associate-*l/94.7%
*-inverses94.7%
*-lft-identity94.7%
Simplified94.7%
Taylor expanded in z around 0 80.3%
if -1.15e-40 < y < 5.5000000000000001e60Initial program 94.4%
associate-*l/94.9%
distribute-rgt-out--85.6%
associate-*r/91.8%
associate-*l/95.0%
*-inverses95.0%
*-lft-identity95.0%
Simplified95.0%
Taylor expanded in z around inf 80.7%
associate-*r/80.7%
neg-mul-180.7%
distribute-rgt-neg-in80.7%
Simplified80.7%
if 1.21999999999999995e93 < y < 7.0000000000000005e108Initial program 99.7%
associate-*l/100.0%
distribute-rgt-out--100.0%
associate-*r/100.0%
associate-*l/100.0%
*-inverses100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 99.7%
*-commutative99.7%
associate-/l*99.4%
Simplified99.4%
Taylor expanded in y around 0 99.7%
mul-1-neg99.7%
associate-*r/100.0%
distribute-rgt-neg-in100.0%
distribute-frac-neg100.0%
Simplified100.0%
Final simplification80.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.75e+189) (not (<= x 1.05e+52))) (* y (/ x y)) x))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.75e+189) || !(x <= 1.05e+52)) {
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 <= (-1.75d+189)) .or. (.not. (x <= 1.05d+52))) 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 <= -1.75e+189) || !(x <= 1.05e+52)) {
tmp = y * (x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.75e+189) or not (x <= 1.05e+52): tmp = y * (x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.75e+189) || !(x <= 1.05e+52)) 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 <= -1.75e+189) || ~((x <= 1.05e+52))) tmp = y * (x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.75e+189], N[Not[LessEqual[x, 1.05e+52]], $MachinePrecision]], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+189} \lor \neg \left(x \leq 1.05 \cdot 10^{+52}\right):\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.74999999999999998e189 or 1.05e52 < x Initial program 74.7%
Taylor expanded in y around inf 19.5%
associate-/l*56.8%
div-inv56.6%
clear-num56.7%
Applied egg-rr56.7%
if -1.74999999999999998e189 < x < 1.05e52Initial program 92.1%
associate-*l/85.4%
distribute-rgt-out--84.8%
associate-*r/90.1%
associate-*l/96.1%
*-inverses96.1%
*-lft-identity96.1%
Simplified96.1%
Taylor expanded in z around 0 46.1%
Final simplification49.0%
(FPCore (x y z) :precision binary64 (if (<= y -9.8e-114) x (if (<= y 1e+61) (/ y (/ y x)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e-114) {
tmp = x;
} else if (y <= 1e+61) {
tmp = y / (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 (y <= (-9.8d-114)) then
tmp = x
else if (y <= 1d+61) then
tmp = y / (y / x)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e-114) {
tmp = x;
} else if (y <= 1e+61) {
tmp = y / (y / x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.8e-114: tmp = x elif y <= 1e+61: tmp = y / (y / x) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.8e-114) tmp = x; elseif (y <= 1e+61) tmp = Float64(y / Float64(y / x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.8e-114) tmp = x; elseif (y <= 1e+61) tmp = y / (y / x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.8e-114], x, If[LessEqual[y, 1e+61], N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-114}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 10^{+61}:\\
\;\;\;\;\frac{y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.7999999999999994e-114 or 9.99999999999999949e60 < y Initial program 81.0%
associate-*l/80.0%
distribute-rgt-out--79.9%
associate-*r/77.2%
associate-*l/95.4%
*-inverses95.4%
*-lft-identity95.4%
Simplified95.4%
Taylor expanded in z around 0 72.6%
if -9.7999999999999994e-114 < y < 9.99999999999999949e60Initial program 93.8%
Taylor expanded in y around inf 13.3%
associate-/l*25.4%
div-inv25.0%
clear-num25.1%
Applied egg-rr25.1%
clear-num25.0%
un-div-inv25.4%
Applied egg-rr25.4%
Final simplification49.2%
(FPCore (x y z) :precision binary64 (if (<= z 5.5e+170) (- x (* z (/ x y))) (/ x (/ (- y) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 5.5e+170) {
tmp = x - (z * (x / y));
} 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 <= 5.5d+170) then
tmp = x - (z * (x / y))
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 <= 5.5e+170) {
tmp = x - (z * (x / y));
} else {
tmp = x / (-y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 5.5e+170: tmp = x - (z * (x / y)) else: tmp = x / (-y / z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 5.5e+170) tmp = Float64(x - Float64(z * Float64(x / y))); else tmp = Float64(x / Float64(Float64(-y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 5.5e+170) tmp = x - (z * (x / y)); else tmp = x / (-y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 5.5e+170], N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.5 \cdot 10^{+170}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\end{array}
\end{array}
if z < 5.4999999999999999e170Initial program 86.2%
associate-*l/87.5%
distribute-rgt-out--83.0%
associate-*r/84.4%
associate-*l/96.3%
*-inverses96.3%
*-lft-identity96.3%
Simplified96.3%
if 5.4999999999999999e170 < z Initial program 96.6%
associate-*l/84.5%
distribute-rgt-out--74.2%
associate-*r/81.1%
associate-*l/84.5%
*-inverses84.5%
*-lft-identity84.5%
Simplified84.5%
Taylor expanded in z around inf 95.6%
mul-1-neg95.6%
associate-*l/98.7%
distribute-rgt-neg-in98.7%
Simplified98.7%
add-sqr-sqrt48.0%
sqrt-unprod32.2%
sqr-neg32.2%
sqrt-unprod0.5%
clear-num0.5%
add-sqr-sqrt0.9%
associate-/r/0.9%
frac-2neg0.9%
clear-num0.9%
add-sqr-sqrt0.4%
sqrt-unprod35.9%
sqr-neg35.9%
sqrt-unprod50.4%
add-sqr-sqrt98.8%
distribute-neg-frac98.8%
Applied egg-rr98.8%
Final simplification96.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 87.4%
associate-*l/87.2%
distribute-rgt-out--82.0%
associate-*r/84.0%
associate-*l/95.0%
*-inverses95.0%
*-lft-identity95.0%
Simplified95.0%
Taylor expanded in z around 0 44.7%
Final simplification44.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 2023229
(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))