
(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(Float64(x * z) / y)) end
function tmp = code(x, y, z) tmp = x - ((x * z) / y); end
code[x_, y_, z_] := N[(x - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{x \cdot z}{y}
\end{array}
Initial program 88.5%
associate-*r/96.6%
Simplified96.6%
Taylor expanded in y around 0 96.9%
Taylor expanded in x around 0 96.6%
mul-1-neg96.6%
unsub-neg96.6%
distribute-lft-out--96.6%
*-rgt-identity96.6%
Simplified96.6%
Taylor expanded in x around 0 96.9%
Final simplification96.9%
(FPCore (x y z)
:precision binary64
(if (<= y -4.4e-122)
x
(if (<= y 5.8e-23)
(* z (- (/ x y)))
(if (<= y 2.5e+16)
x
(if (or (<= y 2.1e+44) (and (not (<= y 3.1e+150)) (<= y 1.55e+170)))
(* (/ z y) (- x))
x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e-122) {
tmp = x;
} else if (y <= 5.8e-23) {
tmp = z * -(x / y);
} else if (y <= 2.5e+16) {
tmp = x;
} else if ((y <= 2.1e+44) || (!(y <= 3.1e+150) && (y <= 1.55e+170))) {
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 (y <= (-4.4d-122)) then
tmp = x
else if (y <= 5.8d-23) then
tmp = z * -(x / y)
else if (y <= 2.5d+16) then
tmp = x
else if ((y <= 2.1d+44) .or. (.not. (y <= 3.1d+150)) .and. (y <= 1.55d+170)) 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 (y <= -4.4e-122) {
tmp = x;
} else if (y <= 5.8e-23) {
tmp = z * -(x / y);
} else if (y <= 2.5e+16) {
tmp = x;
} else if ((y <= 2.1e+44) || (!(y <= 3.1e+150) && (y <= 1.55e+170))) {
tmp = (z / y) * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e-122: tmp = x elif y <= 5.8e-23: tmp = z * -(x / y) elif y <= 2.5e+16: tmp = x elif (y <= 2.1e+44) or (not (y <= 3.1e+150) and (y <= 1.55e+170)): tmp = (z / y) * -x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e-122) tmp = x; elseif (y <= 5.8e-23) tmp = Float64(z * Float64(-Float64(x / y))); elseif (y <= 2.5e+16) tmp = x; elseif ((y <= 2.1e+44) || (!(y <= 3.1e+150) && (y <= 1.55e+170))) 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 (y <= -4.4e-122) tmp = x; elseif (y <= 5.8e-23) tmp = z * -(x / y); elseif (y <= 2.5e+16) tmp = x; elseif ((y <= 2.1e+44) || (~((y <= 3.1e+150)) && (y <= 1.55e+170))) tmp = (z / y) * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e-122], x, If[LessEqual[y, 5.8e-23], N[(z * (-N[(x / y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 2.5e+16], x, If[Or[LessEqual[y, 2.1e+44], And[N[Not[LessEqual[y, 3.1e+150]], $MachinePrecision], LessEqual[y, 1.55e+170]]], N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-23}:\\
\;\;\;\;z \cdot \left(-\frac{x}{y}\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+44} \lor \neg \left(y \leq 3.1 \cdot 10^{+150}\right) \land y \leq 1.55 \cdot 10^{+170}:\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.4e-122 or 5.8000000000000003e-23 < y < 2.5e16 or 2.09999999999999987e44 < y < 3.10000000000000014e150 or 1.55e170 < y Initial program 79.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if -4.4e-122 < y < 5.8000000000000003e-23Initial program 97.9%
associate-*r/91.6%
Simplified91.6%
Taylor expanded in y around 0 86.4%
associate-*l/81.9%
neg-mul-181.9%
distribute-rgt-neg-out81.9%
Simplified81.9%
if 2.5e16 < y < 2.09999999999999987e44 or 3.10000000000000014e150 < y < 1.55e170Initial program 99.7%
associate-*r/99.7%
Simplified99.7%
Taylor expanded in y around 0 80.6%
mul-1-neg80.6%
*-commutative80.6%
associate-/l*52.4%
associate-/r/80.5%
distribute-rgt-neg-in80.5%
Simplified80.5%
Final simplification82.1%
(FPCore (x y z)
:precision binary64
(if (<= y -4.4e-122)
x
(if (<= y 4.5e-22)
(* z (- (/ x y)))
(if (<= y 1.9e+16)
x
(if (<= y 2.8e+45)
(* (/ z y) (- x))
(if (<= y 3.1e+150) x (if (<= y 1.55e+170) (/ x (/ (- y) z)) x)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e-122) {
tmp = x;
} else if (y <= 4.5e-22) {
tmp = z * -(x / y);
} else if (y <= 1.9e+16) {
tmp = x;
} else if (y <= 2.8e+45) {
tmp = (z / y) * -x;
} else if (y <= 3.1e+150) {
tmp = x;
} else if (y <= 1.55e+170) {
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 (y <= (-4.4d-122)) then
tmp = x
else if (y <= 4.5d-22) then
tmp = z * -(x / y)
else if (y <= 1.9d+16) then
tmp = x
else if (y <= 2.8d+45) then
tmp = (z / y) * -x
else if (y <= 3.1d+150) then
tmp = x
else if (y <= 1.55d+170) 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 (y <= -4.4e-122) {
tmp = x;
} else if (y <= 4.5e-22) {
tmp = z * -(x / y);
} else if (y <= 1.9e+16) {
tmp = x;
} else if (y <= 2.8e+45) {
tmp = (z / y) * -x;
} else if (y <= 3.1e+150) {
tmp = x;
} else if (y <= 1.55e+170) {
tmp = x / (-y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e-122: tmp = x elif y <= 4.5e-22: tmp = z * -(x / y) elif y <= 1.9e+16: tmp = x elif y <= 2.8e+45: tmp = (z / y) * -x elif y <= 3.1e+150: tmp = x elif y <= 1.55e+170: tmp = x / (-y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e-122) tmp = x; elseif (y <= 4.5e-22) tmp = Float64(z * Float64(-Float64(x / y))); elseif (y <= 1.9e+16) tmp = x; elseif (y <= 2.8e+45) tmp = Float64(Float64(z / y) * Float64(-x)); elseif (y <= 3.1e+150) tmp = x; elseif (y <= 1.55e+170) 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 (y <= -4.4e-122) tmp = x; elseif (y <= 4.5e-22) tmp = z * -(x / y); elseif (y <= 1.9e+16) tmp = x; elseif (y <= 2.8e+45) tmp = (z / y) * -x; elseif (y <= 3.1e+150) tmp = x; elseif (y <= 1.55e+170) tmp = x / (-y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e-122], x, If[LessEqual[y, 4.5e-22], N[(z * (-N[(x / y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 1.9e+16], x, If[LessEqual[y, 2.8e+45], N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[y, 3.1e+150], x, If[LessEqual[y, 1.55e+170], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-22}:\\
\;\;\;\;z \cdot \left(-\frac{x}{y}\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+45}:\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+150}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+170}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.4e-122 or 4.49999999999999987e-22 < y < 1.9e16 or 2.7999999999999999e45 < y < 3.10000000000000014e150 or 1.55e170 < y Initial program 79.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if -4.4e-122 < y < 4.49999999999999987e-22Initial program 97.9%
associate-*r/91.6%
Simplified91.6%
Taylor expanded in y around 0 86.4%
associate-*l/81.9%
neg-mul-181.9%
distribute-rgt-neg-out81.9%
Simplified81.9%
if 1.9e16 < y < 2.7999999999999999e45Initial program 99.7%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 81.5%
mul-1-neg81.5%
*-commutative81.5%
associate-/l*71.8%
associate-/r/81.7%
distribute-rgt-neg-in81.7%
Simplified81.7%
if 3.10000000000000014e150 < y < 1.55e170Initial program 99.8%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in y around 0 79.5%
associate-*l/28.2%
neg-mul-128.2%
distribute-rgt-neg-out28.2%
Simplified28.2%
add-sqr-sqrt14.4%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod2.1%
add-sqr-sqrt4.3%
associate-/r/3.4%
frac-2neg3.4%
add-sqr-sqrt1.0%
sqrt-unprod28.0%
sqr-neg28.0%
sqrt-unprod54.1%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
Final simplification82.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (- z)) y)))
(if (<= y -4e-122)
x
(if (<= y 3.5e-22)
t_0
(if (<= y 8.4e+15)
x
(if (<= y 2.9e+41)
(* (/ z y) (- x))
(if (<= y 3.1e+150) x (if (<= y 1.55e+170) t_0 x))))))))
double code(double x, double y, double z) {
double t_0 = (x * -z) / y;
double tmp;
if (y <= -4e-122) {
tmp = x;
} else if (y <= 3.5e-22) {
tmp = t_0;
} else if (y <= 8.4e+15) {
tmp = x;
} else if (y <= 2.9e+41) {
tmp = (z / y) * -x;
} else if (y <= 3.1e+150) {
tmp = x;
} else if (y <= 1.55e+170) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (x * -z) / y
if (y <= (-4d-122)) then
tmp = x
else if (y <= 3.5d-22) then
tmp = t_0
else if (y <= 8.4d+15) then
tmp = x
else if (y <= 2.9d+41) then
tmp = (z / y) * -x
else if (y <= 3.1d+150) then
tmp = x
else if (y <= 1.55d+170) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x * -z) / y;
double tmp;
if (y <= -4e-122) {
tmp = x;
} else if (y <= 3.5e-22) {
tmp = t_0;
} else if (y <= 8.4e+15) {
tmp = x;
} else if (y <= 2.9e+41) {
tmp = (z / y) * -x;
} else if (y <= 3.1e+150) {
tmp = x;
} else if (y <= 1.55e+170) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = (x * -z) / y tmp = 0 if y <= -4e-122: tmp = x elif y <= 3.5e-22: tmp = t_0 elif y <= 8.4e+15: tmp = x elif y <= 2.9e+41: tmp = (z / y) * -x elif y <= 3.1e+150: tmp = x elif y <= 1.55e+170: tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(Float64(x * Float64(-z)) / y) tmp = 0.0 if (y <= -4e-122) tmp = x; elseif (y <= 3.5e-22) tmp = t_0; elseif (y <= 8.4e+15) tmp = x; elseif (y <= 2.9e+41) tmp = Float64(Float64(z / y) * Float64(-x)); elseif (y <= 3.1e+150) tmp = x; elseif (y <= 1.55e+170) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * -z) / y; tmp = 0.0; if (y <= -4e-122) tmp = x; elseif (y <= 3.5e-22) tmp = t_0; elseif (y <= 8.4e+15) tmp = x; elseif (y <= 2.9e+41) tmp = (z / y) * -x; elseif (y <= 3.1e+150) tmp = x; elseif (y <= 1.55e+170) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * (-z)), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -4e-122], x, If[LessEqual[y, 3.5e-22], t$95$0, If[LessEqual[y, 8.4e+15], x, If[LessEqual[y, 2.9e+41], N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[y, 3.1e+150], x, If[LessEqual[y, 1.55e+170], t$95$0, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(-z\right)}{y}\\
\mathbf{if}\;y \leq -4 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-22}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+15}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+41}:\\
\;\;\;\;\frac{z}{y} \cdot \left(-x\right)\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+150}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+170}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.00000000000000024e-122 or 3.50000000000000005e-22 < y < 8.4e15 or 2.89999999999999988e41 < y < 3.10000000000000014e150 or 1.55e170 < y Initial program 79.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if -4.00000000000000024e-122 < y < 3.50000000000000005e-22 or 3.10000000000000014e150 < y < 1.55e170Initial program 98.1%
Taylor expanded in y around 0 85.9%
mul-1-neg85.9%
distribute-rgt-neg-out85.9%
Simplified85.9%
if 8.4e15 < y < 2.89999999999999988e41Initial program 99.7%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 81.5%
mul-1-neg81.5%
*-commutative81.5%
associate-/l*71.8%
associate-/r/81.7%
distribute-rgt-neg-in81.7%
Simplified81.7%
Final simplification83.8%
(FPCore (x y z)
:precision binary64
(if (<= y -4.4e-122)
x
(if (or (<= y 1.9e-21) (and (not (<= y 4e+15)) (<= y 4.4e+41)))
(* z (- (/ x y)))
x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e-122) {
tmp = x;
} else if ((y <= 1.9e-21) || (!(y <= 4e+15) && (y <= 4.4e+41))) {
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 <= (-4.4d-122)) then
tmp = x
else if ((y <= 1.9d-21) .or. (.not. (y <= 4d+15)) .and. (y <= 4.4d+41)) 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 <= -4.4e-122) {
tmp = x;
} else if ((y <= 1.9e-21) || (!(y <= 4e+15) && (y <= 4.4e+41))) {
tmp = z * -(x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e-122: tmp = x elif (y <= 1.9e-21) or (not (y <= 4e+15) and (y <= 4.4e+41)): tmp = z * -(x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e-122) tmp = x; elseif ((y <= 1.9e-21) || (!(y <= 4e+15) && (y <= 4.4e+41))) 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 <= -4.4e-122) tmp = x; elseif ((y <= 1.9e-21) || (~((y <= 4e+15)) && (y <= 4.4e+41))) tmp = z * -(x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e-122], x, If[Or[LessEqual[y, 1.9e-21], And[N[Not[LessEqual[y, 4e+15]], $MachinePrecision], LessEqual[y, 4.4e+41]]], N[(z * (-N[(x / y), $MachinePrecision])), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-21} \lor \neg \left(y \leq 4 \cdot 10^{+15}\right) \land y \leq 4.4 \cdot 10^{+41}:\\
\;\;\;\;z \cdot \left(-\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.4e-122 or 1.8999999999999999e-21 < y < 4e15 or 4.3999999999999998e41 < y Initial program 81.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around inf 78.8%
if -4.4e-122 < y < 1.8999999999999999e-21 or 4e15 < y < 4.3999999999999998e41Initial program 98.1%
associate-*r/92.3%
Simplified92.3%
Taylor expanded in y around 0 85.9%
associate-*l/81.6%
neg-mul-181.6%
distribute-rgt-neg-out81.6%
Simplified81.6%
Final simplification80.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.55e-129) x (if (<= y 2.55e-203) (* y (/ x y)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.55e-129) {
tmp = x;
} else if (y <= 2.55e-203) {
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 <= (-1.55d-129)) then
tmp = x
else if (y <= 2.55d-203) 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 <= -1.55e-129) {
tmp = x;
} else if (y <= 2.55e-203) {
tmp = y * (x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.55e-129: tmp = x elif y <= 2.55e-203: tmp = y * (x / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.55e-129) tmp = x; elseif (y <= 2.55e-203) 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 <= -1.55e-129) tmp = x; elseif (y <= 2.55e-203) tmp = y * (x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.55e-129], x, If[LessEqual[y, 2.55e-203], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{-129}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{-203}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.55e-129 or 2.54999999999999992e-203 < y Initial program 85.0%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in y around inf 66.8%
if -1.55e-129 < y < 2.54999999999999992e-203Initial program 97.2%
Taylor expanded in y around inf 11.4%
associate-/l*11.4%
associate-/r/29.2%
Applied egg-rr29.2%
Final simplification56.0%
(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(x * Float64(Float64(y - z) / y)) end
function tmp = code(x, y, z) tmp = x * ((y - z) / y); end
code[x_, y_, z_] := N[(x * N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{y}
\end{array}
Initial program 88.5%
associate-*r/96.6%
Simplified96.6%
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 88.5%
associate-*r/96.6%
Simplified96.6%
Taylor expanded in y around inf 51.0%
Final simplification51.0%
(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 2023318
(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))