\[x + \frac{y - x}{z}
\]
↓
\[x + \frac{y - x}{z}
\]
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
↓
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
return x + ((y - x) / z);
}
↓
double code(double x, double y, double z) {
return x + ((y - x) / z);
}
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 - x) / z)
end function
↓
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 - x) / z)
end function
public static double code(double x, double y, double z) {
return x + ((y - x) / z);
}
↓
public static double code(double x, double y, double z) {
return x + ((y - x) / z);
}
def code(x, y, z):
return x + ((y - x) / z)
↓
def code(x, y, z):
return x + ((y - x) / z)
function code(x, y, z)
return Float64(x + Float64(Float64(y - x) / z))
end
↓
function code(x, y, z)
return Float64(x + Float64(Float64(y - x) / z))
end
function tmp = code(x, y, z)
tmp = x + ((y - x) / z);
end
↓
function tmp = code(x, y, z)
tmp = x + ((y - x) / z);
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
x + \frac{y - x}{z}
↓
x + \frac{y - x}{z}
Alternatives
| Alternative 1 |
|---|
| Error | 24.2 |
|---|
| Cost | 916 |
|---|
\[\begin{array}{l}
t_0 := \frac{-x}{z}\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-56}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-114}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.95 \cdot 10^{-301}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 12.2 |
|---|
| Cost | 850 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-56} \lor \neg \left(z \leq -2.5 \cdot 10^{-115}\right) \land \left(z \leq 4.5 \cdot 10^{-299} \lor \neg \left(z \leq 0.09\right)\right):\\
\;\;\;\;x + \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 9.6 |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.26 \cdot 10^{+51} \lor \neg \left(x \leq 9.5 \cdot 10^{-114}\right):\\
\;\;\;\;x - \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.9 |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x + \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{z}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 23.8 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 35.3 |
|---|
| Cost | 64 |
|---|
\[x
\]