
(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.5%
+-commutative93.5%
associate-/l*90.7%
fma-define90.7%
Simplified90.7%
fma-undefine90.7%
associate-/l*93.5%
*-commutative93.5%
associate-/l*99.5%
Applied egg-rr99.5%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))) (t_2 (* y (/ (- z x) t))))
(if (<= y -1.45e+41)
t_2
(if (<= y -6.2e-159)
t_1
(if (<= y -4.8e-231)
(* (* z y) (/ 1.0 t))
(if (<= y 8e-47) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double t_2 = y * ((z - x) / t);
double tmp;
if (y <= -1.45e+41) {
tmp = t_2;
} else if (y <= -6.2e-159) {
tmp = t_1;
} else if (y <= -4.8e-231) {
tmp = (z * y) * (1.0 / t);
} else if (y <= 8e-47) {
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 = x * (1.0d0 - (y / t))
t_2 = y * ((z - x) / t)
if (y <= (-1.45d+41)) then
tmp = t_2
else if (y <= (-6.2d-159)) then
tmp = t_1
else if (y <= (-4.8d-231)) then
tmp = (z * y) * (1.0d0 / t)
else if (y <= 8d-47) 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 = x * (1.0 - (y / t));
double t_2 = y * ((z - x) / t);
double tmp;
if (y <= -1.45e+41) {
tmp = t_2;
} else if (y <= -6.2e-159) {
tmp = t_1;
} else if (y <= -4.8e-231) {
tmp = (z * y) * (1.0 / t);
} else if (y <= 8e-47) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) t_2 = y * ((z - x) / t) tmp = 0 if y <= -1.45e+41: tmp = t_2 elif y <= -6.2e-159: tmp = t_1 elif y <= -4.8e-231: tmp = (z * y) * (1.0 / t) elif y <= 8e-47: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) t_2 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -1.45e+41) tmp = t_2; elseif (y <= -6.2e-159) tmp = t_1; elseif (y <= -4.8e-231) tmp = Float64(Float64(z * y) * Float64(1.0 / t)); elseif (y <= 8e-47) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); t_2 = y * ((z - x) / t); tmp = 0.0; if (y <= -1.45e+41) tmp = t_2; elseif (y <= -6.2e-159) tmp = t_1; elseif (y <= -4.8e-231) tmp = (z * y) * (1.0 / t); elseif (y <= 8e-47) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e+41], t$95$2, If[LessEqual[y, -6.2e-159], t$95$1, If[LessEqual[y, -4.8e-231], N[(N[(z * y), $MachinePrecision] * N[(1.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-47], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
t_2 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+41}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-231}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \frac{1}{t}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.44999999999999994e41 or 7.9999999999999998e-47 < y Initial program 87.1%
+-commutative87.1%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in y around inf 80.1%
div-sub82.5%
Simplified82.5%
if -1.44999999999999994e41 < y < -6.2e-159 or -4.79999999999999983e-231 < y < 7.9999999999999998e-47Initial program 99.9%
+-commutative99.9%
associate-/l*88.5%
fma-define88.5%
Simplified88.5%
Taylor expanded in z around 0 78.8%
*-rgt-identity78.8%
mul-1-neg78.8%
associate-/l*78.8%
distribute-rgt-neg-in78.8%
mul-1-neg78.8%
distribute-lft-in78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
if -6.2e-159 < y < -4.79999999999999983e-231Initial program 99.6%
+-commutative99.6%
associate-/l*56.6%
fma-define56.6%
Simplified56.6%
Taylor expanded in z around inf 74.0%
clear-num73.9%
associate-/r/74.1%
Applied egg-rr74.1%
Final simplification80.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))) (t_2 (* y (/ (- z x) t))))
(if (<= y -1.4e+41)
t_2
(if (<= y -6.2e-159)
t_1
(if (<= y -4.8e-231) (/ (* z y) t) (if (<= y 2.15e-47) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double t_2 = y * ((z - x) / t);
double tmp;
if (y <= -1.4e+41) {
tmp = t_2;
} else if (y <= -6.2e-159) {
tmp = t_1;
} else if (y <= -4.8e-231) {
tmp = (z * y) / t;
} else if (y <= 2.15e-47) {
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 = x * (1.0d0 - (y / t))
t_2 = y * ((z - x) / t)
if (y <= (-1.4d+41)) then
tmp = t_2
else if (y <= (-6.2d-159)) then
tmp = t_1
else if (y <= (-4.8d-231)) then
tmp = (z * y) / t
else if (y <= 2.15d-47) 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 = x * (1.0 - (y / t));
double t_2 = y * ((z - x) / t);
double tmp;
if (y <= -1.4e+41) {
tmp = t_2;
} else if (y <= -6.2e-159) {
tmp = t_1;
} else if (y <= -4.8e-231) {
tmp = (z * y) / t;
} else if (y <= 2.15e-47) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) t_2 = y * ((z - x) / t) tmp = 0 if y <= -1.4e+41: tmp = t_2 elif y <= -6.2e-159: tmp = t_1 elif y <= -4.8e-231: tmp = (z * y) / t elif y <= 2.15e-47: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) t_2 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -1.4e+41) tmp = t_2; elseif (y <= -6.2e-159) tmp = t_1; elseif (y <= -4.8e-231) tmp = Float64(Float64(z * y) / t); elseif (y <= 2.15e-47) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); t_2 = y * ((z - x) / t); tmp = 0.0; if (y <= -1.4e+41) tmp = t_2; elseif (y <= -6.2e-159) tmp = t_1; elseif (y <= -4.8e-231) tmp = (z * y) / t; elseif (y <= 2.15e-47) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.4e+41], t$95$2, If[LessEqual[y, -6.2e-159], t$95$1, If[LessEqual[y, -4.8e-231], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 2.15e-47], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
t_2 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{+41}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-231}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.4e41 or 2.1499999999999999e-47 < y Initial program 87.1%
+-commutative87.1%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in y around inf 80.1%
div-sub82.5%
Simplified82.5%
if -1.4e41 < y < -6.2e-159 or -4.79999999999999983e-231 < y < 2.1499999999999999e-47Initial program 99.9%
+-commutative99.9%
associate-/l*88.5%
fma-define88.5%
Simplified88.5%
Taylor expanded in z around 0 78.8%
*-rgt-identity78.8%
mul-1-neg78.8%
associate-/l*78.8%
distribute-rgt-neg-in78.8%
mul-1-neg78.8%
distribute-lft-in78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
if -6.2e-159 < y < -4.79999999999999983e-231Initial program 99.6%
+-commutative99.6%
associate-/l*56.6%
fma-define56.6%
Simplified56.6%
Taylor expanded in z around inf 74.0%
Final simplification80.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -4.1e+40)
(* z (/ y t))
(if (<= y -6.2e-159)
x
(if (<= y -4.3e-231) (/ (* z y) t) (if (<= y 1.3e-46) x (/ z (/ t y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e+40) {
tmp = z * (y / t);
} else if (y <= -6.2e-159) {
tmp = x;
} else if (y <= -4.3e-231) {
tmp = (z * y) / t;
} else if (y <= 1.3e-46) {
tmp = x;
} else {
tmp = 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 (y <= (-4.1d+40)) then
tmp = z * (y / t)
else if (y <= (-6.2d-159)) then
tmp = x
else if (y <= (-4.3d-231)) then
tmp = (z * y) / t
else if (y <= 1.3d-46) then
tmp = x
else
tmp = z / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e+40) {
tmp = z * (y / t);
} else if (y <= -6.2e-159) {
tmp = x;
} else if (y <= -4.3e-231) {
tmp = (z * y) / t;
} else if (y <= 1.3e-46) {
tmp = x;
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.1e+40: tmp = z * (y / t) elif y <= -6.2e-159: tmp = x elif y <= -4.3e-231: tmp = (z * y) / t elif y <= 1.3e-46: tmp = x else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.1e+40) tmp = Float64(z * Float64(y / t)); elseif (y <= -6.2e-159) tmp = x; elseif (y <= -4.3e-231) tmp = Float64(Float64(z * y) / t); elseif (y <= 1.3e-46) tmp = x; else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.1e+40) tmp = z * (y / t); elseif (y <= -6.2e-159) tmp = x; elseif (y <= -4.3e-231) tmp = (z * y) / t; elseif (y <= 1.3e-46) tmp = x; else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.1e+40], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.2e-159], x, If[LessEqual[y, -4.3e-231], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 1.3e-46], x, N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-159}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{-231}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if y < -4.1000000000000002e40Initial program 82.6%
+-commutative82.6%
associate-/l*98.1%
fma-define98.1%
Simplified98.1%
Taylor expanded in z around inf 53.2%
*-commutative53.2%
associate-*r/64.6%
Simplified64.6%
if -4.1000000000000002e40 < y < -6.2e-159 or -4.29999999999999998e-231 < y < 1.3000000000000001e-46Initial program 99.9%
+-commutative99.9%
associate-/l*88.5%
fma-define88.5%
Simplified88.5%
Taylor expanded in y around 0 65.3%
if -6.2e-159 < y < -4.29999999999999998e-231Initial program 99.6%
+-commutative99.6%
associate-/l*56.6%
fma-define56.6%
Simplified56.6%
Taylor expanded in z around inf 74.0%
if 1.3000000000000001e-46 < y Initial program 90.5%
+-commutative90.5%
associate-/l*94.8%
fma-define94.8%
Simplified94.8%
Taylor expanded in y around inf 91.3%
associate--l+91.3%
div-sub92.7%
Simplified92.7%
Taylor expanded in z around inf 60.1%
Taylor expanded in y around inf 45.9%
associate-*r/46.7%
*-commutative46.7%
associate-/r/49.9%
Simplified49.9%
Final simplification61.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.5e+149) (not (<= t 5e+89))) (+ x (* z (/ y t))) (+ x (/ (* (- z x) y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.5e+149) || !(t <= 5e+89)) {
tmp = x + (z * (y / t));
} else {
tmp = x + (((z - x) * y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5.5d+149)) .or. (.not. (t <= 5d+89))) then
tmp = x + (z * (y / t))
else
tmp = x + (((z - x) * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.5e+149) || !(t <= 5e+89)) {
tmp = x + (z * (y / t));
} else {
tmp = x + (((z - x) * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.5e+149) or not (t <= 5e+89): tmp = x + (z * (y / t)) else: tmp = x + (((z - x) * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.5e+149) || !(t <= 5e+89)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x + Float64(Float64(Float64(z - x) * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.5e+149) || ~((t <= 5e+89))) tmp = x + (z * (y / t)); else tmp = x + (((z - x) * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.5e+149], N[Not[LessEqual[t, 5e+89]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+149} \lor \neg \left(t \leq 5 \cdot 10^{+89}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(z - x\right) \cdot y}{t}\\
\end{array}
\end{array}
if t < -5.49999999999999999e149 or 4.99999999999999983e89 < t Initial program 82.8%
+-commutative82.8%
associate-/l*97.1%
fma-define97.1%
Simplified97.1%
fma-undefine97.1%
associate-/l*82.8%
*-commutative82.8%
associate-/l*98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 94.7%
if -5.49999999999999999e149 < t < 4.99999999999999983e89Initial program 98.8%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.6e+95) (not (<= x 1.95e-19))) (- x (/ x (/ t y))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.6e+95) || !(x <= 1.95e-19)) {
tmp = x - (x / (t / y));
} 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 ((x <= (-6.6d+95)) .or. (.not. (x <= 1.95d-19))) then
tmp = x - (x / (t / y))
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 ((x <= -6.6e+95) || !(x <= 1.95e-19)) {
tmp = x - (x / (t / y));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.6e+95) or not (x <= 1.95e-19): tmp = x - (x / (t / y)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.6e+95) || !(x <= 1.95e-19)) tmp = Float64(x - Float64(x / Float64(t / y))); 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 ((x <= -6.6e+95) || ~((x <= 1.95e-19))) tmp = x - (x / (t / y)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.6e+95], N[Not[LessEqual[x, 1.95e-19]], $MachinePrecision]], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{+95} \lor \neg \left(x \leq 1.95 \cdot 10^{-19}\right):\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -6.5999999999999997e95 or 1.94999999999999998e-19 < x Initial program 90.7%
+-commutative90.7%
associate-/l*88.2%
fma-define88.2%
Simplified88.2%
fma-undefine88.2%
associate-/l*90.7%
*-commutative90.7%
associate-/l*99.9%
Applied egg-rr99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 89.5%
neg-mul-189.5%
Simplified89.5%
if -6.5999999999999997e95 < x < 1.94999999999999998e-19Initial program 95.5%
+-commutative95.5%
associate-/l*92.4%
fma-define92.4%
Simplified92.4%
fma-undefine92.4%
associate-/l*95.5%
*-commutative95.5%
associate-/l*99.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 90.4%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9e+95) (not (<= x 7.5e-21))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e+95) || !(x <= 7.5e-21)) {
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 ((x <= (-9d+95)) .or. (.not. (x <= 7.5d-21))) 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 ((x <= -9e+95) || !(x <= 7.5e-21)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9e+95) or not (x <= 7.5e-21): tmp = x * (1.0 - (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9e+95) || !(x <= 7.5e-21)) tmp = Float64(x * Float64(1.0 - Float64(y / 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 ((x <= -9e+95) || ~((x <= 7.5e-21))) tmp = x * (1.0 - (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9e+95], N[Not[LessEqual[x, 7.5e-21]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+95} \lor \neg \left(x \leq 7.5 \cdot 10^{-21}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -9.00000000000000033e95 or 7.50000000000000072e-21 < x Initial program 90.7%
+-commutative90.7%
associate-/l*88.2%
fma-define88.2%
Simplified88.2%
Taylor expanded in z around 0 81.3%
*-rgt-identity81.3%
mul-1-neg81.3%
associate-/l*89.5%
distribute-rgt-neg-in89.5%
mul-1-neg89.5%
distribute-lft-in89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -9.00000000000000033e95 < x < 7.50000000000000072e-21Initial program 95.5%
+-commutative95.5%
associate-/l*92.4%
fma-define92.4%
Simplified92.4%
fma-undefine92.4%
associate-/l*95.5%
*-commutative95.5%
associate-/l*99.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 90.4%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.6e+94) (not (<= x 1.95e-19))) (* x (- 1.0 (/ y t))) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e+94) || !(x <= 1.95e-19)) {
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 ((x <= (-3.6d+94)) .or. (.not. (x <= 1.95d-19))) 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 ((x <= -3.6e+94) || !(x <= 1.95e-19)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.6e+94) or not (x <= 1.95e-19): tmp = x * (1.0 - (y / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.6e+94) || !(x <= 1.95e-19)) 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 ((x <= -3.6e+94) || ~((x <= 1.95e-19))) tmp = x * (1.0 - (y / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.6e+94], N[Not[LessEqual[x, 1.95e-19]], $MachinePrecision]], 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}\;x \leq -3.6 \cdot 10^{+94} \lor \neg \left(x \leq 1.95 \cdot 10^{-19}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if x < -3.59999999999999992e94 or 1.94999999999999998e-19 < x Initial program 90.7%
+-commutative90.7%
associate-/l*88.2%
fma-define88.2%
Simplified88.2%
Taylor expanded in z around 0 81.3%
*-rgt-identity81.3%
mul-1-neg81.3%
associate-/l*89.5%
distribute-rgt-neg-in89.5%
mul-1-neg89.5%
distribute-lft-in89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -3.59999999999999992e94 < x < 1.94999999999999998e-19Initial program 95.5%
Taylor expanded in z around inf 86.1%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (<= z -4.4e+89) (* z (/ y t)) (if (<= z 110.0) (* x (- 1.0 (/ y t))) (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.4e+89) {
tmp = z * (y / t);
} else if (z <= 110.0) {
tmp = x * (1.0 - (y / t));
} else {
tmp = 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 <= (-4.4d+89)) then
tmp = z * (y / t)
else if (z <= 110.0d0) then
tmp = x * (1.0d0 - (y / t))
else
tmp = 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 <= -4.4e+89) {
tmp = z * (y / t);
} else if (z <= 110.0) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.4e+89: tmp = z * (y / t) elif z <= 110.0: tmp = x * (1.0 - (y / t)) else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.4e+89) tmp = Float64(z * Float64(y / t)); elseif (z <= 110.0) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.4e+89) tmp = z * (y / t); elseif (z <= 110.0) tmp = x * (1.0 - (y / t)); else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.4e+89], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 110.0], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+89}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 110:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -4.4e89Initial program 85.8%
+-commutative85.8%
associate-/l*90.6%
fma-define90.5%
Simplified90.5%
Taylor expanded in z around inf 57.2%
*-commutative57.2%
associate-*r/64.3%
Simplified64.3%
if -4.4e89 < z < 110Initial program 95.6%
+-commutative95.6%
associate-/l*92.2%
fma-define92.2%
Simplified92.2%
Taylor expanded in z around 0 81.7%
*-rgt-identity81.7%
mul-1-neg81.7%
associate-/l*86.6%
distribute-rgt-neg-in86.6%
mul-1-neg86.6%
distribute-lft-in86.6%
mul-1-neg86.6%
unsub-neg86.6%
Simplified86.6%
if 110 < z Initial program 96.6%
+-commutative96.6%
associate-/l*87.4%
fma-define87.4%
Simplified87.4%
Taylor expanded in y around inf 79.1%
associate--l+79.1%
div-sub82.6%
Simplified82.6%
Taylor expanded in z around inf 76.4%
Taylor expanded in y around inf 65.5%
associate-*r/58.5%
*-commutative58.5%
associate-/r/68.6%
Simplified68.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.1e+40) (not (<= y 8.8e-47))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.1e+40) || !(y <= 8.8e-47)) {
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 <= (-4.1d+40)) .or. (.not. (y <= 8.8d-47))) 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 <= -4.1e+40) || !(y <= 8.8e-47)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.1e+40) or not (y <= 8.8e-47): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.1e+40) || !(y <= 8.8e-47)) 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 <= -4.1e+40) || ~((y <= 8.8e-47))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.1e+40], N[Not[LessEqual[y, 8.8e-47]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+40} \lor \neg \left(y \leq 8.8 \cdot 10^{-47}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.1000000000000002e40 or 8.80000000000000075e-47 < y Initial program 87.1%
+-commutative87.1%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in z around inf 49.1%
associate-/l*53.4%
Simplified53.4%
if -4.1000000000000002e40 < y < 8.80000000000000075e-47Initial program 99.9%
+-commutative99.9%
associate-/l*85.3%
fma-define85.3%
Simplified85.3%
Taylor expanded in y around 0 60.7%
Final simplification57.0%
(FPCore (x y z t) :precision binary64 (if (<= t -5e+160) x (if (<= t 6e-66) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5e+160) {
tmp = x;
} else if (t <= 6e-66) {
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 (t <= (-5d+160)) then
tmp = x
else if (t <= 6d-66) 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 (t <= -5e+160) {
tmp = x;
} else if (t <= 6e-66) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5e+160: tmp = x elif t <= 6e-66: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5e+160) tmp = x; elseif (t <= 6e-66) 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 (t <= -5e+160) tmp = x; elseif (t <= 6e-66) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5e+160], x, If[LessEqual[t, 6e-66], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+160}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-66}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.0000000000000002e160 or 6.0000000000000004e-66 < t Initial program 87.1%
+-commutative87.1%
associate-/l*95.4%
fma-define95.4%
Simplified95.4%
Taylor expanded in y around 0 64.1%
if -5.0000000000000002e160 < t < 6.0000000000000004e-66Initial program 98.0%
+-commutative98.0%
associate-/l*87.4%
fma-define87.4%
Simplified87.4%
Taylor expanded in z around inf 51.5%
*-commutative51.5%
associate-*r/53.4%
Simplified53.4%
(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.5%
+-commutative93.5%
associate-/l*90.7%
fma-define90.7%
Simplified90.7%
fma-undefine90.7%
associate-/l*93.5%
*-commutative93.5%
associate-/l*99.5%
Applied egg-rr99.5%
Final simplification99.5%
(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.5%
+-commutative93.5%
associate-/l*90.7%
fma-define90.7%
Simplified90.7%
Taylor expanded in y around 0 38.2%
(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 2024111
(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)))