
(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 11 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 90.3%
Taylor expanded in z around 0 85.9%
+-commutative85.9%
mul-1-neg85.9%
*-commutative85.9%
associate-*r/86.8%
associate-/l*88.6%
distribute-lft-neg-in88.6%
distribute-rgt-in98.0%
sub-neg98.0%
Simplified98.0%
clear-num97.9%
associate-*l/98.2%
*-un-lft-identity98.2%
Applied egg-rr98.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.15e-35) (not (<= t 3.5e-10))) (+ x (* y (/ z t))) (/ (* (- z x) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.15e-35) || !(t <= 3.5e-10)) {
tmp = x + (y * (z / t));
} else {
tmp = ((z - 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 <= (-1.15d-35)) .or. (.not. (t <= 3.5d-10))) then
tmp = x + (y * (z / t))
else
tmp = ((z - 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 <= -1.15e-35) || !(t <= 3.5e-10)) {
tmp = x + (y * (z / t));
} else {
tmp = ((z - x) * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.15e-35) or not (t <= 3.5e-10): tmp = x + (y * (z / t)) else: tmp = ((z - x) * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.15e-35) || !(t <= 3.5e-10)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(Float64(z - x) * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.15e-35) || ~((t <= 3.5e-10))) tmp = x + (y * (z / t)); else tmp = ((z - x) * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.15e-35], N[Not[LessEqual[t, 3.5e-10]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-35} \lor \neg \left(t \leq 3.5 \cdot 10^{-10}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(z - x\right) \cdot y}{t}\\
\end{array}
\end{array}
if t < -1.1499999999999999e-35 or 3.4999999999999998e-10 < t Initial program 83.0%
Taylor expanded in z around inf 78.3%
associate-/l*87.0%
Simplified87.0%
if -1.1499999999999999e-35 < t < 3.4999999999999998e-10Initial program 97.5%
Taylor expanded in y around -inf 87.6%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.2e-35) (not (<= t 6e-10))) (+ x (* y (/ z t))) (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-35) || !(t <= 6e-10)) {
tmp = x + (y * (z / t));
} else {
tmp = (z - 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 <= (-3.2d-35)) .or. (.not. (t <= 6d-10))) then
tmp = x + (y * (z / t))
else
tmp = (z - 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 <= -3.2e-35) || !(t <= 6e-10)) {
tmp = x + (y * (z / t));
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.2e-35) or not (t <= 6e-10): tmp = x + (y * (z / t)) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.2e-35) || !(t <= 6e-10)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(z - x) * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.2e-35) || ~((t <= 6e-10))) tmp = x + (y * (z / t)); else tmp = (z - x) * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.2e-35], N[Not[LessEqual[t, 6e-10]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-35} \lor \neg \left(t \leq 6 \cdot 10^{-10}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -3.1999999999999998e-35 or 6e-10 < t Initial program 83.0%
Taylor expanded in z around inf 78.3%
associate-/l*87.0%
Simplified87.0%
if -3.1999999999999998e-35 < t < 6e-10Initial program 97.5%
Taylor expanded in y around -inf 87.6%
Taylor expanded in z around 0 79.1%
+-commutative89.0%
mul-1-neg89.0%
*-commutative89.0%
associate-*r/84.3%
associate-/l*78.1%
distribute-lft-neg-in78.1%
distribute-rgt-in96.8%
sub-neg96.8%
Simplified86.9%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9e-50) (not (<= y 2.3e-123))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e-50) || !(y <= 2.3e-123)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (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 ((y <= (-9d-50)) .or. (.not. (y <= 2.3d-123))) then
tmp = (z - x) * (y / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e-50) || !(y <= 2.3e-123)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9e-50) or not (y <= 2.3e-123): tmp = (z - x) * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9e-50) || !(y <= 2.3e-123)) tmp = Float64(Float64(z - x) * Float64(y / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9e-50) || ~((y <= 2.3e-123))) tmp = (z - x) * (y / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9e-50], N[Not[LessEqual[y, 2.3e-123]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-50} \lor \neg \left(y \leq 2.3 \cdot 10^{-123}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -8.99999999999999924e-50 or 2.29999999999999987e-123 < y Initial program 86.7%
Taylor expanded in y around -inf 75.9%
Taylor expanded in z around 0 68.9%
+-commutative79.7%
mul-1-neg79.7%
*-commutative79.7%
associate-*r/80.1%
associate-/l*82.2%
distribute-lft-neg-in82.2%
distribute-rgt-in96.9%
sub-neg96.9%
Simplified83.2%
if -8.99999999999999924e-50 < y < 2.29999999999999987e-123Initial program 96.6%
Taylor expanded in x around inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
Simplified75.5%
Final simplification80.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e+133) (not (<= z 8.5e+61))) (* z (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e+133) || !(z <= 8.5e+61)) {
tmp = z * (y / t);
} else {
tmp = x * (1.0 - (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 <= (-9d+133)) .or. (.not. (z <= 8.5d+61))) then
tmp = z * (y / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e+133) || !(z <= 8.5e+61)) {
tmp = z * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e+133) or not (z <= 8.5e+61): tmp = z * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e+133) || !(z <= 8.5e+61)) tmp = Float64(z * Float64(y / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e+133) || ~((z <= 8.5e+61))) tmp = z * (y / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e+133], N[Not[LessEqual[z, 8.5e+61]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+133} \lor \neg \left(z \leq 8.5 \cdot 10^{+61}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -8.9999999999999997e133 or 8.50000000000000035e61 < z Initial program 82.8%
Taylor expanded in y around -inf 66.4%
Taylor expanded in z around inf 66.2%
associate-/l*92.4%
Simplified73.6%
clear-num73.6%
un-div-inv74.2%
Applied egg-rr74.2%
associate-/r/78.8%
Applied egg-rr78.8%
if -8.9999999999999997e133 < z < 8.50000000000000035e61Initial program 94.2%
Taylor expanded in x around inf 77.7%
mul-1-neg77.7%
unsub-neg77.7%
Simplified77.7%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (<= y -40000000000000.0) (* y (/ (- z x) t)) (if (<= y 730000.0) (+ x (/ (* z y) t)) (* (- z x) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -40000000000000.0) {
tmp = y * ((z - x) / t);
} else if (y <= 730000.0) {
tmp = x + ((z * y) / t);
} else {
tmp = (z - 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 (y <= (-40000000000000.0d0)) then
tmp = y * ((z - x) / t)
else if (y <= 730000.0d0) then
tmp = x + ((z * y) / t)
else
tmp = (z - x) * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -40000000000000.0) {
tmp = y * ((z - x) / t);
} else if (y <= 730000.0) {
tmp = x + ((z * y) / t);
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -40000000000000.0: tmp = y * ((z - x) / t) elif y <= 730000.0: tmp = x + ((z * y) / t) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -40000000000000.0) tmp = Float64(y * Float64(Float64(z - x) / t)); elseif (y <= 730000.0) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = Float64(Float64(z - x) * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -40000000000000.0) tmp = y * ((z - x) / t); elseif (y <= 730000.0) tmp = x + ((z * y) / t); else tmp = (z - x) * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -40000000000000.0], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 730000.0], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -40000000000000:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{elif}\;y \leq 730000:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -4e13Initial program 81.4%
Taylor expanded in y around -inf 75.1%
associate-/l*88.0%
*-commutative88.0%
Applied egg-rr88.0%
if -4e13 < y < 7.3e5Initial program 97.5%
Taylor expanded in z around 0 96.7%
+-commutative96.7%
mul-1-neg96.7%
*-commutative96.7%
associate-*r/97.4%
associate-/l*98.3%
distribute-lft-neg-in98.3%
distribute-rgt-in99.1%
sub-neg99.1%
Simplified99.1%
Taylor expanded in z around inf 85.6%
if 7.3e5 < y Initial program 85.0%
Taylor expanded in y around -inf 79.6%
Taylor expanded in z around 0 70.8%
+-commutative76.2%
mul-1-neg76.2%
*-commutative76.2%
associate-*r/74.8%
associate-/l*79.8%
distribute-lft-neg-in79.8%
distribute-rgt-in98.4%
sub-neg98.4%
Simplified88.8%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.4e-49) (* y (/ (- z x) t)) (if (<= y 1e-107) (* x (- 1.0 (/ y t))) (* (- z x) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-49) {
tmp = y * ((z - x) / t);
} else if (y <= 1e-107) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z - 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 (y <= (-1.4d-49)) then
tmp = y * ((z - x) / t)
else if (y <= 1d-107) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (z - x) * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-49) {
tmp = y * ((z - x) / t);
} else if (y <= 1e-107) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e-49: tmp = y * ((z - x) / t) elif y <= 1e-107: tmp = x * (1.0 - (y / t)) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e-49) tmp = Float64(y * Float64(Float64(z - x) / t)); elseif (y <= 1e-107) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(z - x) * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.4e-49) tmp = y * ((z - x) / t); elseif (y <= 1e-107) tmp = x * (1.0 - (y / t)); else tmp = (z - x) * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e-49], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-107], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-49}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{elif}\;y \leq 10^{-107}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.39999999999999999e-49Initial program 85.2%
Taylor expanded in y around -inf 72.4%
associate-/l*82.6%
*-commutative82.6%
Applied egg-rr82.6%
if -1.39999999999999999e-49 < y < 1e-107Initial program 96.6%
Taylor expanded in x around inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
Simplified75.5%
if 1e-107 < y Initial program 87.9%
Taylor expanded in y around -inf 78.9%
Taylor expanded in z around 0 71.8%
+-commutative80.8%
mul-1-neg80.8%
*-commutative80.8%
associate-*r/79.7%
associate-/l*83.8%
distribute-lft-neg-in83.8%
distribute-rgt-in98.7%
sub-neg98.7%
Simplified86.3%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.8e-50) (not (<= y 1.2e-116))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-50) || !(y <= 1.2e-116)) {
tmp = z * (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 <= (-4.8d-50)) .or. (.not. (y <= 1.2d-116))) then
tmp = z * (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 <= -4.8e-50) || !(y <= 1.2e-116)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.8e-50) or not (y <= 1.2e-116): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.8e-50) || !(y <= 1.2e-116)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.8e-50) || ~((y <= 1.2e-116))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.8e-50], N[Not[LessEqual[y, 1.2e-116]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-50} \lor \neg \left(y \leq 1.2 \cdot 10^{-116}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.80000000000000004e-50 or 1.19999999999999996e-116 < y Initial program 86.7%
Taylor expanded in y around -inf 75.9%
Taylor expanded in z around inf 47.1%
associate-/l*65.2%
Simplified51.4%
clear-num50.8%
un-div-inv51.1%
Applied egg-rr51.1%
associate-/r/54.0%
Applied egg-rr54.0%
if -4.80000000000000004e-50 < y < 1.19999999999999996e-116Initial program 96.6%
Taylor expanded in y around 0 66.4%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.65e-49) (not (<= y 7.4e-96))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.65e-49) || !(y <= 7.4e-96)) {
tmp = y * (z / 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.65d-49)) .or. (.not. (y <= 7.4d-96))) then
tmp = y * (z / 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.65e-49) || !(y <= 7.4e-96)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.65e-49) or not (y <= 7.4e-96): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.65e-49) || !(y <= 7.4e-96)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.65e-49) || ~((y <= 7.4e-96))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.65e-49], N[Not[LessEqual[y, 7.4e-96]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-49} \lor \neg \left(y \leq 7.4 \cdot 10^{-96}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.65e-49 or 7.39999999999999972e-96 < y Initial program 86.5%
Taylor expanded in y around -inf 75.6%
Taylor expanded in z around inf 47.0%
associate-/l*66.0%
Simplified52.0%
if -1.65e-49 < y < 7.39999999999999972e-96Initial program 96.7%
Taylor expanded in y around 0 65.1%
Final simplification56.9%
(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 90.3%
Taylor expanded in z around 0 85.9%
+-commutative85.9%
mul-1-neg85.9%
*-commutative85.9%
associate-*r/86.8%
associate-/l*88.6%
distribute-lft-neg-in88.6%
distribute-rgt-in98.0%
sub-neg98.0%
Simplified98.0%
Final simplification98.0%
(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 90.3%
Taylor expanded in y around 0 34.5%
(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 2024131
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))