
(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 (<= y -1e+21) (* x (- 1.0 (/ z y))) (if (<= y 3.2e-167) (/ (- y z) (/ y x)) (/ x (/ y (- y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1e+21) {
tmp = x * (1.0 - (z / y));
} else if (y <= 3.2e-167) {
tmp = (y - z) / (y / x);
} 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 (y <= (-1d+21)) then
tmp = x * (1.0d0 - (z / y))
else if (y <= 3.2d-167) then
tmp = (y - z) / (y / x)
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 (y <= -1e+21) {
tmp = x * (1.0 - (z / y));
} else if (y <= 3.2e-167) {
tmp = (y - z) / (y / x);
} else {
tmp = x / (y / (y - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1e+21: tmp = x * (1.0 - (z / y)) elif y <= 3.2e-167: tmp = (y - z) / (y / x) else: tmp = x / (y / (y - z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1e+21) tmp = Float64(x * Float64(1.0 - Float64(z / y))); elseif (y <= 3.2e-167) tmp = Float64(Float64(y - z) / Float64(y / x)); else tmp = Float64(x / Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1e+21) tmp = x * (1.0 - (z / y)); elseif (y <= 3.2e-167) tmp = (y - z) / (y / x); else tmp = x / (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1e+21], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e-167], N[(N[(y - z), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+21}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-167}:\\
\;\;\;\;\frac{y - z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\end{array}
\end{array}
if y < -1e21Initial program 74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-frac-neg74.4%
distribute-rgt-neg-in74.4%
associate-/l*100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
if -1e21 < y < 3.2000000000000002e-167Initial program 92.3%
clear-num92.2%
inv-pow92.2%
Applied egg-rr92.2%
unpow-192.2%
associate-/r*97.1%
associate-/r/96.4%
associate-*l/97.2%
*-un-lft-identity97.2%
Applied egg-rr97.2%
if 3.2000000000000002e-167 < y Initial program 80.1%
associate-/l*99.8%
add-sqr-sqrt49.6%
associate-*l*49.6%
Applied egg-rr49.6%
associate-*r*49.6%
add-sqr-sqrt99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2e-27) (not (<= y 1.3e-169))) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2e-27) || !(y <= 1.3e-169)) {
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 ((y <= (-2d-27)) .or. (.not. (y <= 1.3d-169))) 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 ((y <= -2e-27) || !(y <= 1.3e-169)) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2e-27) or not (y <= 1.3e-169): tmp = x / (y / (y - z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2e-27) || !(y <= 1.3e-169)) 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 ((y <= -2e-27) || ~((y <= 1.3e-169))) tmp = x / (y / (y - z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2e-27], N[Not[LessEqual[y, 1.3e-169]], $MachinePrecision]], 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}\;y \leq -2 \cdot 10^{-27} \lor \neg \left(y \leq 1.3 \cdot 10^{-169}\right):\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.0000000000000001e-27 or 1.30000000000000007e-169 < y Initial program 79.1%
associate-/l*99.9%
add-sqr-sqrt50.7%
associate-*l*50.7%
Applied egg-rr50.7%
associate-*r*50.7%
add-sqr-sqrt99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -2.0000000000000001e-27 < y < 1.30000000000000007e-169Initial program 91.3%
*-commutative91.3%
associate-/l*96.1%
Applied egg-rr96.1%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -2e+29) (not (<= y 1.6e-167))) (* x (- 1.0 (/ z y))) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2e+29) || !(y <= 1.6e-167)) {
tmp = x * (1.0 - (z / y));
} 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 ((y <= (-2d+29)) .or. (.not. (y <= 1.6d-167))) then
tmp = x * (1.0d0 - (z / y))
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 ((y <= -2e+29) || !(y <= 1.6e-167)) {
tmp = x * (1.0 - (z / y));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2e+29) or not (y <= 1.6e-167): tmp = x * (1.0 - (z / y)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2e+29) || !(y <= 1.6e-167)) tmp = Float64(x * Float64(1.0 - Float64(z / y))); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2e+29) || ~((y <= 1.6e-167))) tmp = x * (1.0 - (z / y)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2e+29], N[Not[LessEqual[y, 1.6e-167]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+29} \lor \neg \left(y \leq 1.6 \cdot 10^{-167}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -1.99999999999999983e29 or 1.6000000000000001e-167 < y Initial program 77.9%
remove-double-neg77.9%
distribute-frac-neg277.9%
distribute-frac-neg77.9%
distribute-rgt-neg-in77.9%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
if -1.99999999999999983e29 < y < 1.6000000000000001e-167Initial program 92.3%
*-commutative92.3%
associate-/l*96.5%
Applied egg-rr96.5%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= y -6.8e+31) x (if (<= y 7.8e-14) (/ z (/ y (- x))) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.8e+31) {
tmp = x;
} else if (y <= 7.8e-14) {
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 <= (-6.8d+31)) then
tmp = x
else if (y <= 7.8d-14) 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 <= -6.8e+31) {
tmp = x;
} else if (y <= 7.8e-14) {
tmp = z / (y / -x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.8e+31: tmp = x elif y <= 7.8e-14: tmp = z / (y / -x) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.8e+31) tmp = x; elseif (y <= 7.8e-14) tmp = Float64(z / Float64(y / Float64(-x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.8e+31) tmp = x; elseif (y <= 7.8e-14) tmp = z / (y / -x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.8e+31], x, If[LessEqual[y, 7.8e-14], N[(z / N[(y / (-x)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-14}:\\
\;\;\;\;\frac{z}{\frac{y}{-x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.7999999999999996e31 or 7.7999999999999996e-14 < y Initial program 75.6%
remove-double-neg75.6%
distribute-frac-neg275.6%
distribute-frac-neg75.6%
distribute-rgt-neg-in75.6%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 79.6%
if -6.7999999999999996e31 < y < 7.7999999999999996e-14Initial program 92.0%
clear-num92.0%
inv-pow92.0%
Applied egg-rr92.0%
unpow-192.0%
associate-/r*95.3%
associate-/r/94.7%
associate-*l/95.3%
*-un-lft-identity95.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 78.6%
neg-mul-178.6%
Simplified78.6%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.2e+32) x (if (<= y 7.5e-20) (* z (/ x (- y))) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+32) {
tmp = x;
} else if (y <= 7.5e-20) {
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.2d+32)) then
tmp = x
else if (y <= 7.5d-20) 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.2e+32) {
tmp = x;
} else if (y <= 7.5e-20) {
tmp = z * (x / -y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.2e+32: tmp = x elif y <= 7.5e-20: tmp = z * (x / -y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.2e+32) tmp = x; elseif (y <= 7.5e-20) tmp = Float64(z * Float64(x / Float64(-y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.2e+32) tmp = x; elseif (y <= 7.5e-20) tmp = z * (x / -y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.2e+32], x, If[LessEqual[y, 7.5e-20], N[(z * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-20}:\\
\;\;\;\;z \cdot \frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.19999999999999996e32 or 7.49999999999999981e-20 < y Initial program 75.6%
remove-double-neg75.6%
distribute-frac-neg275.6%
distribute-frac-neg75.6%
distribute-rgt-neg-in75.6%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 79.6%
if -1.19999999999999996e32 < y < 7.49999999999999981e-20Initial program 92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-frac-neg92.0%
distribute-rgt-neg-in92.0%
associate-/l*88.0%
distribute-frac-neg88.0%
distribute-frac-neg288.0%
remove-double-neg88.0%
div-sub88.0%
*-inverses88.0%
Simplified88.0%
Taylor expanded in z around inf 75.4%
mul-1-neg75.4%
distribute-frac-neg275.4%
*-commutative75.4%
associate-/l*78.1%
Simplified78.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.25e+32) x (if (<= y 1.4e-12) (* x (/ z (- y))) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e+32) {
tmp = x;
} else if (y <= 1.4e-12) {
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 (y <= (-1.25d+32)) then
tmp = x
else if (y <= 1.4d-12) 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 (y <= -1.25e+32) {
tmp = x;
} else if (y <= 1.4e-12) {
tmp = x * (z / -y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.25e+32: tmp = x elif y <= 1.4e-12: tmp = x * (z / -y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.25e+32) tmp = x; elseif (y <= 1.4e-12) tmp = Float64(x * Float64(z / Float64(-y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.25e+32) tmp = x; elseif (y <= 1.4e-12) tmp = x * (z / -y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.25e+32], x, If[LessEqual[y, 1.4e-12], N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{z}{-y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.2499999999999999e32 or 1.4000000000000001e-12 < y Initial program 75.6%
remove-double-neg75.6%
distribute-frac-neg275.6%
distribute-frac-neg75.6%
distribute-rgt-neg-in75.6%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 79.6%
if -1.2499999999999999e32 < y < 1.4000000000000001e-12Initial program 92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-frac-neg92.0%
distribute-rgt-neg-in92.0%
associate-/l*88.0%
distribute-frac-neg88.0%
distribute-frac-neg288.0%
remove-double-neg88.0%
div-sub88.0%
*-inverses88.0%
Simplified88.0%
Taylor expanded in z around inf 75.4%
mul-1-neg75.4%
distribute-frac-neg275.4%
associate-*r/67.9%
Simplified67.9%
(FPCore (x y z) :precision binary64 (if (<= x 5e-9) (- x (/ (* x z) y)) (/ x (/ y (- y z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5e-9) {
tmp = x - ((x * z) / y);
} 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 (x <= 5d-9) then
tmp = x - ((x * z) / y)
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 (x <= 5e-9) {
tmp = x - ((x * z) / y);
} else {
tmp = x / (y / (y - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 5e-9: tmp = x - ((x * z) / y) else: tmp = x / (y / (y - z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 5e-9) tmp = Float64(x - Float64(Float64(x * z) / y)); else tmp = Float64(x / Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5e-9) tmp = x - ((x * z) / y); else tmp = x / (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 5e-9], N[(x - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\end{array}
\end{array}
if x < 5.0000000000000001e-9Initial program 86.5%
remove-double-neg86.5%
distribute-frac-neg286.5%
distribute-frac-neg86.5%
distribute-rgt-neg-in86.5%
associate-/l*93.2%
distribute-frac-neg93.2%
distribute-frac-neg293.2%
remove-double-neg93.2%
div-sub93.2%
*-inverses93.2%
Simplified93.2%
Taylor expanded in z around 0 94.1%
associate-*r/94.1%
associate-*r*94.1%
mul-1-neg94.1%
Simplified94.1%
if 5.0000000000000001e-9 < x Initial program 69.8%
associate-/l*99.9%
add-sqr-sqrt99.5%
associate-*l*99.5%
Applied egg-rr99.5%
associate-*r*99.5%
add-sqr-sqrt99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification95.4%
(FPCore (x y z) :precision binary64 (* x (- 1.0 (/ z y))))
double code(double x, double y, double z) {
return x * (1.0 - (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 * (1.0d0 - (z / y))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (z / y));
}
def code(x, y, z): return x * (1.0 - (z / y))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(z / y))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (z / y)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{y}\right)
\end{array}
Initial program 82.6%
remove-double-neg82.6%
distribute-frac-neg282.6%
distribute-frac-neg82.6%
distribute-rgt-neg-in82.6%
associate-/l*94.8%
distribute-frac-neg94.8%
distribute-frac-neg294.8%
remove-double-neg94.8%
div-sub94.8%
*-inverses94.8%
Simplified94.8%
(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 82.6%
remove-double-neg82.6%
distribute-frac-neg282.6%
distribute-frac-neg82.6%
distribute-rgt-neg-in82.6%
associate-/l*94.8%
distribute-frac-neg94.8%
distribute-frac-neg294.8%
remove-double-neg94.8%
div-sub94.8%
*-inverses94.8%
Simplified94.8%
Taylor expanded in z around 0 54.9%
(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 2024179
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -206020233192173900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- x (/ (* z x) y)) (if (< z 1693976601382852600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ x (/ y (- y z))) (* (- y z) (/ x y)))))
(/ (* x (- y z)) y))