
(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 13 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 94.7%
Taylor expanded in z around 0 89.2%
+-commutative89.2%
*-commutative89.2%
associate-*r/87.1%
mul-1-neg87.1%
associate-/l*89.2%
distribute-lft-neg-in89.2%
distribute-rgt-in98.2%
sub-neg98.2%
Simplified98.2%
*-commutative98.2%
clear-num98.1%
un-div-inv98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))) (t_2 (* y (/ x (- t)))))
(if (<= y -5.6e+207)
t_2
(if (<= y -4.8e-63)
t_1
(if (<= y 7e-87)
x
(if (or (<= y 4.4e+243) (not (<= y 6.2e+287))) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double t_2 = y * (x / -t);
double tmp;
if (y <= -5.6e+207) {
tmp = t_2;
} else if (y <= -4.8e-63) {
tmp = t_1;
} else if (y <= 7e-87) {
tmp = x;
} else if ((y <= 4.4e+243) || !(y <= 6.2e+287)) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = z * (y / t)
t_2 = y * (x / -t)
if (y <= (-5.6d+207)) then
tmp = t_2
else if (y <= (-4.8d-63)) then
tmp = t_1
else if (y <= 7d-87) then
tmp = x
else if ((y <= 4.4d+243) .or. (.not. (y <= 6.2d+287))) then
tmp = t_1
else
tmp = t_2
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 t_2 = y * (x / -t);
double tmp;
if (y <= -5.6e+207) {
tmp = t_2;
} else if (y <= -4.8e-63) {
tmp = t_1;
} else if (y <= 7e-87) {
tmp = x;
} else if ((y <= 4.4e+243) || !(y <= 6.2e+287)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) t_2 = y * (x / -t) tmp = 0 if y <= -5.6e+207: tmp = t_2 elif y <= -4.8e-63: tmp = t_1 elif y <= 7e-87: tmp = x elif (y <= 4.4e+243) or not (y <= 6.2e+287): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) t_2 = Float64(y * Float64(x / Float64(-t))) tmp = 0.0 if (y <= -5.6e+207) tmp = t_2; elseif (y <= -4.8e-63) tmp = t_1; elseif (y <= 7e-87) tmp = x; elseif ((y <= 4.4e+243) || !(y <= 6.2e+287)) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); t_2 = y * (x / -t); tmp = 0.0; if (y <= -5.6e+207) tmp = t_2; elseif (y <= -4.8e-63) tmp = t_1; elseif (y <= 7e-87) tmp = x; elseif ((y <= 4.4e+243) || ~((y <= 6.2e+287))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.6e+207], t$95$2, If[LessEqual[y, -4.8e-63], t$95$1, If[LessEqual[y, 7e-87], x, If[Or[LessEqual[y, 4.4e+243], N[Not[LessEqual[y, 6.2e+287]], $MachinePrecision]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
t_2 := y \cdot \frac{x}{-t}\\
\mathbf{if}\;y \leq -5.6 \cdot 10^{+207}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-87}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+243} \lor \neg \left(y \leq 6.2 \cdot 10^{+287}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -5.60000000000000022e207 or 4.40000000000000018e243 < y < 6.2e287Initial program 79.6%
Taylor expanded in y around -inf 79.6%
associate-/l*97.3%
*-commutative97.3%
Applied egg-rr97.3%
Taylor expanded in z around 0 76.0%
neg-mul-176.0%
distribute-neg-frac76.0%
Simplified76.0%
if -5.60000000000000022e207 < y < -4.8000000000000001e-63 or 7.00000000000000023e-87 < y < 4.40000000000000018e243 or 6.2e287 < y Initial program 95.1%
Taylor expanded in y around -inf 75.2%
Taylor expanded in z around inf 52.4%
associate-/l*53.2%
Simplified53.2%
clear-num53.1%
un-div-inv53.5%
Applied egg-rr53.5%
associate-/r/58.5%
Applied egg-rr58.5%
if -4.8000000000000001e-63 < y < 7.00000000000000023e-87Initial program 99.8%
Taylor expanded in y around 0 69.9%
Final simplification64.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -8.4e+105)
t_1
(if (<= z -4.6e-222)
x
(if (<= z 1.75e-211)
(* (/ y t) (- x))
(if (<= z 10000000000.0) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -8.4e+105) {
tmp = t_1;
} else if (z <= -4.6e-222) {
tmp = x;
} else if (z <= 1.75e-211) {
tmp = (y / t) * -x;
} else if (z <= 10000000000.0) {
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 <= (-8.4d+105)) then
tmp = t_1
else if (z <= (-4.6d-222)) then
tmp = x
else if (z <= 1.75d-211) then
tmp = (y / t) * -x
else if (z <= 10000000000.0d0) 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 <= -8.4e+105) {
tmp = t_1;
} else if (z <= -4.6e-222) {
tmp = x;
} else if (z <= 1.75e-211) {
tmp = (y / t) * -x;
} else if (z <= 10000000000.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -8.4e+105: tmp = t_1 elif z <= -4.6e-222: tmp = x elif z <= 1.75e-211: tmp = (y / t) * -x elif z <= 10000000000.0: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (z <= -8.4e+105) tmp = t_1; elseif (z <= -4.6e-222) tmp = x; elseif (z <= 1.75e-211) tmp = Float64(Float64(y / t) * Float64(-x)); elseif (z <= 10000000000.0) 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 <= -8.4e+105) tmp = t_1; elseif (z <= -4.6e-222) tmp = x; elseif (z <= 1.75e-211) tmp = (y / t) * -x; elseif (z <= 10000000000.0) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.4e+105], t$95$1, If[LessEqual[z, -4.6e-222], x, If[LessEqual[z, 1.75e-211], N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, 10000000000.0], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -8.4 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-222}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-211}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 10000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.4000000000000004e105 or 1e10 < z Initial program 92.9%
Taylor expanded in y around -inf 73.2%
Taylor expanded in z around inf 68.4%
associate-/l*66.8%
Simplified66.8%
clear-num66.7%
un-div-inv67.2%
Applied egg-rr67.2%
associate-/r/71.1%
Applied egg-rr71.1%
if -8.4000000000000004e105 < z < -4.6000000000000003e-222 or 1.75e-211 < z < 1e10Initial program 97.1%
Taylor expanded in y around 0 53.3%
if -4.6000000000000003e-222 < z < 1.75e-211Initial program 93.7%
Taylor expanded in y around -inf 64.2%
Taylor expanded in z around 0 57.8%
mul-1-neg57.8%
associate-/l*63.8%
distribute-rgt-neg-in63.8%
mul-1-neg63.8%
associate-*r/63.8%
mul-1-neg63.8%
Simplified63.8%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.8e+111) (not (<= z 5.8e+32))) (* z (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.8e+111) || !(z <= 5.8e+32)) {
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 <= (-2.8d+111)) .or. (.not. (z <= 5.8d+32))) 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 <= -2.8e+111) || !(z <= 5.8e+32)) {
tmp = z * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.8e+111) or not (z <= 5.8e+32): tmp = z * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.8e+111) || !(z <= 5.8e+32)) 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 <= -2.8e+111) || ~((z <= 5.8e+32))) 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, -2.8e+111], N[Not[LessEqual[z, 5.8e+32]], $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 -2.8 \cdot 10^{+111} \lor \neg \left(z \leq 5.8 \cdot 10^{+32}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.7999999999999999e111 or 5.80000000000000006e32 < z Initial program 92.6%
Taylor expanded in y around -inf 74.0%
Taylor expanded in z around inf 69.0%
associate-/l*67.3%
Simplified67.3%
clear-num67.3%
un-div-inv67.8%
Applied egg-rr67.8%
associate-/r/71.8%
Applied egg-rr71.8%
if -2.7999999999999999e111 < z < 5.80000000000000006e32Initial program 96.1%
Taylor expanded in x around inf 86.0%
mul-1-neg86.0%
unsub-neg86.0%
Simplified86.0%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e+85) (not (<= z 2.25e+33))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e+85) || !(z <= 2.25e+33)) {
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 ((z <= (-7.8d+85)) .or. (.not. (z <= 2.25d+33))) 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 ((z <= -7.8e+85) || !(z <= 2.25e+33)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e+85) or not (z <= 2.25e+33): tmp = (z - x) * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e+85) || !(z <= 2.25e+33)) 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 ((z <= -7.8e+85) || ~((z <= 2.25e+33))) 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[z, -7.8e+85], N[Not[LessEqual[z, 2.25e+33]], $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}\;z \leq -7.8 \cdot 10^{+85} \lor \neg \left(z \leq 2.25 \cdot 10^{+33}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.80000000000000067e85 or 2.25e33 < z Initial program 92.0%
Taylor expanded in y around -inf 73.0%
Taylor expanded in z around 0 63.5%
+-commutative82.5%
*-commutative82.5%
associate-*r/85.8%
mul-1-neg85.8%
associate-/l*86.4%
distribute-lft-neg-in86.4%
distribute-rgt-in98.5%
sub-neg98.5%
Simplified76.5%
if -7.80000000000000067e85 < z < 2.25e33Initial program 96.7%
Taylor expanded in x around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e+105) (not (<= z 2.7e-108))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e+105) || !(z <= 2.7e-108)) {
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.8d+105)) .or. (.not. (z <= 2.7d-108))) 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.8e+105) || !(z <= 2.7e-108)) {
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.8e+105) or not (z <= 2.7e-108): 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.8e+105) || !(z <= 2.7e-108)) 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.8e+105) || ~((z <= 2.7e-108))) 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.8e+105], N[Not[LessEqual[z, 2.7e-108]], $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.8 \cdot 10^{+105} \lor \neg \left(z \leq 2.7 \cdot 10^{-108}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.79999999999999957e105 or 2.70000000000000005e-108 < z Initial program 94.1%
Taylor expanded in z around inf 89.7%
associate-/l*60.2%
Simplified89.2%
if -7.79999999999999957e105 < z < 2.70000000000000005e-108Initial program 95.4%
Taylor expanded in x around inf 87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e+105) (not (<= z 2e-104))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e+105) || !(z <= 2e-104)) {
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 <= (-7.8d+105)) .or. (.not. (z <= 2d-104))) 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 <= -7.8e+105) || !(z <= 2e-104)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e+105) or not (z <= 2e-104): 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 <= -7.8e+105) || !(z <= 2e-104)) 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 <= -7.8e+105) || ~((z <= 2e-104))) 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, -7.8e+105], N[Not[LessEqual[z, 2e-104]], $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 -7.8 \cdot 10^{+105} \lor \neg \left(z \leq 2 \cdot 10^{-104}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -7.79999999999999957e105 or 1.99999999999999985e-104 < z Initial program 94.1%
Taylor expanded in z around inf 89.7%
associate-/l*60.2%
Simplified89.2%
clear-num60.2%
un-div-inv60.6%
Applied egg-rr89.6%
if -7.79999999999999957e105 < z < 1.99999999999999985e-104Initial program 95.4%
Taylor expanded in x around inf 87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= z -7.8e+105) (+ x (/ y (/ t z))) (if (<= z 2.3e-104) (* x (- 1.0 (/ y t))) (+ x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.8e+105) {
tmp = x + (y / (t / z));
} else if (z <= 2.3e-104) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-7.8d+105)) then
tmp = x + (y / (t / z))
else if (z <= 2.3d-104) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.8e+105) {
tmp = x + (y / (t / z));
} else if (z <= 2.3e-104) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.8e+105: tmp = x + (y / (t / z)) elif z <= 2.3e-104: tmp = x * (1.0 - (y / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.8e+105) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 2.3e-104) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.8e+105) tmp = x + (y / (t / z)); elseif (z <= 2.3e-104) tmp = x * (1.0 - (y / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.8e+105], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e-104], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+105}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-104}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -7.79999999999999957e105Initial program 90.4%
Taylor expanded in z around inf 92.4%
associate-/l*67.8%
Simplified93.1%
clear-num67.7%
un-div-inv68.9%
Applied egg-rr94.3%
if -7.79999999999999957e105 < z < 2.2999999999999999e-104Initial program 95.4%
Taylor expanded in x around inf 87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
if 2.2999999999999999e-104 < z Initial program 95.7%
Taylor expanded in z around inf 88.5%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (<= z -8e+105) (+ x (/ y (/ t z))) (if (<= z 2.2e-104) (- x (* x (/ y t))) (+ x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8e+105) {
tmp = x + (y / (t / z));
} else if (z <= 2.2e-104) {
tmp = x - (x * (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-8d+105)) then
tmp = x + (y / (t / z))
else if (z <= 2.2d-104) then
tmp = x - (x * (y / t))
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8e+105) {
tmp = x + (y / (t / z));
} else if (z <= 2.2e-104) {
tmp = x - (x * (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8e+105: tmp = x + (y / (t / z)) elif z <= 2.2e-104: tmp = x - (x * (y / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8e+105) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 2.2e-104) tmp = Float64(x - Float64(x * Float64(y / t))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8e+105) tmp = x + (y / (t / z)); elseif (z <= 2.2e-104) tmp = x - (x * (y / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8e+105], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-104], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+105}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-104}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -7.9999999999999995e105Initial program 90.4%
Taylor expanded in z around inf 92.4%
associate-/l*67.8%
Simplified93.1%
clear-num67.7%
un-div-inv68.9%
Applied egg-rr94.3%
if -7.9999999999999995e105 < z < 2.20000000000000012e-104Initial program 95.4%
Taylor expanded in z around 0 84.1%
mul-1-neg43.4%
associate-/l*47.1%
distribute-rgt-neg-in47.1%
mul-1-neg47.1%
associate-*r/47.1%
mul-1-neg47.1%
Simplified87.8%
if 2.20000000000000012e-104 < z Initial program 95.7%
Taylor expanded in z around inf 88.5%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.35e-62) (not (<= y 3.05e-86))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.35e-62) || !(y <= 3.05e-86)) {
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.35d-62)) .or. (.not. (y <= 3.05d-86))) 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.35e-62) || !(y <= 3.05e-86)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.35e-62) or not (y <= 3.05e-86): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.35e-62) || !(y <= 3.05e-86)) 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.35e-62) || ~((y <= 3.05e-86))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.35e-62], N[Not[LessEqual[y, 3.05e-86]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-62} \lor \neg \left(y \leq 3.05 \cdot 10^{-86}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.3500000000000001e-62 or 3.05000000000000016e-86 < y Initial program 92.2%
Taylor expanded in y around -inf 76.0%
Taylor expanded in z around inf 47.4%
associate-/l*48.6%
Simplified48.6%
if -1.3500000000000001e-62 < y < 3.05000000000000016e-86Initial program 99.8%
Taylor expanded in y around 0 69.9%
Final simplification55.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e-63) (not (<= y 2.85e-89))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e-63) || !(y <= 2.85e-89)) {
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 <= (-6d-63)) .or. (.not. (y <= 2.85d-89))) 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 <= -6e-63) || !(y <= 2.85e-89)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6e-63) or not (y <= 2.85e-89): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6e-63) || !(y <= 2.85e-89)) 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 <= -6e-63) || ~((y <= 2.85e-89))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6e-63], N[Not[LessEqual[y, 2.85e-89]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-63} \lor \neg \left(y \leq 2.85 \cdot 10^{-89}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.99999999999999959e-63 or 2.8500000000000001e-89 < y Initial program 92.2%
Taylor expanded in y around -inf 76.0%
Taylor expanded in z around inf 47.4%
associate-/l*48.6%
Simplified48.6%
clear-num48.5%
un-div-inv48.8%
Applied egg-rr48.8%
associate-/r/52.6%
Applied egg-rr52.6%
if -5.99999999999999959e-63 < y < 2.8500000000000001e-89Initial program 99.8%
Taylor expanded in y around 0 69.9%
Final simplification58.3%
(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 94.7%
Taylor expanded in z around 0 89.2%
+-commutative89.2%
*-commutative89.2%
associate-*r/87.1%
mul-1-neg87.1%
associate-/l*89.2%
distribute-lft-neg-in89.2%
distribute-rgt-in98.2%
sub-neg98.2%
Simplified98.2%
Final simplification98.2%
(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 94.7%
Taylor expanded in y around 0 36.7%
Final simplification36.7%
(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 2024080
(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)))