
(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 15 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 (if (<= y -1.5e+79) (+ x (* y (/ (- z x) t))) (fma (/ y t) (- z x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.5e+79) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = fma((y / t), (z - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.5e+79) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = fma(Float64(y / t), Float64(z - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e+79], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+79}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\end{array}
\end{array}
if y < -1.49999999999999987e79Initial program 86.0%
associate-/l*97.3%
Simplified97.3%
frac-2neg97.3%
distribute-frac-neg97.3%
remove-double-neg97.3%
distribute-frac-neg97.3%
frac-2neg97.3%
associate-/l*86.0%
unsub-neg86.0%
associate-/l*97.3%
frac-2neg97.3%
distribute-frac-neg97.3%
remove-double-neg97.3%
div-inv97.3%
distribute-neg-frac97.3%
clear-num97.4%
frac-2neg97.4%
neg-sub097.4%
sub-neg97.4%
+-commutative97.4%
associate--r+97.4%
neg-sub097.4%
remove-double-neg97.4%
remove-double-neg97.4%
Applied egg-rr97.4%
if -1.49999999999999987e79 < y Initial program 93.7%
+-commutative93.7%
associate-*l/98.6%
fma-def98.6%
Simplified98.6%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.52e-86) (not (<= z 1.6e+27))) (+ x (/ z (/ t y))) (+ x (* y (/ x (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.52e-86) || !(z <= 1.6e+27)) {
tmp = x + (z / (t / y));
} else {
tmp = x + (y * (x / -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 <= (-1.52d-86)) .or. (.not. (z <= 1.6d+27))) then
tmp = x + (z / (t / y))
else
tmp = x + (y * (x / -t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.52e-86) || !(z <= 1.6e+27)) {
tmp = x + (z / (t / y));
} else {
tmp = x + (y * (x / -t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.52e-86) or not (z <= 1.6e+27): tmp = x + (z / (t / y)) else: tmp = x + (y * (x / -t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.52e-86) || !(z <= 1.6e+27)) tmp = Float64(x + Float64(z / Float64(t / y))); else tmp = Float64(x + Float64(y * Float64(x / Float64(-t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.52e-86) || ~((z <= 1.6e+27))) tmp = x + (z / (t / y)); else tmp = x + (y * (x / -t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.52e-86], N[Not[LessEqual[z, 1.6e+27]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(x / (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.52 \cdot 10^{-86} \lor \neg \left(z \leq 1.6 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{x}{-t}\\
\end{array}
\end{array}
if z < -1.52e-86 or 1.60000000000000008e27 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in z around inf 85.9%
associate-*r/86.0%
*-commutative86.0%
associate-/r/90.9%
Simplified90.9%
if -1.52e-86 < z < 1.60000000000000008e27Initial program 94.5%
Taylor expanded in z around 0 85.3%
mul-1-neg85.3%
*-commutative85.3%
distribute-rgt-neg-out85.3%
Simplified85.3%
div-inv85.3%
associate-*l*88.3%
*-commutative88.3%
div-inv88.3%
frac-2neg88.3%
remove-double-neg88.3%
Applied egg-rr88.3%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e-86) (not (<= z 3.6e+28))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e-86) || !(z <= 3.6e+28)) {
tmp = x + (y * (z / 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 <= (-1.55d-86)) .or. (.not. (z <= 3.6d+28))) then
tmp = x + (y * (z / 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 <= -1.55e-86) || !(z <= 3.6e+28)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.55e-86) or not (z <= 3.6e+28): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e-86) || !(z <= 3.6e+28)) tmp = Float64(x + Float64(y * Float64(z / 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 <= -1.55e-86) || ~((z <= 3.6e+28))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e-86], N[Not[LessEqual[z, 3.6e+28]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-86} \lor \neg \left(z \leq 3.6 \cdot 10^{+28}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.54999999999999994e-86 or 3.5999999999999999e28 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in z around inf 85.9%
*-commutative85.9%
associate-*l/86.0%
*-commutative86.0%
Simplified86.0%
if -1.54999999999999994e-86 < z < 3.5999999999999999e28Initial program 94.5%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in x around inf 86.1%
associate-*r/86.1%
associate-*l/86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-*l/86.1%
associate-*r/86.1%
mul-1-neg86.1%
distribute-lft-neg-in86.1%
distribute-rgt-neg-out86.1%
distribute-rgt-neg-out86.1%
associate-*l/85.3%
*-commutative85.3%
unsub-neg85.3%
*-commutative85.3%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around 0 86.1%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.4e-83) (not (<= z 5.8e+29))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e-83) || !(z <= 5.8e+29)) {
tmp = x + (y / (t / z));
} 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 <= (-2.4d-83)) .or. (.not. (z <= 5.8d+29))) then
tmp = x + (y / (t / z))
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 <= -2.4e-83) || !(z <= 5.8e+29)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.4e-83) or not (z <= 5.8e+29): tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.4e-83) || !(z <= 5.8e+29)) tmp = Float64(x + Float64(y / Float64(t / z))); 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 <= -2.4e-83) || ~((z <= 5.8e+29))) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.4e-83], N[Not[LessEqual[z, 5.8e+29]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-83} \lor \neg \left(z \leq 5.8 \cdot 10^{+29}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.4000000000000001e-83 or 5.7999999999999999e29 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in z around inf 85.9%
associate-/l*87.1%
Simplified87.1%
if -2.4000000000000001e-83 < z < 5.7999999999999999e29Initial program 94.5%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in x around inf 86.1%
associate-*r/86.1%
associate-*l/86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-*l/86.1%
associate-*r/86.1%
mul-1-neg86.1%
distribute-lft-neg-in86.1%
distribute-rgt-neg-out86.1%
distribute-rgt-neg-out86.1%
associate-*l/85.3%
*-commutative85.3%
unsub-neg85.3%
*-commutative85.3%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around 0 86.1%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.26e-83) (not (<= z 5.1e+28))) (+ x (/ z (/ t y))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.26e-83) || !(z <= 5.1e+28)) {
tmp = x + (z / (t / y));
} 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 <= (-1.26d-83)) .or. (.not. (z <= 5.1d+28))) then
tmp = x + (z / (t / y))
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 <= -1.26e-83) || !(z <= 5.1e+28)) {
tmp = x + (z / (t / y));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.26e-83) or not (z <= 5.1e+28): tmp = x + (z / (t / y)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.26e-83) || !(z <= 5.1e+28)) tmp = Float64(x + Float64(z / Float64(t / y))); 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 <= -1.26e-83) || ~((z <= 5.1e+28))) tmp = x + (z / (t / y)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.26e-83], N[Not[LessEqual[z, 5.1e+28]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.26 \cdot 10^{-83} \lor \neg \left(z \leq 5.1 \cdot 10^{+28}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.2600000000000001e-83 or 5.1000000000000004e28 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in z around inf 85.9%
associate-*r/86.0%
*-commutative86.0%
associate-/r/90.9%
Simplified90.9%
if -1.2600000000000001e-83 < z < 5.1000000000000004e28Initial program 94.5%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in x around inf 86.1%
associate-*r/86.1%
associate-*l/86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-*l/86.1%
associate-*r/86.1%
mul-1-neg86.1%
distribute-lft-neg-in86.1%
distribute-rgt-neg-out86.1%
distribute-rgt-neg-out86.1%
associate-*l/85.3%
*-commutative85.3%
unsub-neg85.3%
*-commutative85.3%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around 0 86.1%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1e-85) (not (<= z 1.3e+29))) (+ x (/ z (/ t y))) (- x (* x (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-85) || !(z <= 1.3e+29)) {
tmp = x + (z / (t / y));
} 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 <= (-1d-85)) .or. (.not. (z <= 1.3d+29))) then
tmp = x + (z / (t / y))
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 <= -1e-85) || !(z <= 1.3e+29)) {
tmp = x + (z / (t / y));
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1e-85) or not (z <= 1.3e+29): tmp = x + (z / (t / y)) else: tmp = x - (x * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1e-85) || !(z <= 1.3e+29)) tmp = Float64(x + Float64(z / Float64(t / y))); 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 <= -1e-85) || ~((z <= 1.3e+29))) tmp = x + (z / (t / y)); else tmp = x - (x * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1e-85], N[Not[LessEqual[z, 1.3e+29]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-85} \lor \neg \left(z \leq 1.3 \cdot 10^{+29}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -9.9999999999999998e-86 or 1.3e29 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in z around inf 85.9%
associate-*r/86.0%
*-commutative86.0%
associate-/r/90.9%
Simplified90.9%
if -9.9999999999999998e-86 < z < 1.3e29Initial program 94.5%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in x around inf 86.1%
associate-*r/86.1%
associate-*l/86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-*l/86.1%
associate-*r/86.1%
mul-1-neg86.1%
distribute-lft-neg-in86.1%
distribute-rgt-neg-out86.1%
distribute-rgt-neg-out86.1%
associate-*l/85.3%
*-commutative85.3%
unsub-neg85.3%
*-commutative85.3%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.45e-83) (not (<= z 3.7e+27))) (+ x (/ z (/ t y))) (- x (/ x (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 3.7e+27)) {
tmp = x + (z / (t / y));
} else {
tmp = x - (x / (t / y));
}
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 <= (-2.45d-83)) .or. (.not. (z <= 3.7d+27))) then
tmp = x + (z / (t / y))
else
tmp = x - (x / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 3.7e+27)) {
tmp = x + (z / (t / y));
} else {
tmp = x - (x / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.45e-83) or not (z <= 3.7e+27): tmp = x + (z / (t / y)) else: tmp = x - (x / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.45e-83) || !(z <= 3.7e+27)) tmp = Float64(x + Float64(z / Float64(t / y))); else tmp = Float64(x - Float64(x / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.45e-83) || ~((z <= 3.7e+27))) tmp = x + (z / (t / y)); else tmp = x - (x / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.45e-83], N[Not[LessEqual[z, 3.7e+27]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{-83} \lor \neg \left(z \leq 3.7 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -2.45e-83 or 3.70000000000000002e27 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in z around inf 85.9%
associate-*r/86.0%
*-commutative86.0%
associate-/r/90.9%
Simplified90.9%
if -2.45e-83 < z < 3.70000000000000002e27Initial program 94.5%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in x around inf 86.1%
associate-*r/86.1%
associate-*l/86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-*l/86.1%
associate-*r/86.1%
mul-1-neg86.1%
distribute-lft-neg-in86.1%
distribute-rgt-neg-out86.1%
distribute-rgt-neg-out86.1%
associate-*l/85.3%
*-commutative85.3%
unsub-neg85.3%
*-commutative85.3%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
clear-num86.1%
un-div-inv86.1%
Applied egg-rr86.1%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.45e-83) (not (<= z 1.66e+27))) (+ x (/ z (/ t y))) (- x (/ y (/ t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 1.66e+27)) {
tmp = x + (z / (t / y));
} else {
tmp = x - (y / (t / 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 ((z <= (-2.45d-83)) .or. (.not. (z <= 1.66d+27))) then
tmp = x + (z / (t / y))
else
tmp = x - (y / (t / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 1.66e+27)) {
tmp = x + (z / (t / y));
} else {
tmp = x - (y / (t / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.45e-83) or not (z <= 1.66e+27): tmp = x + (z / (t / y)) else: tmp = x - (y / (t / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.45e-83) || !(z <= 1.66e+27)) tmp = Float64(x + Float64(z / Float64(t / y))); else tmp = Float64(x - Float64(y / Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.45e-83) || ~((z <= 1.66e+27))) tmp = x + (z / (t / y)); else tmp = x - (y / (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.45e-83], N[Not[LessEqual[z, 1.66e+27]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{-83} \lor \neg \left(z \leq 1.66 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{x}}\\
\end{array}
\end{array}
if z < -2.45e-83 or 1.65999999999999986e27 < z Initial program 89.8%
associate-/l*93.3%
Simplified93.3%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in z around inf 85.9%
associate-*r/86.0%
*-commutative86.0%
associate-/r/90.9%
Simplified90.9%
if -2.45e-83 < z < 1.65999999999999986e27Initial program 94.5%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in x around inf 86.1%
associate-*r/86.1%
associate-*l/86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-*l/86.1%
associate-*r/86.1%
mul-1-neg86.1%
distribute-lft-neg-in86.1%
distribute-rgt-neg-out86.1%
distribute-rgt-neg-out86.1%
associate-*l/85.3%
*-commutative85.3%
unsub-neg85.3%
*-commutative85.3%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
*-commutative86.1%
associate-/r/88.3%
Applied egg-rr88.3%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= y -4e+79) (+ x (/ y (/ t (- z x)))) (- x (* (- x z) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e+79) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = x - ((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 (y <= (-4d+79)) then
tmp = x + (y / (t / (z - x)))
else
tmp = x - ((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 (y <= -4e+79) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = x - ((x - z) * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4e+79: tmp = x + (y / (t / (z - x))) else: tmp = x - ((x - z) * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4e+79) tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); else tmp = Float64(x - Float64(Float64(x - z) * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4e+79) tmp = x + (y / (t / (z - x))); else tmp = x - ((x - z) * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4e+79], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(x - z), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+79}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;x - \left(x - z\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -3.99999999999999987e79Initial program 86.0%
associate-/l*97.3%
Simplified97.3%
if -3.99999999999999987e79 < y Initial program 93.7%
associate-/l*95.0%
Simplified95.0%
associate-/r/98.6%
Applied egg-rr98.6%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.15e+79) (+ x (* y (/ (- z x) t))) (- x (* (- x z) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e+79) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x - ((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 (y <= (-1.15d+79)) then
tmp = x + (y * ((z - x) / t))
else
tmp = x - ((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 (y <= -1.15e+79) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x - ((x - z) * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.15e+79: tmp = x + (y * ((z - x) / t)) else: tmp = x - ((x - z) * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.15e+79) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = Float64(x - Float64(Float64(x - z) * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.15e+79) tmp = x + (y * ((z - x) / t)); else tmp = x - ((x - z) * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.15e+79], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(x - z), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+79}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \left(x - z\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.15e79Initial program 86.0%
associate-/l*97.3%
Simplified97.3%
frac-2neg97.3%
distribute-frac-neg97.3%
remove-double-neg97.3%
distribute-frac-neg97.3%
frac-2neg97.3%
associate-/l*86.0%
unsub-neg86.0%
associate-/l*97.3%
frac-2neg97.3%
distribute-frac-neg97.3%
remove-double-neg97.3%
div-inv97.3%
distribute-neg-frac97.3%
clear-num97.4%
frac-2neg97.4%
neg-sub097.4%
sub-neg97.4%
+-commutative97.4%
associate--r+97.4%
neg-sub097.4%
remove-double-neg97.4%
remove-double-neg97.4%
Applied egg-rr97.4%
if -1.15e79 < y Initial program 93.7%
associate-/l*95.0%
Simplified95.0%
associate-/r/98.6%
Applied egg-rr98.6%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (<= t -1.62e-108) x (if (<= t 1.9e-22) (* x (/ y (- t))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.62e-108) {
tmp = x;
} else if (t <= 1.9e-22) {
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 (t <= (-1.62d-108)) then
tmp = x
else if (t <= 1.9d-22) 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 (t <= -1.62e-108) {
tmp = x;
} else if (t <= 1.9e-22) {
tmp = x * (y / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.62e-108: tmp = x elif t <= 1.9e-22: tmp = x * (y / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.62e-108) tmp = x; elseif (t <= 1.9e-22) tmp = Float64(x * Float64(y / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.62e-108) tmp = x; elseif (t <= 1.9e-22) tmp = x * (y / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.62e-108], x, If[LessEqual[t, 1.9e-22], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.62 \cdot 10^{-108}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-22}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.62e-108 or 1.90000000000000012e-22 < t Initial program 88.2%
associate-/l*97.5%
Simplified97.5%
Taylor expanded in y around 0 56.0%
if -1.62e-108 < t < 1.90000000000000012e-22Initial program 97.2%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in x around inf 57.4%
associate-*r/57.4%
associate-*l/57.4%
distribute-rgt-in57.4%
*-lft-identity57.4%
associate-*l/57.4%
associate-*r/57.4%
mul-1-neg57.4%
distribute-lft-neg-in57.4%
distribute-rgt-neg-out57.4%
distribute-rgt-neg-out57.4%
associate-*l/58.2%
*-commutative58.2%
unsub-neg58.2%
*-commutative58.2%
associate-*l/57.4%
*-commutative57.4%
Simplified57.4%
clear-num57.4%
un-div-inv57.4%
Applied egg-rr57.4%
Taylor expanded in t around 0 53.0%
associate-*r/52.0%
neg-mul-152.0%
distribute-rgt-neg-in52.0%
mul-1-neg52.0%
metadata-eval52.0%
times-frac52.0%
*-lft-identity52.0%
neg-mul-152.0%
Simplified52.0%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (if (<= t -3.3e-108) x (if (<= t 3.5e-23) (* (- y) (/ x t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.3e-108) {
tmp = x;
} else if (t <= 3.5e-23) {
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 (t <= (-3.3d-108)) then
tmp = x
else if (t <= 3.5d-23) 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 (t <= -3.3e-108) {
tmp = x;
} else if (t <= 3.5e-23) {
tmp = -y * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.3e-108: tmp = x elif t <= 3.5e-23: tmp = -y * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.3e-108) tmp = x; elseif (t <= 3.5e-23) tmp = Float64(Float64(-y) * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.3e-108) tmp = x; elseif (t <= 3.5e-23) tmp = -y * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.3e-108], x, If[LessEqual[t, 3.5e-23], N[((-y) * N[(x / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-108}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-23}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.3000000000000002e-108 or 3.49999999999999993e-23 < t Initial program 88.2%
associate-/l*97.5%
Simplified97.5%
Taylor expanded in y around 0 56.0%
if -3.3000000000000002e-108 < t < 3.49999999999999993e-23Initial program 97.2%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in x around inf 57.4%
associate-*r/57.4%
associate-*l/57.4%
distribute-rgt-in57.4%
*-lft-identity57.4%
associate-*l/57.4%
associate-*r/57.4%
mul-1-neg57.4%
distribute-lft-neg-in57.4%
distribute-rgt-neg-out57.4%
distribute-rgt-neg-out57.4%
associate-*l/58.2%
*-commutative58.2%
unsub-neg58.2%
*-commutative58.2%
associate-*l/57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in y around inf 53.0%
associate-/l*52.0%
associate-*r/52.0%
neg-mul-152.0%
associate-/r/53.5%
*-commutative53.5%
Simplified53.5%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (- x (* (- x z) (/ y t))))
double code(double x, double y, double z, double t) {
return x - ((x - 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 - z) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x - z) * (y / t));
}
def code(x, y, z, t): return x - ((x - z) * (y / t))
function code(x, y, z, t) return Float64(x - Float64(Float64(x - z) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x - ((x - z) * (y / t)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x - z), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x - z\right) \cdot \frac{y}{t}
\end{array}
Initial program 92.0%
associate-/l*95.5%
Simplified95.5%
associate-/r/96.3%
Applied egg-rr96.3%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ y t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (y / t));
}
def code(x, y, z, t): return x * (1.0 - (y / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (y / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{y}{t}\right)
\end{array}
Initial program 92.0%
associate-/l*95.5%
Simplified95.5%
Taylor expanded in x around inf 65.3%
associate-*r/65.3%
associate-*l/65.3%
distribute-rgt-in65.3%
*-lft-identity65.3%
associate-*l/65.3%
associate-*r/65.3%
mul-1-neg65.3%
distribute-lft-neg-in65.3%
distribute-rgt-neg-out65.3%
distribute-rgt-neg-out65.3%
associate-*l/61.5%
*-commutative61.5%
unsub-neg61.5%
*-commutative61.5%
associate-*l/65.3%
*-commutative65.3%
Simplified65.3%
Taylor expanded in x around 0 65.3%
Final simplification65.3%
(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.0%
associate-/l*95.5%
Simplified95.5%
Taylor expanded in y around 0 35.1%
Final simplification35.1%
(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 2023297
(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)))