
(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 (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - 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 + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 92.8%
Taylor expanded in z around 0 87.7%
+-commutative87.7%
*-commutative87.7%
associate-*r/88.8%
mul-1-neg88.8%
associate-/l*90.1%
distribute-lft-neg-in90.1%
distribute-rgt-in98.0%
sub-neg98.0%
Simplified98.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.5e-40)
(* x (/ (- t y) t))
(if (<= x -3.7e-118)
(/ (* y z) t)
(if (or (<= x -2.5e-196) (not (<= x 3e-9)))
(* x (- 1.0 (/ y t)))
(* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.5e-40) {
tmp = x * ((t - y) / t);
} else if (x <= -3.7e-118) {
tmp = (y * z) / t;
} else if ((x <= -2.5e-196) || !(x <= 3e-9)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * (z / 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 (x <= (-3.5d-40)) then
tmp = x * ((t - y) / t)
else if (x <= (-3.7d-118)) then
tmp = (y * z) / t
else if ((x <= (-2.5d-196)) .or. (.not. (x <= 3d-9))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.5e-40) {
tmp = x * ((t - y) / t);
} else if (x <= -3.7e-118) {
tmp = (y * z) / t;
} else if ((x <= -2.5e-196) || !(x <= 3e-9)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.5e-40: tmp = x * ((t - y) / t) elif x <= -3.7e-118: tmp = (y * z) / t elif (x <= -2.5e-196) or not (x <= 3e-9): tmp = x * (1.0 - (y / t)) else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.5e-40) tmp = Float64(x * Float64(Float64(t - y) / t)); elseif (x <= -3.7e-118) tmp = Float64(Float64(y * z) / t); elseif ((x <= -2.5e-196) || !(x <= 3e-9)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.5e-40) tmp = x * ((t - y) / t); elseif (x <= -3.7e-118) tmp = (y * z) / t; elseif ((x <= -2.5e-196) || ~((x <= 3e-9))) tmp = x * (1.0 - (y / t)); else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.5e-40], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e-118], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[x, -2.5e-196], N[Not[LessEqual[x, 3e-9]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-40}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-118}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-196} \lor \neg \left(x \leq 3 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -3.5000000000000002e-40Initial program 92.7%
Taylor expanded in x around inf 88.0%
mul-1-neg88.0%
unsub-neg88.0%
Simplified88.0%
Taylor expanded in t around 0 88.0%
if -3.5000000000000002e-40 < x < -3.70000000000000014e-118Initial program 99.6%
Taylor expanded in y around -inf 85.9%
Taylor expanded in z around inf 71.9%
if -3.70000000000000014e-118 < x < -2.5000000000000002e-196 or 2.99999999999999998e-9 < x Initial program 93.5%
Taylor expanded in x around inf 80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
if -2.5000000000000002e-196 < x < 2.99999999999999998e-9Initial program 89.0%
Taylor expanded in y around -inf 67.4%
Taylor expanded in z around inf 61.0%
associate-/l*88.6%
Simplified67.0%
Final simplification78.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -2e-40)
t_1
(if (<= x -2.3e-118)
(/ (* y z) t)
(if (or (<= x -3.7e-196) (not (<= x 1.32e-9))) t_1 (* y (/ z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -2e-40) {
tmp = t_1;
} else if (x <= -2.3e-118) {
tmp = (y * z) / t;
} else if ((x <= -3.7e-196) || !(x <= 1.32e-9)) {
tmp = t_1;
} else {
tmp = y * (z / 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / t))
if (x <= (-2d-40)) then
tmp = t_1
else if (x <= (-2.3d-118)) then
tmp = (y * z) / t
else if ((x <= (-3.7d-196)) .or. (.not. (x <= 1.32d-9))) then
tmp = t_1
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -2e-40) {
tmp = t_1;
} else if (x <= -2.3e-118) {
tmp = (y * z) / t;
} else if ((x <= -3.7e-196) || !(x <= 1.32e-9)) {
tmp = t_1;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -2e-40: tmp = t_1 elif x <= -2.3e-118: tmp = (y * z) / t elif (x <= -3.7e-196) or not (x <= 1.32e-9): tmp = t_1 else: tmp = y * (z / t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -2e-40) tmp = t_1; elseif (x <= -2.3e-118) tmp = Float64(Float64(y * z) / t); elseif ((x <= -3.7e-196) || !(x <= 1.32e-9)) tmp = t_1; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -2e-40) tmp = t_1; elseif (x <= -2.3e-118) tmp = (y * z) / t; elseif ((x <= -3.7e-196) || ~((x <= 1.32e-9))) tmp = t_1; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e-40], t$95$1, If[LessEqual[x, -2.3e-118], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[x, -3.7e-196], N[Not[LessEqual[x, 1.32e-9]], $MachinePrecision]], t$95$1, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-118}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-196} \lor \neg \left(x \leq 1.32 \cdot 10^{-9}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.9999999999999999e-40 or -2.30000000000000021e-118 < x < -3.7000000000000001e-196 or 1.32e-9 < x Initial program 93.1%
Taylor expanded in x around inf 83.8%
mul-1-neg83.8%
unsub-neg83.8%
Simplified83.8%
if -1.9999999999999999e-40 < x < -2.30000000000000021e-118Initial program 99.6%
Taylor expanded in y around -inf 85.9%
Taylor expanded in z around inf 71.9%
if -3.7000000000000001e-196 < x < 1.32e-9Initial program 89.0%
Taylor expanded in y around -inf 67.4%
Taylor expanded in z around inf 61.0%
associate-/l*88.6%
Simplified67.0%
Final simplification78.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y z) t)))
(if (<= t -3.5e+26)
x
(if (<= t -1.85e-185)
t_1
(if (<= t 3.8e-262) (* x (/ y (- t))) (if (<= t 0.48) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double tmp;
if (t <= -3.5e+26) {
tmp = x;
} else if (t <= -1.85e-185) {
tmp = t_1;
} else if (t <= 3.8e-262) {
tmp = x * (y / -t);
} else if (t <= 0.48) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y * z) / t
if (t <= (-3.5d+26)) then
tmp = x
else if (t <= (-1.85d-185)) then
tmp = t_1
else if (t <= 3.8d-262) then
tmp = x * (y / -t)
else if (t <= 0.48d0) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double tmp;
if (t <= -3.5e+26) {
tmp = x;
} else if (t <= -1.85e-185) {
tmp = t_1;
} else if (t <= 3.8e-262) {
tmp = x * (y / -t);
} else if (t <= 0.48) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) / t tmp = 0 if t <= -3.5e+26: tmp = x elif t <= -1.85e-185: tmp = t_1 elif t <= 3.8e-262: tmp = x * (y / -t) elif t <= 0.48: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) / t) tmp = 0.0 if (t <= -3.5e+26) tmp = x; elseif (t <= -1.85e-185) tmp = t_1; elseif (t <= 3.8e-262) tmp = Float64(x * Float64(y / Float64(-t))); elseif (t <= 0.48) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) / t; tmp = 0.0; if (t <= -3.5e+26) tmp = x; elseif (t <= -1.85e-185) tmp = t_1; elseif (t <= 3.8e-262) tmp = x * (y / -t); elseif (t <= 0.48) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -3.5e+26], x, If[LessEqual[t, -1.85e-185], t$95$1, If[LessEqual[t, 3.8e-262], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.48], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
\mathbf{if}\;t \leq -3.5 \cdot 10^{+26}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.85 \cdot 10^{-185}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-262}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{elif}\;t \leq 0.48:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.4999999999999999e26 or 0.47999999999999998 < t Initial program 86.7%
Taylor expanded in y around 0 66.9%
if -3.4999999999999999e26 < t < -1.85e-185 or 3.8000000000000002e-262 < t < 0.47999999999999998Initial program 98.8%
Taylor expanded in y around -inf 85.5%
Taylor expanded in z around inf 65.1%
if -1.85e-185 < t < 3.8000000000000002e-262Initial program 95.9%
Taylor expanded in y around -inf 88.1%
Taylor expanded in z around 0 61.0%
mul-1-neg61.0%
associate-/l*67.8%
distribute-rgt-neg-in67.8%
mul-1-neg67.8%
associate-*r/67.8%
mul-1-neg67.8%
Simplified67.8%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.4e+28) (not (<= y 2.25e+61))) (* y (/ (- z x) t)) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e+28) || !(y <= 2.25e+61)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + ((y / t) * z);
}
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+28)) .or. (.not. (y <= 2.25d+61))) then
tmp = y * ((z - x) / t)
else
tmp = x + ((y / t) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e+28) || !(y <= 2.25e+61)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.4e+28) or not (y <= 2.25e+61): tmp = y * ((z - x) / t) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.4e+28) || !(y <= 2.25e+61)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.4e+28) || ~((y <= 2.25e+61))) tmp = y * ((z - x) / t); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.4e+28], N[Not[LessEqual[y, 2.25e+61]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+28} \lor \neg \left(y \leq 2.25 \cdot 10^{+61}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if y < -2.39999999999999981e28 or 2.25e61 < y Initial program 85.9%
Taylor expanded in y around -inf 79.9%
associate-/l*90.1%
*-commutative90.1%
Applied egg-rr90.1%
if -2.39999999999999981e28 < y < 2.25e61Initial program 97.9%
Taylor expanded in z around 0 96.6%
+-commutative96.6%
*-commutative96.6%
associate-*r/96.6%
mul-1-neg96.6%
associate-/l*97.9%
distribute-lft-neg-in97.9%
distribute-rgt-in99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 85.7%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.9e+32) (not (<= y 5.6e-39))) (* y (/ (- z x) t)) (* x (/ (- t y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.9e+32) || !(y <= 5.6e-39)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * ((t - 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 <= (-3.9d+32)) .or. (.not. (y <= 5.6d-39))) then
tmp = y * ((z - x) / t)
else
tmp = x * ((t - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.9e+32) || !(y <= 5.6e-39)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * ((t - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.9e+32) or not (y <= 5.6e-39): tmp = y * ((z - x) / t) else: tmp = x * ((t - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.9e+32) || !(y <= 5.6e-39)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x * Float64(Float64(t - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.9e+32) || ~((y <= 5.6e-39))) tmp = y * ((z - x) / t); else tmp = x * ((t - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.9e+32], N[Not[LessEqual[y, 5.6e-39]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{+32} \lor \neg \left(y \leq 5.6 \cdot 10^{-39}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\end{array}
\end{array}
if y < -3.8999999999999999e32 or 5.6000000000000003e-39 < y Initial program 87.9%
Taylor expanded in y around -inf 80.5%
associate-/l*87.8%
*-commutative87.8%
Applied egg-rr87.8%
if -3.8999999999999999e32 < y < 5.6000000000000003e-39Initial program 97.6%
Taylor expanded in x around inf 75.4%
mul-1-neg75.4%
unsub-neg75.4%
Simplified75.4%
Taylor expanded in t around 0 75.4%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (<= x -0.011) (* x (/ (- t y) t)) (if (<= x 20000.0) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.011) {
tmp = x * ((t - y) / t);
} else if (x <= 20000.0) {
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 (x <= (-0.011d0)) then
tmp = x * ((t - y) / t)
else if (x <= 20000.0d0) 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 (x <= -0.011) {
tmp = x * ((t - y) / t);
} else if (x <= 20000.0) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.011: tmp = x * ((t - y) / t) elif x <= 20000.0: tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.011) tmp = Float64(x * Float64(Float64(t - y) / t)); elseif (x <= 20000.0) 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 (x <= -0.011) tmp = x * ((t - y) / t); elseif (x <= 20000.0) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.011], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 20000.0], 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}\;x \leq -0.011:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\mathbf{elif}\;x \leq 20000:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if x < -0.010999999999999999Initial program 91.9%
Taylor expanded in x around inf 90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
Taylor expanded in t around 0 90.8%
if -0.010999999999999999 < x < 2e4Initial program 92.6%
Taylor expanded in z around inf 85.0%
associate-/l*85.0%
Simplified85.0%
if 2e4 < x Initial program 94.3%
Taylor expanded in x around inf 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2e+34) (not (<= y 2.3e-38))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e+34) || !(y <= 2.3e-38)) {
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 <= (-2d+34)) .or. (.not. (y <= 2.3d-38))) 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 <= -2e+34) || !(y <= 2.3e-38)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2e+34) or not (y <= 2.3e-38): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2e+34) || !(y <= 2.3e-38)) 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 <= -2e+34) || ~((y <= 2.3e-38))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2e+34], N[Not[LessEqual[y, 2.3e-38]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+34} \lor \neg \left(y \leq 2.3 \cdot 10^{-38}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.99999999999999989e34 or 2.30000000000000002e-38 < y Initial program 87.9%
Taylor expanded in y around -inf 80.5%
Taylor expanded in z around inf 51.5%
associate-/l*64.6%
Simplified55.1%
if -1.99999999999999989e34 < y < 2.30000000000000002e-38Initial program 97.6%
Taylor expanded in y around 0 62.0%
Final simplification58.6%
(FPCore (x y z t) :precision binary64 (if (<= t -2.8e+26) x (if (<= t 3.0) (/ (* y z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e+26) {
tmp = x;
} else if (t <= 3.0) {
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 (t <= (-2.8d+26)) then
tmp = x
else if (t <= 3.0d0) 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 (t <= -2.8e+26) {
tmp = x;
} else if (t <= 3.0) {
tmp = (y * z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.8e+26: tmp = x elif t <= 3.0: tmp = (y * z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.8e+26) tmp = x; elseif (t <= 3.0) tmp = Float64(Float64(y * z) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.8e+26) tmp = x; elseif (t <= 3.0) tmp = (y * z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.8e+26], x, If[LessEqual[t, 3.0], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+26}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.8e26 or 3 < t Initial program 86.7%
Taylor expanded in y around 0 66.9%
if -2.8e26 < t < 3Initial program 97.8%
Taylor expanded in y around -inf 86.4%
Taylor expanded in z around inf 57.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.9e+26) x (if (<= t 0.48) (/ y (/ t z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e+26) {
tmp = x;
} else if (t <= 0.48) {
tmp = y / (t / z);
} 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.9d+26)) then
tmp = x
else if (t <= 0.48d0) then
tmp = y / (t / z)
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.9e+26) {
tmp = x;
} else if (t <= 0.48) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.9e+26: tmp = x elif t <= 0.48: tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.9e+26) tmp = x; elseif (t <= 0.48) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.9e+26) tmp = x; elseif (t <= 0.48) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.9e+26], x, If[LessEqual[t, 0.48], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+26}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 0.48:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.9000000000000001e26 or 0.47999999999999998 < t Initial program 86.7%
Taylor expanded in y around 0 66.9%
if -1.9000000000000001e26 < t < 0.47999999999999998Initial program 97.8%
Taylor expanded in y around -inf 86.4%
Taylor expanded in z around inf 57.7%
associate-/l*59.6%
Simplified51.8%
clear-num51.7%
un-div-inv53.0%
Applied egg-rr53.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 92.8%
Taylor expanded in y around 0 37.4%
(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 2024163
(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)))