
(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 93.9%
Taylor expanded in z around 0 88.8%
+-commutative88.8%
*-commutative88.8%
associate-*r/86.5%
mul-1-neg86.5%
associate-/l*89.4%
distribute-lft-neg-in89.4%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
Taylor expanded in y around 0 93.9%
associate-*r/90.3%
*-commutative90.3%
associate-/r/97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -2e+48)
t_1
(if (<= z 2.8e-172)
x
(if (<= z 4.2e-96) (/ (* z y) t) (if (<= z 2.2e+16) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -2e+48) {
tmp = t_1;
} else if (z <= 2.8e-172) {
tmp = x;
} else if (z <= 4.2e-96) {
tmp = (z * y) / t;
} else if (z <= 2.2e+16) {
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 <= (-2d+48)) then
tmp = t_1
else if (z <= 2.8d-172) then
tmp = x
else if (z <= 4.2d-96) then
tmp = (z * y) / t
else if (z <= 2.2d+16) 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 <= -2e+48) {
tmp = t_1;
} else if (z <= 2.8e-172) {
tmp = x;
} else if (z <= 4.2e-96) {
tmp = (z * y) / t;
} else if (z <= 2.2e+16) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -2e+48: tmp = t_1 elif z <= 2.8e-172: tmp = x elif z <= 4.2e-96: tmp = (z * y) / t elif z <= 2.2e+16: 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 <= -2e+48) tmp = t_1; elseif (z <= 2.8e-172) tmp = x; elseif (z <= 4.2e-96) tmp = Float64(Float64(z * y) / t); elseif (z <= 2.2e+16) 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 <= -2e+48) tmp = t_1; elseif (z <= 2.8e-172) tmp = x; elseif (z <= 4.2e-96) tmp = (z * y) / t; elseif (z <= 2.2e+16) 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, -2e+48], t$95$1, If[LessEqual[z, 2.8e-172], x, If[LessEqual[z, 4.2e-96], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.2e+16], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -2 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-172}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-96}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.00000000000000009e48 or 2.2e16 < z Initial program 92.5%
Taylor expanded in y around -inf 71.3%
Taylor expanded in z around inf 63.6%
associate-*l/68.2%
Applied egg-rr68.2%
if -2.00000000000000009e48 < z < 2.80000000000000011e-172 or 4.20000000000000002e-96 < z < 2.2e16Initial program 96.0%
Taylor expanded in y around 0 58.8%
if 2.80000000000000011e-172 < z < 4.20000000000000002e-96Initial program 87.1%
Taylor expanded in y around -inf 67.9%
Taylor expanded in z around inf 51.1%
Final simplification62.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -2.7e+48)
t_1
(if (<= z -1.46e-192)
x
(if (<= z -1.22e-267) (* x (/ y (- t))) (if (<= z 3.1e+16) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -2.7e+48) {
tmp = t_1;
} else if (z <= -1.46e-192) {
tmp = x;
} else if (z <= -1.22e-267) {
tmp = x * (y / -t);
} else if (z <= 3.1e+16) {
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 <= (-2.7d+48)) then
tmp = t_1
else if (z <= (-1.46d-192)) then
tmp = x
else if (z <= (-1.22d-267)) then
tmp = x * (y / -t)
else if (z <= 3.1d+16) 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 <= -2.7e+48) {
tmp = t_1;
} else if (z <= -1.46e-192) {
tmp = x;
} else if (z <= -1.22e-267) {
tmp = x * (y / -t);
} else if (z <= 3.1e+16) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -2.7e+48: tmp = t_1 elif z <= -1.46e-192: tmp = x elif z <= -1.22e-267: tmp = x * (y / -t) elif z <= 3.1e+16: 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 <= -2.7e+48) tmp = t_1; elseif (z <= -1.46e-192) tmp = x; elseif (z <= -1.22e-267) tmp = Float64(x * Float64(y / Float64(-t))); elseif (z <= 3.1e+16) 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 <= -2.7e+48) tmp = t_1; elseif (z <= -1.46e-192) tmp = x; elseif (z <= -1.22e-267) tmp = x * (y / -t); elseif (z <= 3.1e+16) 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, -2.7e+48], t$95$1, If[LessEqual[z, -1.46e-192], x, If[LessEqual[z, -1.22e-267], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e+16], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.46 \cdot 10^{-192}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{-267}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.70000000000000004e48 or 3.1e16 < z Initial program 92.5%
Taylor expanded in y around -inf 71.3%
Taylor expanded in z around inf 63.6%
associate-*l/68.2%
Applied egg-rr68.2%
if -2.70000000000000004e48 < z < -1.46000000000000002e-192 or -1.22e-267 < z < 3.1e16Initial program 94.4%
Taylor expanded in y around 0 58.0%
if -1.46000000000000002e-192 < z < -1.22e-267Initial program 99.7%
Taylor expanded in y around -inf 68.3%
Taylor expanded in z around 0 64.9%
mul-1-neg64.9%
associate-/l*60.1%
distribute-rgt-neg-in60.1%
mul-1-neg60.1%
associate-*r/60.1%
mul-1-neg60.1%
Simplified60.1%
Final simplification62.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -1.8e+48)
t_1
(if (<= z -4.4e-192)
x
(if (<= z -3.2e-267) (- (/ (* x y) t)) (if (<= z 4.4e+16) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -1.8e+48) {
tmp = t_1;
} else if (z <= -4.4e-192) {
tmp = x;
} else if (z <= -3.2e-267) {
tmp = -((x * y) / t);
} else if (z <= 4.4e+16) {
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.8d+48)) then
tmp = t_1
else if (z <= (-4.4d-192)) then
tmp = x
else if (z <= (-3.2d-267)) then
tmp = -((x * y) / t)
else if (z <= 4.4d+16) 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.8e+48) {
tmp = t_1;
} else if (z <= -4.4e-192) {
tmp = x;
} else if (z <= -3.2e-267) {
tmp = -((x * y) / t);
} else if (z <= 4.4e+16) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -1.8e+48: tmp = t_1 elif z <= -4.4e-192: tmp = x elif z <= -3.2e-267: tmp = -((x * y) / t) elif z <= 4.4e+16: 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 <= -1.8e+48) tmp = t_1; elseif (z <= -4.4e-192) tmp = x; elseif (z <= -3.2e-267) tmp = Float64(-Float64(Float64(x * y) / t)); elseif (z <= 4.4e+16) 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.8e+48) tmp = t_1; elseif (z <= -4.4e-192) tmp = x; elseif (z <= -3.2e-267) tmp = -((x * y) / t); elseif (z <= 4.4e+16) 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, -1.8e+48], t$95$1, If[LessEqual[z, -4.4e-192], x, If[LessEqual[z, -3.2e-267], (-N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision]), If[LessEqual[z, 4.4e+16], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-192}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-267}:\\
\;\;\;\;-\frac{x \cdot y}{t}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.79999999999999992e48 or 4.4e16 < z Initial program 92.5%
Taylor expanded in y around -inf 71.3%
Taylor expanded in z around inf 63.6%
associate-*l/68.2%
Applied egg-rr68.2%
if -1.79999999999999992e48 < z < -4.40000000000000011e-192 or -3.19999999999999986e-267 < z < 4.4e16Initial program 94.4%
Taylor expanded in y around 0 58.0%
if -4.40000000000000011e-192 < z < -3.19999999999999986e-267Initial program 99.7%
Taylor expanded in y around -inf 68.3%
Taylor expanded in z around 0 64.9%
mul-1-neg64.9%
distribute-lft-neg-out64.9%
*-commutative64.9%
Simplified64.9%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.02e+93) (not (<= z 1.28e+64))) (* z (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.02e+93) || !(z <= 1.28e+64)) {
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.02d+93)) .or. (.not. (z <= 1.28d+64))) 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.02e+93) || !(z <= 1.28e+64)) {
tmp = z * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.02e+93) or not (z <= 1.28e+64): 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.02e+93) || !(z <= 1.28e+64)) 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.02e+93) || ~((z <= 1.28e+64))) 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.02e+93], N[Not[LessEqual[z, 1.28e+64]], $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.02 \cdot 10^{+93} \lor \neg \left(z \leq 1.28 \cdot 10^{+64}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.01999999999999998e93 or 1.28000000000000004e64 < z Initial program 91.1%
Taylor expanded in y around -inf 70.6%
Taylor expanded in z around inf 65.7%
associate-*l/71.2%
Applied egg-rr71.2%
if -2.01999999999999998e93 < z < 1.28000000000000004e64Initial program 95.7%
Taylor expanded in x around inf 81.0%
mul-1-neg81.0%
unsub-neg81.0%
Simplified81.0%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5e-5) (not (<= y 1.1e-6))) (* y (/ (- z x) t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e-5) || !(y <= 1.1e-6)) {
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 ((y <= (-5d-5)) .or. (.not. (y <= 1.1d-6))) 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 ((y <= -5e-5) || !(y <= 1.1e-6)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5e-5) or not (y <= 1.1e-6): tmp = y * ((z - x) / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5e-5) || !(y <= 1.1e-6)) 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 ((y <= -5e-5) || ~((y <= 1.1e-6))) 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[y, -5e-5], N[Not[LessEqual[y, 1.1e-6]], $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}\;y \leq -5 \cdot 10^{-5} \lor \neg \left(y \leq 1.1 \cdot 10^{-6}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -5.00000000000000024e-5 or 1.1000000000000001e-6 < y Initial program 87.9%
Taylor expanded in y around -inf 76.2%
associate-/l*81.6%
*-commutative81.6%
Applied egg-rr81.6%
if -5.00000000000000024e-5 < y < 1.1000000000000001e-6Initial program 99.8%
Taylor expanded in x around inf 75.8%
mul-1-neg75.8%
unsub-neg75.8%
Simplified75.8%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.1e-36) (not (<= z 7.5e-168))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e-36) || !(z <= 7.5e-168)) {
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 <= (-2.1d-36)) .or. (.not. (z <= 7.5d-168))) 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 <= -2.1e-36) || !(z <= 7.5e-168)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.1e-36) or not (z <= 7.5e-168): 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 <= -2.1e-36) || !(z <= 7.5e-168)) 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 <= -2.1e-36) || ~((z <= 7.5e-168))) 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, -2.1e-36], N[Not[LessEqual[z, 7.5e-168]], $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 -2.1 \cdot 10^{-36} \lor \neg \left(z \leq 7.5 \cdot 10^{-168}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.09999999999999991e-36 or 7.4999999999999995e-168 < z Initial program 92.4%
Taylor expanded in z around inf 85.0%
associate-/l*54.5%
Simplified84.5%
if -2.09999999999999991e-36 < z < 7.4999999999999995e-168Initial program 96.7%
Taylor expanded in x around inf 91.2%
mul-1-neg91.2%
unsub-neg91.2%
Simplified91.2%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e-109) (not (<= z 2.25e-166))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-109) || !(z <= 2.25e-166)) {
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 <= (-8.5d-109)) .or. (.not. (z <= 2.25d-166))) 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 <= -8.5e-109) || !(z <= 2.25e-166)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e-109) or not (z <= 2.25e-166): 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 <= -8.5e-109) || !(z <= 2.25e-166)) 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 <= -8.5e-109) || ~((z <= 2.25e-166))) 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, -8.5e-109], N[Not[LessEqual[z, 2.25e-166]], $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 -8.5 \cdot 10^{-109} \lor \neg \left(z \leq 2.25 \cdot 10^{-166}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -8.50000000000000005e-109 or 2.2499999999999999e-166 < z Initial program 93.1%
Taylor expanded in z around inf 84.4%
associate-/l*51.9%
Simplified83.4%
clear-num83.4%
un-div-inv83.8%
Applied egg-rr83.8%
associate-/r/87.5%
Applied egg-rr87.5%
if -8.50000000000000005e-109 < z < 2.2499999999999999e-166Initial program 96.0%
Taylor expanded in x around inf 94.4%
mul-1-neg94.4%
unsub-neg94.4%
Simplified94.4%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.6e-108) (not (<= z 1.4e-166))) (+ x (/ z (/ t y))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e-108) || !(z <= 1.4e-166)) {
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 <= (-2.6d-108)) .or. (.not. (z <= 1.4d-166))) 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 <= -2.6e-108) || !(z <= 1.4e-166)) {
tmp = x + (z / (t / y));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.6e-108) or not (z <= 1.4e-166): 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 <= -2.6e-108) || !(z <= 1.4e-166)) 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 <= -2.6e-108) || ~((z <= 1.4e-166))) 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, -2.6e-108], N[Not[LessEqual[z, 1.4e-166]], $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 -2.6 \cdot 10^{-108} \lor \neg \left(z \leq 1.4 \cdot 10^{-166}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.59999999999999984e-108 or 1.4e-166 < z Initial program 93.1%
Taylor expanded in z around inf 84.4%
associate-/l*51.9%
Simplified83.4%
clear-num83.4%
un-div-inv83.8%
Applied egg-rr83.8%
associate-/r/87.5%
Applied egg-rr87.5%
*-commutative87.5%
clear-num87.5%
un-div-inv88.0%
Applied egg-rr88.0%
if -2.59999999999999984e-108 < z < 1.4e-166Initial program 96.0%
Taylor expanded in x around inf 94.4%
mul-1-neg94.4%
unsub-neg94.4%
Simplified94.4%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.45e+49) (not (<= z 3e+16))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.45e+49) || !(z <= 3e+16)) {
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 <= (-4.45d+49)) .or. (.not. (z <= 3d+16))) 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 <= -4.45e+49) || !(z <= 3e+16)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.45e+49) or not (z <= 3e+16): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.45e+49) || !(z <= 3e+16)) 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 <= -4.45e+49) || ~((z <= 3e+16))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.45e+49], N[Not[LessEqual[z, 3e+16]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.45 \cdot 10^{+49} \lor \neg \left(z \leq 3 \cdot 10^{+16}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.45e49 or 3e16 < z Initial program 92.5%
Taylor expanded in y around -inf 71.3%
Taylor expanded in z around inf 63.6%
associate-/l*64.2%
Simplified64.2%
if -4.45e49 < z < 3e16Initial program 95.1%
Taylor expanded in y around 0 54.8%
Final simplification59.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e+48) (not (<= z 6.5e+15))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e+48) || !(z <= 6.5e+15)) {
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 <= (-9.2d+48)) .or. (.not. (z <= 6.5d+15))) 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 <= -9.2e+48) || !(z <= 6.5e+15)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e+48) or not (z <= 6.5e+15): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e+48) || !(z <= 6.5e+15)) 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 ((z <= -9.2e+48) || ~((z <= 6.5e+15))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e+48], N[Not[LessEqual[z, 6.5e+15]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+48} \lor \neg \left(z \leq 6.5 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.2000000000000001e48 or 6.5e15 < z Initial program 92.5%
Taylor expanded in y around -inf 71.3%
Taylor expanded in z around inf 63.6%
associate-*l/68.2%
Applied egg-rr68.2%
if -9.2000000000000001e48 < z < 6.5e15Initial program 95.1%
Taylor expanded in y around 0 54.8%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 88.8%
+-commutative88.8%
*-commutative88.8%
associate-*r/86.5%
mul-1-neg86.5%
associate-/l*89.4%
distribute-lft-neg-in89.4%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
Final simplification97.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 93.9%
Taylor expanded in y around 0 40.5%
Final simplification40.5%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024078
(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)))