
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a))) (if (or (<= t_1 -5e+120) (not (<= t_1 4e+91))) t_1 (+ x (* z (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if ((t_1 <= -5e+120) || !(t_1 <= 4e+91)) {
tmp = t_1;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / a
if ((t_1 <= (-5d+120)) .or. (.not. (t_1 <= 4d+91))) then
tmp = t_1
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if ((t_1 <= -5e+120) || !(t_1 <= 4e+91)) {
tmp = t_1;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a tmp = 0 if (t_1 <= -5e+120) or not (t_1 <= 4e+91): tmp = t_1 else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) tmp = 0.0 if ((t_1 <= -5e+120) || !(t_1 <= 4e+91)) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; tmp = 0.0; if ((t_1 <= -5e+120) || ~((t_1 <= 4e+91))) tmp = t_1; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+120], N[Not[LessEqual[t$95$1, 4e+91]], $MachinePrecision]], t$95$1, N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+120} \lor \neg \left(t_1 \leq 4 \cdot 10^{+91}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -5.00000000000000019e120 or 4.00000000000000032e91 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 99.9%
Taylor expanded in x around 0 93.8%
if -5.00000000000000019e120 < (/.f64 (*.f64 y (-.f64 z t)) a) < 4.00000000000000032e91Initial program 97.7%
Taylor expanded in t around 0 85.3%
associate-*l/85.8%
*-commutative85.8%
Simplified85.8%
Final simplification91.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t))) (t_2 (/ (* y z) a)))
(if (<= z -3.6e-12)
t_2
(if (<= z 6.2e-282)
t_1
(if (<= z 1.05e-254) x (if (<= z 6e-16) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * -t;
double t_2 = (y * z) / a;
double tmp;
if (z <= -3.6e-12) {
tmp = t_2;
} else if (z <= 6.2e-282) {
tmp = t_1;
} else if (z <= 1.05e-254) {
tmp = x;
} else if (z <= 6e-16) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y / a) * -t
t_2 = (y * z) / a
if (z <= (-3.6d-12)) then
tmp = t_2
else if (z <= 6.2d-282) then
tmp = t_1
else if (z <= 1.05d-254) then
tmp = x
else if (z <= 6d-16) 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 a) {
double t_1 = (y / a) * -t;
double t_2 = (y * z) / a;
double tmp;
if (z <= -3.6e-12) {
tmp = t_2;
} else if (z <= 6.2e-282) {
tmp = t_1;
} else if (z <= 1.05e-254) {
tmp = x;
} else if (z <= 6e-16) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * -t t_2 = (y * z) / a tmp = 0 if z <= -3.6e-12: tmp = t_2 elif z <= 6.2e-282: tmp = t_1 elif z <= 1.05e-254: tmp = x elif z <= 6e-16: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(-t)) t_2 = Float64(Float64(y * z) / a) tmp = 0.0 if (z <= -3.6e-12) tmp = t_2; elseif (z <= 6.2e-282) tmp = t_1; elseif (z <= 1.05e-254) tmp = x; elseif (z <= 6e-16) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * -t; t_2 = (y * z) / a; tmp = 0.0; if (z <= -3.6e-12) tmp = t_2; elseif (z <= 6.2e-282) tmp = t_1; elseif (z <= 1.05e-254) tmp = x; elseif (z <= 6e-16) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -3.6e-12], t$95$2, If[LessEqual[z, 6.2e-282], t$95$1, If[LessEqual[z, 1.05e-254], x, If[LessEqual[z, 6e-16], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(-t\right)\\
t_2 := \frac{y \cdot z}{a}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-12}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-282}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-254}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.6e-12 or 5.99999999999999987e-16 < z Initial program 99.8%
Taylor expanded in y around inf 67.1%
Taylor expanded in z around inf 63.0%
associate-*l/71.7%
Applied egg-rr71.7%
if -3.6e-12 < z < 6.20000000000000027e-282 or 1.04999999999999998e-254 < z < 5.99999999999999987e-16Initial program 98.5%
Taylor expanded in y around inf 68.1%
Taylor expanded in z around 0 68.1%
neg-mul-168.1%
+-commutative68.1%
sub-neg68.1%
div-sub68.1%
Simplified68.1%
associate-/r/71.8%
Applied egg-rr71.8%
Taylor expanded in z around 0 64.0%
mul-1-neg64.0%
associate-*l/63.9%
distribute-rgt-neg-in63.9%
Simplified63.9%
if 6.20000000000000027e-282 < z < 1.04999999999999998e-254Initial program 99.7%
Taylor expanded in x around inf 83.4%
Final simplification68.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y z) a)))
(if (<= z -2.8e-12)
t_1
(if (<= z 2.05e-283)
(* (/ y a) (- t))
(if (<= z 2.55e-256) x (if (<= z 2.25e-17) (/ (* y t) (- a)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * z) / a;
double tmp;
if (z <= -2.8e-12) {
tmp = t_1;
} else if (z <= 2.05e-283) {
tmp = (y / a) * -t;
} else if (z <= 2.55e-256) {
tmp = x;
} else if (z <= 2.25e-17) {
tmp = (y * t) / -a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y * z) / a
if (z <= (-2.8d-12)) then
tmp = t_1
else if (z <= 2.05d-283) then
tmp = (y / a) * -t
else if (z <= 2.55d-256) then
tmp = x
else if (z <= 2.25d-17) then
tmp = (y * t) / -a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * z) / a;
double tmp;
if (z <= -2.8e-12) {
tmp = t_1;
} else if (z <= 2.05e-283) {
tmp = (y / a) * -t;
} else if (z <= 2.55e-256) {
tmp = x;
} else if (z <= 2.25e-17) {
tmp = (y * t) / -a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * z) / a tmp = 0 if z <= -2.8e-12: tmp = t_1 elif z <= 2.05e-283: tmp = (y / a) * -t elif z <= 2.55e-256: tmp = x elif z <= 2.25e-17: tmp = (y * t) / -a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * z) / a) tmp = 0.0 if (z <= -2.8e-12) tmp = t_1; elseif (z <= 2.05e-283) tmp = Float64(Float64(y / a) * Float64(-t)); elseif (z <= 2.55e-256) tmp = x; elseif (z <= 2.25e-17) tmp = Float64(Float64(y * t) / Float64(-a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * z) / a; tmp = 0.0; if (z <= -2.8e-12) tmp = t_1; elseif (z <= 2.05e-283) tmp = (y / a) * -t; elseif (z <= 2.55e-256) tmp = x; elseif (z <= 2.25e-17) tmp = (y * t) / -a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -2.8e-12], t$95$1, If[LessEqual[z, 2.05e-283], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 2.55e-256], x, If[LessEqual[z, 2.25e-17], N[(N[(y * t), $MachinePrecision] / (-a)), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{a}\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-283}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-256}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-17}:\\
\;\;\;\;\frac{y \cdot t}{-a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.8000000000000002e-12 or 2.24999999999999989e-17 < z Initial program 99.8%
Taylor expanded in y around inf 67.1%
Taylor expanded in z around inf 63.0%
associate-*l/71.7%
Applied egg-rr71.7%
if -2.8000000000000002e-12 < z < 2.04999999999999993e-283Initial program 98.4%
Taylor expanded in y around inf 61.9%
Taylor expanded in z around 0 61.9%
neg-mul-161.9%
+-commutative61.9%
sub-neg61.9%
div-sub61.9%
Simplified61.9%
associate-/r/66.6%
Applied egg-rr66.6%
Taylor expanded in z around 0 58.9%
mul-1-neg58.9%
associate-*l/59.1%
distribute-rgt-neg-in59.1%
Simplified59.1%
if 2.04999999999999993e-283 < z < 2.55000000000000005e-256Initial program 99.7%
Taylor expanded in x around inf 83.4%
if 2.55000000000000005e-256 < z < 2.24999999999999989e-17Initial program 98.6%
Taylor expanded in y around inf 75.1%
Taylor expanded in z around 0 65.8%
neg-mul-165.8%
distribute-neg-frac65.8%
Simplified65.8%
frac-2neg65.8%
remove-double-neg65.8%
associate-*l/69.7%
Applied egg-rr69.7%
Final simplification68.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -7.2e-141) (not (<= y 1e-118))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.2e-141) || !(y <= 1e-118)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-7.2d-141)) .or. (.not. (y <= 1d-118))) then
tmp = y * ((z - t) / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.2e-141) || !(y <= 1e-118)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -7.2e-141) or not (y <= 1e-118): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -7.2e-141) || !(y <= 1e-118)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -7.2e-141) || ~((y <= 1e-118))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -7.2e-141], N[Not[LessEqual[y, 1e-118]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-141} \lor \neg \left(y \leq 10^{-118}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.2000000000000003e-141 or 9.99999999999999985e-119 < y Initial program 99.9%
Taylor expanded in y around inf 86.8%
Taylor expanded in z around 0 86.8%
neg-mul-186.8%
+-commutative86.8%
sub-neg86.8%
div-sub89.1%
Simplified89.1%
if -7.2000000000000003e-141 < y < 9.99999999999999985e-119Initial program 97.7%
Taylor expanded in x around inf 49.0%
Final simplification76.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5.5e-140) (not (<= y 7.8e-117))) (* y (/ (- z t) a)) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.5e-140) || !(y <= 7.8e-117)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-5.5d-140)) .or. (.not. (y <= 7.8d-117))) then
tmp = y * ((z - t) / a)
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.5e-140) || !(y <= 7.8e-117)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5.5e-140) or not (y <= 7.8e-117): tmp = y * ((z - t) / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.5e-140) || !(y <= 7.8e-117)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -5.5e-140) || ~((y <= 7.8e-117))) tmp = y * ((z - t) / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.5e-140], N[Not[LessEqual[y, 7.8e-117]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 7.8 \cdot 10^{-117}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -5.50000000000000026e-140 or 7.79999999999999984e-117 < y Initial program 99.9%
Taylor expanded in y around inf 86.8%
Taylor expanded in z around 0 86.8%
neg-mul-186.8%
+-commutative86.8%
sub-neg86.8%
div-sub89.1%
Simplified89.1%
if -5.50000000000000026e-140 < y < 7.79999999999999984e-117Initial program 97.7%
Taylor expanded in t around 0 77.5%
associate-*l/78.0%
*-commutative78.0%
Simplified78.0%
Final simplification85.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.7e-5) (not (<= t 1.62e+74))) (- x (* t (/ y a))) (+ x (/ (* y z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.7e-5) || !(t <= 1.62e+74)) {
tmp = x - (t * (y / a));
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-4.7d-5)) .or. (.not. (t <= 1.62d+74))) then
tmp = x - (t * (y / a))
else
tmp = x + ((y * z) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.7e-5) || !(t <= 1.62e+74)) {
tmp = x - (t * (y / a));
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.7e-5) or not (t <= 1.62e+74): tmp = x - (t * (y / a)) else: tmp = x + ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.7e-5) || !(t <= 1.62e+74)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.7e-5) || ~((t <= 1.62e+74))) tmp = x - (t * (y / a)); else tmp = x + ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.7e-5], N[Not[LessEqual[t, 1.62e+74]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.7 \cdot 10^{-5} \lor \neg \left(t \leq 1.62 \cdot 10^{+74}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -4.69999999999999972e-5 or 1.62e74 < t Initial program 99.9%
Taylor expanded in z around 0 87.1%
+-commutative87.1%
mul-1-neg87.1%
unsub-neg87.1%
*-commutative87.1%
associate-*r/87.2%
Simplified87.2%
if -4.69999999999999972e-5 < t < 1.62e74Initial program 98.6%
Taylor expanded in t around 0 87.9%
Final simplification87.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.9e-134) (not (<= y 4.5e-47))) (* y (/ z a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.9e-134) || !(y <= 4.5e-47)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.9d-134)) .or. (.not. (y <= 4.5d-47))) then
tmp = y * (z / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.9e-134) || !(y <= 4.5e-47)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.9e-134) or not (y <= 4.5e-47): tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.9e-134) || !(y <= 4.5e-47)) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.9e-134) || ~((y <= 4.5e-47))) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.9e-134], N[Not[LessEqual[y, 4.5e-47]], $MachinePrecision]], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-134} \lor \neg \left(y \leq 4.5 \cdot 10^{-47}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.90000000000000001e-134 or 4.5e-47 < y Initial program 99.9%
Taylor expanded in y around inf 87.2%
Taylor expanded in z around inf 52.6%
if -1.90000000000000001e-134 < y < 4.5e-47Initial program 97.9%
Taylor expanded in x around inf 45.5%
Final simplification50.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.2e-12) (not (<= z 8.6e-81))) (/ (* y z) a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e-12) || !(z <= 8.6e-81)) {
tmp = (y * z) / a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-4.2d-12)) .or. (.not. (z <= 8.6d-81))) then
tmp = (y * z) / a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e-12) || !(z <= 8.6e-81)) {
tmp = (y * z) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e-12) or not (z <= 8.6e-81): tmp = (y * z) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e-12) || !(z <= 8.6e-81)) tmp = Float64(Float64(y * z) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.2e-12) || ~((z <= 8.6e-81))) tmp = (y * z) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e-12], N[Not[LessEqual[z, 8.6e-81]], $MachinePrecision]], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-12} \lor \neg \left(z \leq 8.6 \cdot 10^{-81}\right):\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.19999999999999988e-12 or 8.6000000000000006e-81 < z Initial program 99.9%
Taylor expanded in y around inf 68.5%
Taylor expanded in z around inf 60.9%
associate-*l/68.9%
Applied egg-rr68.9%
if -4.19999999999999988e-12 < z < 8.6000000000000006e-81Initial program 98.4%
Taylor expanded in x around inf 33.4%
Final simplification53.8%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 99.2%
associate-*l/98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.2%
Taylor expanded in x around inf 23.4%
Final simplification23.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023278
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))