
(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 12 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
(let* ((t_1 (+ x (/ (* (- z x) y) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+307)))
(+ x (* y (/ (- z x) t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+307)) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+307)) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) * y) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+307): tmp = x + (y * ((z - x) / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) * y) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+307)) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) * y) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 1e+307))) tmp = x + (y * ((z - x) / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+307]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+307}\right):\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 9.99999999999999986e306 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 78.6%
associate-/l*99.9%
*-commutative99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 9.99999999999999986e306Initial program 98.3%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* z y) t)))
(if (<= z -1.25e-24)
t_1
(if (<= z -6.5e-202)
x
(if (<= z 4.2e-207) (- (* x (/ y t))) (if (<= z 1e+15) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * y) / t;
double tmp;
if (z <= -1.25e-24) {
tmp = t_1;
} else if (z <= -6.5e-202) {
tmp = x;
} else if (z <= 4.2e-207) {
tmp = -(x * (y / t));
} else if (z <= 1e+15) {
tmp = x;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (z * y) / t
if (z <= (-1.25d-24)) then
tmp = t_1
else if (z <= (-6.5d-202)) then
tmp = x
else if (z <= 4.2d-207) then
tmp = -(x * (y / t))
else if (z <= 1d+15) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * y) / t;
double tmp;
if (z <= -1.25e-24) {
tmp = t_1;
} else if (z <= -6.5e-202) {
tmp = x;
} else if (z <= 4.2e-207) {
tmp = -(x * (y / t));
} else if (z <= 1e+15) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * y) / t tmp = 0 if z <= -1.25e-24: tmp = t_1 elif z <= -6.5e-202: tmp = x elif z <= 4.2e-207: tmp = -(x * (y / t)) elif z <= 1e+15: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * y) / t) tmp = 0.0 if (z <= -1.25e-24) tmp = t_1; elseif (z <= -6.5e-202) tmp = x; elseif (z <= 4.2e-207) tmp = Float64(-Float64(x * Float64(y / t))); elseif (z <= 1e+15) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * y) / t; tmp = 0.0; if (z <= -1.25e-24) tmp = t_1; elseif (z <= -6.5e-202) tmp = x; elseif (z <= 4.2e-207) tmp = -(x * (y / t)); elseif (z <= 1e+15) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -1.25e-24], t$95$1, If[LessEqual[z, -6.5e-202], x, If[LessEqual[z, 4.2e-207], (-N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), If[LessEqual[z, 1e+15], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot y}{t}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-202}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-207}:\\
\;\;\;\;-x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 10^{+15}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.24999999999999995e-24 or 1e15 < z Initial program 91.9%
+-commutative91.9%
associate-/l*86.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in y around -inf 70.8%
Taylor expanded in z around inf 62.6%
if -1.24999999999999995e-24 < z < -6.49999999999999956e-202 or 4.20000000000000007e-207 < z < 1e15Initial program 95.8%
+-commutative95.8%
associate-/l*93.6%
fma-define93.6%
Simplified93.6%
Taylor expanded in y around 0 62.1%
if -6.49999999999999956e-202 < z < 4.20000000000000007e-207Initial program 87.8%
+-commutative87.8%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
Taylor expanded in y around -inf 63.0%
Taylor expanded in z around 0 62.5%
mul-1-neg62.5%
associate-/l*71.5%
distribute-rgt-neg-in71.5%
mul-1-neg71.5%
associate-*r/71.5%
mul-1-neg71.5%
Simplified71.5%
Final simplification63.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1e-201) (not (<= y 5.5e-21))) (+ x (* y (/ (- z x) t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1e-201) || !(y <= 5.5e-21)) {
tmp = x + (y * ((z - x) / 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 ((y <= (-1d-201)) .or. (.not. (y <= 5.5d-21))) then
tmp = x + (y * ((z - x) / 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 ((y <= -1e-201) || !(y <= 5.5e-21)) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1e-201) or not (y <= 5.5e-21): tmp = x + (y * ((z - x) / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1e-201) || !(y <= 5.5e-21)) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / 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 ((y <= -1e-201) || ~((y <= 5.5e-21))) tmp = x + (y * ((z - x) / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1e-201], N[Not[LessEqual[y, 5.5e-21]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-201} \lor \neg \left(y \leq 5.5 \cdot 10^{-21}\right):\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -9.99999999999999946e-202 or 5.49999999999999977e-21 < y Initial program 89.5%
associate-/l*97.0%
*-commutative97.0%
Applied egg-rr97.0%
if -9.99999999999999946e-202 < y < 5.49999999999999977e-21Initial program 97.8%
+-commutative97.8%
associate-/l*78.9%
fma-define78.9%
Simplified78.9%
fma-undefine78.9%
associate-/l*97.8%
*-commutative97.8%
associate-/l*99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 92.5%
associate-*l/93.5%
*-commutative93.5%
Simplified93.5%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e-33) (not (<= z 2.4e-14))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e-33) || !(z <= 2.4e-14)) {
tmp = x + (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 <= (-9.2d-33)) .or. (.not. (z <= 2.4d-14))) then
tmp = x + (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 <= -9.2e-33) || !(z <= 2.4e-14)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e-33) or not (z <= 2.4e-14): tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e-33) || !(z <= 2.4e-14)) tmp = Float64(x + 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 <= -9.2e-33) || ~((z <= 2.4e-14))) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e-33], N[Not[LessEqual[z, 2.4e-14]], $MachinePrecision]], N[(x + N[(z * N[(y / 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 -9.2 \cdot 10^{-33} \lor \neg \left(z \leq 2.4 \cdot 10^{-14}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -9.19999999999999942e-33 or 2.4e-14 < z Initial program 92.8%
+-commutative92.8%
associate-/l*86.9%
fma-define86.9%
Simplified86.9%
fma-undefine86.9%
associate-/l*92.8%
*-commutative92.8%
associate-/l*97.8%
Applied egg-rr97.8%
Taylor expanded in z around inf 84.8%
associate-*l/87.9%
*-commutative87.9%
Simplified87.9%
if -9.19999999999999942e-33 < z < 2.4e-14Initial program 92.3%
+-commutative92.3%
associate-/l*94.7%
fma-define94.7%
Simplified94.7%
Taylor expanded in z around 0 86.9%
*-rgt-identity86.9%
mul-1-neg86.9%
associate-/l*91.8%
distribute-rgt-neg-in91.8%
mul-1-neg91.8%
distribute-lft-in91.8%
mul-1-neg91.8%
unsub-neg91.8%
Simplified91.8%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e-33) (not (<= z 3.9e-14))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e-33) || !(z <= 3.9e-14)) {
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 <= (-7.6d-33)) .or. (.not. (z <= 3.9d-14))) 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 <= -7.6e-33) || !(z <= 3.9e-14)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.6e-33) or not (z <= 3.9e-14): 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 <= -7.6e-33) || !(z <= 3.9e-14)) 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 <= -7.6e-33) || ~((z <= 3.9e-14))) 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, -7.6e-33], N[Not[LessEqual[z, 3.9e-14]], $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 -7.6 \cdot 10^{-33} \lor \neg \left(z \leq 3.9 \cdot 10^{-14}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.59999999999999988e-33 or 3.8999999999999998e-14 < z Initial program 92.8%
Taylor expanded in z around inf 84.8%
associate-/l*79.1%
Simplified79.1%
if -7.59999999999999988e-33 < z < 3.8999999999999998e-14Initial program 92.3%
+-commutative92.3%
associate-/l*94.7%
fma-define94.7%
Simplified94.7%
Taylor expanded in z around 0 86.9%
*-rgt-identity86.9%
mul-1-neg86.9%
associate-/l*91.8%
distribute-rgt-neg-in91.8%
mul-1-neg91.8%
distribute-lft-in91.8%
mul-1-neg91.8%
unsub-neg91.8%
Simplified91.8%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.5e-24) (not (<= z 2.3e+30))) (* y (/ (- z x) t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.5e-24) || !(z <= 2.3e+30)) {
tmp = y * ((z - x) / 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.5d-24)) .or. (.not. (z <= 2.3d+30))) then
tmp = y * ((z - x) / 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.5e-24) || !(z <= 2.3e+30)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.5e-24) or not (z <= 2.3e+30): tmp = y * ((z - x) / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.5e-24) || !(z <= 2.3e+30)) tmp = Float64(y * Float64(Float64(z - x) / 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.5e-24) || ~((z <= 2.3e+30))) tmp = y * ((z - x) / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.5e-24], N[Not[LessEqual[z, 2.3e+30]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-24} \lor \neg \left(z \leq 2.3 \cdot 10^{+30}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.49999999999999998e-24 or 2.3e30 < z Initial program 91.9%
+-commutative91.9%
associate-/l*86.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in y around -inf 70.8%
associate-/l*86.5%
*-commutative86.5%
Applied egg-rr66.2%
if -1.49999999999999998e-24 < z < 2.3e30Initial program 93.3%
+-commutative93.3%
associate-/l*94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in z around 0 84.9%
*-rgt-identity84.9%
mul-1-neg84.9%
associate-/l*89.1%
distribute-rgt-neg-in89.1%
mul-1-neg89.1%
distribute-lft-in89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e+115) (not (<= z 6e+26))) (/ (* z y) t) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e+115) || !(z <= 6e+26)) {
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+115)) .or. (.not. (z <= 6d+26))) 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+115) || !(z <= 6e+26)) {
tmp = (z * y) / t;
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e+115) or not (z <= 6e+26): 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+115) || !(z <= 6e+26)) tmp = Float64(Float64(z * 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+115) || ~((z <= 6e+26))) 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+115], N[Not[LessEqual[z, 6e+26]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] / t), $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^{+115} \lor \neg \left(z \leq 6 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -8.99999999999999927e115 or 5.99999999999999994e26 < z Initial program 92.1%
+-commutative92.1%
associate-/l*85.1%
fma-define85.1%
Simplified85.1%
Taylor expanded in y around -inf 72.9%
Taylor expanded in z around inf 66.8%
if -8.99999999999999927e115 < z < 5.99999999999999994e26Initial program 92.9%
+-commutative92.9%
associate-/l*93.4%
fma-define93.4%
Simplified93.4%
Taylor expanded in z around 0 77.7%
*-rgt-identity77.7%
mul-1-neg77.7%
associate-/l*82.2%
distribute-rgt-neg-in82.2%
mul-1-neg82.2%
distribute-lft-in82.2%
mul-1-neg82.2%
unsub-neg82.2%
Simplified82.2%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (<= z -5.7e-33) (+ x (* z (/ y t))) (if (<= z 4.5e-14) (* x (- 1.0 (/ y t))) (+ x (/ z (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.7e-33) {
tmp = x + (z * (y / t));
} else if (z <= 4.5e-14) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z / (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 <= (-5.7d-33)) then
tmp = x + (z * (y / t))
else if (z <= 4.5d-14) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (z / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.7e-33) {
tmp = x + (z * (y / t));
} else if (z <= 4.5e-14) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.7e-33: tmp = x + (z * (y / t)) elif z <= 4.5e-14: tmp = x * (1.0 - (y / t)) else: tmp = x + (z / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.7e-33) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (z <= 4.5e-14) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.7e-33) tmp = x + (z * (y / t)); elseif (z <= 4.5e-14) tmp = x * (1.0 - (y / t)); else tmp = x + (z / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.7e-33], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e-14], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{-33}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -5.70000000000000025e-33Initial program 93.2%
+-commutative93.2%
associate-/l*90.3%
fma-define90.3%
Simplified90.3%
fma-undefine90.3%
associate-/l*93.2%
*-commutative93.2%
associate-/l*98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 85.1%
associate-*l/87.5%
*-commutative87.5%
Simplified87.5%
if -5.70000000000000025e-33 < z < 4.4999999999999998e-14Initial program 92.3%
+-commutative92.3%
associate-/l*94.7%
fma-define94.7%
Simplified94.7%
Taylor expanded in z around 0 86.9%
*-rgt-identity86.9%
mul-1-neg86.9%
associate-/l*91.8%
distribute-rgt-neg-in91.8%
mul-1-neg91.8%
distribute-lft-in91.8%
mul-1-neg91.8%
unsub-neg91.8%
Simplified91.8%
if 4.4999999999999998e-14 < z Initial program 92.6%
+-commutative92.6%
associate-/l*83.9%
fma-define83.9%
Simplified83.9%
fma-undefine83.9%
associate-/l*92.6%
*-commutative92.6%
associate-/l*97.4%
Applied egg-rr97.4%
Taylor expanded in z around inf 84.6%
associate-*l/88.2%
*-commutative88.2%
Simplified88.2%
clear-num88.2%
un-div-inv88.2%
Applied egg-rr88.2%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e-24) (not (<= z 3.2e+20))) (/ (* z y) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e-24) || !(z <= 3.2e+20)) {
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 ((z <= (-1.65d-24)) .or. (.not. (z <= 3.2d+20))) 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 ((z <= -1.65e-24) || !(z <= 3.2e+20)) {
tmp = (z * y) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.65e-24) or not (z <= 3.2e+20): tmp = (z * y) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.65e-24) || !(z <= 3.2e+20)) tmp = Float64(Float64(z * y) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.65e-24) || ~((z <= 3.2e+20))) tmp = (z * y) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e-24], N[Not[LessEqual[z, 3.2e+20]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-24} \lor \neg \left(z \leq 3.2 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.64999999999999992e-24 or 3.2e20 < z Initial program 91.9%
+-commutative91.9%
associate-/l*86.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in y around -inf 70.8%
Taylor expanded in z around inf 62.6%
if -1.64999999999999992e-24 < z < 3.2e20Initial program 93.3%
+-commutative93.3%
associate-/l*94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in y around 0 51.8%
Final simplification57.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e-25) (not (<= z 1.95e+17))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-25) || !(z <= 1.95e+17)) {
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 ((z <= (-8.5d-25)) .or. (.not. (z <= 1.95d+17))) 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 ((z <= -8.5e-25) || !(z <= 1.95e+17)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e-25) or not (z <= 1.95e+17): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e-25) || !(z <= 1.95e+17)) 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 ((z <= -8.5e-25) || ~((z <= 1.95e+17))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e-25], N[Not[LessEqual[z, 1.95e+17]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-25} \lor \neg \left(z \leq 1.95 \cdot 10^{+17}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.49999999999999981e-25 or 1.95e17 < z Initial program 91.9%
+-commutative91.9%
associate-/l*86.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in y around -inf 70.8%
Taylor expanded in z around inf 62.6%
associate-/l*77.6%
Simplified56.6%
if -8.49999999999999981e-25 < z < 1.95e17Initial program 93.3%
+-commutative93.3%
associate-/l*94.0%
fma-define94.0%
Simplified94.0%
Taylor expanded in y around 0 51.8%
Final simplification54.2%
(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.6%
+-commutative92.6%
associate-/l*90.3%
fma-define90.3%
Simplified90.3%
fma-undefine90.3%
associate-/l*92.6%
*-commutative92.6%
associate-/l*97.9%
Applied egg-rr97.9%
Final simplification97.9%
(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.6%
+-commutative92.6%
associate-/l*90.3%
fma-define90.3%
Simplified90.3%
Taylor expanded in y around 0 38.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 2024103
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))