
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((z - x) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 92.2%
associate-*l/96.8%
Simplified96.8%
*-commutative96.8%
clear-num96.7%
un-div-inv96.9%
Applied egg-rr96.9%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.1e-215) (not (<= t -6.8e-242))) (+ x (* z (/ y t))) (/ (* x y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e-215) || !(t <= -6.8e-242)) {
tmp = x + (z * (y / t));
} else {
tmp = (x * y) / -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-4.1d-215)) .or. (.not. (t <= (-6.8d-242)))) then
tmp = x + (z * (y / t))
else
tmp = (x * y) / -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e-215) || !(t <= -6.8e-242)) {
tmp = x + (z * (y / t));
} else {
tmp = (x * y) / -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.1e-215) or not (t <= -6.8e-242): tmp = x + (z * (y / t)) else: tmp = (x * y) / -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.1e-215) || !(t <= -6.8e-242)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(Float64(x * y) / Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.1e-215) || ~((t <= -6.8e-242))) tmp = x + (z * (y / t)); else tmp = (x * y) / -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.1e-215], N[Not[LessEqual[t, -6.8e-242]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{-215} \lor \neg \left(t \leq -6.8 \cdot 10^{-242}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{-t}\\
\end{array}
\end{array}
if t < -4.09999999999999985e-215 or -6.8000000000000001e-242 < t Initial program 92.0%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 76.9%
associate-*l/79.0%
*-commutative79.0%
Simplified79.0%
if -4.09999999999999985e-215 < t < -6.8000000000000001e-242Initial program 99.8%
associate-*l/88.4%
Simplified88.4%
Taylor expanded in x around inf 88.4%
distribute-lft-in88.4%
*-rgt-identity88.4%
mul-1-neg88.4%
distribute-rgt-neg-in88.4%
unsub-neg88.4%
Simplified88.4%
Taylor expanded in y around inf 99.8%
associate-*r/88.4%
*-commutative88.4%
associate-*r*88.4%
neg-mul-188.4%
distribute-neg-frac88.4%
Simplified88.4%
associate-*l/99.8%
frac-2neg99.8%
add-sqr-sqrt62.3%
sqrt-unprod50.7%
sqr-neg50.7%
sqrt-unprod0.3%
add-sqr-sqrt0.3%
distribute-lft-neg-in0.3%
add-sqr-sqrt0.0%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod37.1%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.8e-70) (not (<= z 1.25e-61))) (+ x (* z (/ y t))) (- x (* x (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.8e-70) || !(z <= 1.25e-61)) {
tmp = x + (z * (y / t));
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.8d-70)) .or. (.not. (z <= 1.25d-61))) then
tmp = x + (z * (y / t))
else
tmp = x - (x * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.8e-70) || !(z <= 1.25e-61)) {
tmp = x + (z * (y / t));
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.8e-70) or not (z <= 1.25e-61): tmp = x + (z * (y / t)) else: tmp = x - (x * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.8e-70) || !(z <= 1.25e-61)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x - Float64(x * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.8e-70) || ~((z <= 1.25e-61))) tmp = x + (z * (y / t)); else tmp = x - (x * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.8e-70], N[Not[LessEqual[z, 1.25e-61]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-70} \lor \neg \left(z \leq 1.25 \cdot 10^{-61}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -3.7999999999999998e-70 or 1.25e-61 < z Initial program 89.8%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in z around inf 83.8%
associate-*l/86.2%
*-commutative86.2%
Simplified86.2%
if -3.7999999999999998e-70 < z < 1.25e-61Initial program 95.5%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 92.5%
distribute-lft-in92.5%
*-rgt-identity92.5%
mul-1-neg92.5%
distribute-rgt-neg-in92.5%
unsub-neg92.5%
Simplified92.5%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (<= t -3.75e-215) (+ x (/ y (/ t z))) (if (<= t -2.9e-243) (/ (* x y) (- t)) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.75e-215) {
tmp = x + (y / (t / z));
} else if (t <= -2.9e-243) {
tmp = (x * y) / -t;
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-3.75d-215)) then
tmp = x + (y / (t / z))
else if (t <= (-2.9d-243)) then
tmp = (x * y) / -t
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.75e-215) {
tmp = x + (y / (t / z));
} else if (t <= -2.9e-243) {
tmp = (x * y) / -t;
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.75e-215: tmp = x + (y / (t / z)) elif t <= -2.9e-243: tmp = (x * y) / -t else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.75e-215) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (t <= -2.9e-243) tmp = Float64(Float64(x * y) / Float64(-t)); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.75e-215) tmp = x + (y / (t / z)); elseif (t <= -2.9e-243) tmp = (x * y) / -t; else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.75e-215], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.9e-243], N[(N[(x * y), $MachinePrecision] / (-t)), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.75 \cdot 10^{-215}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{-243}:\\
\;\;\;\;\frac{x \cdot y}{-t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -3.74999999999999993e-215Initial program 92.1%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in z around inf 80.4%
if -3.74999999999999993e-215 < t < -2.89999999999999977e-243Initial program 99.8%
associate-*l/88.4%
Simplified88.4%
Taylor expanded in x around inf 88.4%
distribute-lft-in88.4%
*-rgt-identity88.4%
mul-1-neg88.4%
distribute-rgt-neg-in88.4%
unsub-neg88.4%
Simplified88.4%
Taylor expanded in y around inf 99.8%
associate-*r/88.4%
*-commutative88.4%
associate-*r*88.4%
neg-mul-188.4%
distribute-neg-frac88.4%
Simplified88.4%
associate-*l/99.8%
frac-2neg99.8%
add-sqr-sqrt62.3%
sqrt-unprod50.7%
sqr-neg50.7%
sqrt-unprod0.3%
add-sqr-sqrt0.3%
distribute-lft-neg-in0.3%
add-sqr-sqrt0.0%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod37.1%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
if -2.89999999999999977e-243 < t Initial program 91.9%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 74.5%
associate-*l/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.55e+54) (not (<= y 1.75e+19))) (* y (/ (- x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.55e+54) || !(y <= 1.75e+19)) {
tmp = y * (-x / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.55d+54)) .or. (.not. (y <= 1.75d+19))) then
tmp = y * (-x / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.55e+54) || !(y <= 1.75e+19)) {
tmp = y * (-x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.55e+54) or not (y <= 1.75e+19): tmp = y * (-x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.55e+54) || !(y <= 1.75e+19)) tmp = Float64(y * Float64(Float64(-x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.55e+54) || ~((y <= 1.75e+19))) tmp = y * (-x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.55e+54], N[Not[LessEqual[y, 1.75e+19]], $MachinePrecision]], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+54} \lor \neg \left(y \leq 1.75 \cdot 10^{+19}\right):\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.55e54 or 1.75e19 < y Initial program 85.0%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 58.5%
distribute-lft-in58.5%
*-rgt-identity58.5%
mul-1-neg58.5%
distribute-rgt-neg-in58.5%
unsub-neg58.5%
Simplified58.5%
*-commutative58.5%
add-sqr-sqrt29.2%
sqrt-unprod38.4%
sqr-neg38.4%
sqrt-unprod12.1%
add-sqr-sqrt23.2%
associate-/r/20.1%
add-sqr-sqrt9.7%
sqrt-unprod39.2%
sqr-neg39.2%
sqrt-unprod28.4%
add-sqr-sqrt57.7%
Applied egg-rr57.7%
Taylor expanded in y around inf 45.3%
mul-1-neg45.3%
associate-*l/45.1%
distribute-lft-neg-out45.1%
*-commutative45.1%
distribute-neg-frac45.1%
Simplified45.1%
if -1.55e54 < y < 1.75e19Initial program 97.9%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in y around 0 61.6%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.8e+55) (not (<= y 1.6e+20))) (* x (/ (- y) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.8e+55) || !(y <= 1.6e+20)) {
tmp = x * (-y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-2.8d+55)) .or. (.not. (y <= 1.6d+20))) then
tmp = x * (-y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.8e+55) || !(y <= 1.6e+20)) {
tmp = x * (-y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.8e+55) or not (y <= 1.6e+20): tmp = x * (-y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.8e+55) || !(y <= 1.6e+20)) tmp = Float64(x * Float64(Float64(-y) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.8e+55) || ~((y <= 1.6e+20))) tmp = x * (-y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.8e+55], N[Not[LessEqual[y, 1.6e+20]], $MachinePrecision]], N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+55} \lor \neg \left(y \leq 1.6 \cdot 10^{+20}\right):\\
\;\;\;\;x \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.8000000000000001e55 or 1.6e20 < y Initial program 85.0%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 58.5%
distribute-lft-in58.5%
*-rgt-identity58.5%
mul-1-neg58.5%
distribute-rgt-neg-in58.5%
unsub-neg58.5%
Simplified58.5%
Taylor expanded in y around inf 45.3%
associate-*r/46.0%
*-commutative46.0%
associate-*r*46.0%
neg-mul-146.0%
distribute-neg-frac46.0%
Simplified46.0%
if -2.8000000000000001e55 < y < 1.6e20Initial program 97.9%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in y around 0 61.6%
Final simplification54.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.4e+52) (not (<= y 2.3e+22))) (/ (- x) (/ t y)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e+52) || !(y <= 2.3e+22)) {
tmp = -x / (t / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-2.4d+52)) .or. (.not. (y <= 2.3d+22))) then
tmp = -x / (t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e+52) || !(y <= 2.3e+22)) {
tmp = -x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.4e+52) or not (y <= 2.3e+22): tmp = -x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.4e+52) || !(y <= 2.3e+22)) tmp = Float64(Float64(-x) / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.4e+52) || ~((y <= 2.3e+22))) tmp = -x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.4e+52], N[Not[LessEqual[y, 2.3e+22]], $MachinePrecision]], N[((-x) / N[(t / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+52} \lor \neg \left(y \leq 2.3 \cdot 10^{+22}\right):\\
\;\;\;\;\frac{-x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.4e52 or 2.3000000000000002e22 < y Initial program 85.0%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 58.5%
distribute-lft-in58.5%
*-rgt-identity58.5%
mul-1-neg58.5%
distribute-rgt-neg-in58.5%
unsub-neg58.5%
Simplified58.5%
Taylor expanded in y around inf 45.3%
associate-*r/46.0%
*-commutative46.0%
associate-*r*46.0%
neg-mul-146.0%
distribute-neg-frac46.0%
Simplified46.0%
associate-*l/45.3%
distribute-lft-neg-in45.3%
*-commutative45.3%
distribute-neg-frac45.3%
associate-/l*46.2%
distribute-neg-frac46.2%
Applied egg-rr46.2%
if -2.4e52 < y < 2.3000000000000002e22Initial program 97.9%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in y around 0 61.6%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 92.2%
associate-*l/96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.2%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in y around 0 41.0%
Final simplification41.0%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2023271
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))