
(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 12 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
(let* ((t_1 (* y (- z t))))
(if (<= t_1 (- INFINITY))
(+ x (* (- z t) (/ y a)))
(if (<= t_1 5e+275) (+ x (/ t_1 a)) (+ x (/ y (/ a (- z t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + ((z - t) * (y / a));
} else if (t_1 <= 5e+275) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + ((z - t) * (y / a));
} else if (t_1 <= 5e+275) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -math.inf: tmp = x + ((z - t) * (y / a)) elif t_1 <= 5e+275: tmp = x + (t_1 / a) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / a))); elseif (t_1 <= 5e+275) tmp = Float64(x + Float64(t_1 / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + ((z - t) * (y / a)); elseif (t_1 <= 5e+275) tmp = x + (t_1 / a); else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+275], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+275}:\\
\;\;\;\;x + \frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -inf.0Initial program 73.2%
associate-*l/99.9%
Simplified99.9%
if -inf.0 < (*.f64 y (-.f64 z t)) < 5.0000000000000003e275Initial program 99.9%
if 5.0000000000000003e275 < (*.f64 y (-.f64 z t)) Initial program 73.9%
associate-*l/99.9%
Simplified99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y t) (- a))))
(if (<= x -3.3e+19)
x
(if (<= x -3.9e-87)
(* (- y) (/ t a))
(if (<= x -6.6e-209)
(/ (* y z) a)
(if (<= x 4.2e-301)
t_1
(if (<= x 5.5e-229) (* y (/ z a)) (if (<= x 2.4e-55) t_1 x))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * t) / -a;
double tmp;
if (x <= -3.3e+19) {
tmp = x;
} else if (x <= -3.9e-87) {
tmp = -y * (t / a);
} else if (x <= -6.6e-209) {
tmp = (y * z) / a;
} else if (x <= 4.2e-301) {
tmp = t_1;
} else if (x <= 5.5e-229) {
tmp = y * (z / a);
} else if (x <= 2.4e-55) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y * t) / -a
if (x <= (-3.3d+19)) then
tmp = x
else if (x <= (-3.9d-87)) then
tmp = -y * (t / a)
else if (x <= (-6.6d-209)) then
tmp = (y * z) / a
else if (x <= 4.2d-301) then
tmp = t_1
else if (x <= 5.5d-229) then
tmp = y * (z / a)
else if (x <= 2.4d-55) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * t) / -a;
double tmp;
if (x <= -3.3e+19) {
tmp = x;
} else if (x <= -3.9e-87) {
tmp = -y * (t / a);
} else if (x <= -6.6e-209) {
tmp = (y * z) / a;
} else if (x <= 4.2e-301) {
tmp = t_1;
} else if (x <= 5.5e-229) {
tmp = y * (z / a);
} else if (x <= 2.4e-55) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * t) / -a tmp = 0 if x <= -3.3e+19: tmp = x elif x <= -3.9e-87: tmp = -y * (t / a) elif x <= -6.6e-209: tmp = (y * z) / a elif x <= 4.2e-301: tmp = t_1 elif x <= 5.5e-229: tmp = y * (z / a) elif x <= 2.4e-55: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * t) / Float64(-a)) tmp = 0.0 if (x <= -3.3e+19) tmp = x; elseif (x <= -3.9e-87) tmp = Float64(Float64(-y) * Float64(t / a)); elseif (x <= -6.6e-209) tmp = Float64(Float64(y * z) / a); elseif (x <= 4.2e-301) tmp = t_1; elseif (x <= 5.5e-229) tmp = Float64(y * Float64(z / a)); elseif (x <= 2.4e-55) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * t) / -a; tmp = 0.0; if (x <= -3.3e+19) tmp = x; elseif (x <= -3.9e-87) tmp = -y * (t / a); elseif (x <= -6.6e-209) tmp = (y * z) / a; elseif (x <= 4.2e-301) tmp = t_1; elseif (x <= 5.5e-229) tmp = y * (z / a); elseif (x <= 2.4e-55) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * t), $MachinePrecision] / (-a)), $MachinePrecision]}, If[LessEqual[x, -3.3e+19], x, If[LessEqual[x, -3.9e-87], N[((-y) * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.6e-209], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[x, 4.2e-301], t$95$1, If[LessEqual[x, 5.5e-229], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e-55], t$95$1, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot t}{-a}\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-87}:\\
\;\;\;\;\left(-y\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-209}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-301}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-229}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-55}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.3e19 or 2.39999999999999991e-55 < x Initial program 93.3%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in x around inf 63.3%
if -3.3e19 < x < -3.8999999999999998e-87Initial program 87.9%
associate-*l/93.9%
Simplified93.9%
Taylor expanded in y around inf 64.6%
Taylor expanded in z around 0 64.7%
mul-1-neg64.7%
distribute-frac-neg64.7%
Simplified64.7%
if -3.8999999999999998e-87 < x < -6.59999999999999948e-209Initial program 99.8%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in y around inf 73.3%
Taylor expanded in z around inf 44.5%
*-commutative44.5%
clear-num44.5%
un-div-inv48.0%
Applied egg-rr48.0%
Taylor expanded in y around 0 55.8%
if -6.59999999999999948e-209 < x < 4.1999999999999997e-301 or 5.5000000000000001e-229 < x < 2.39999999999999991e-55Initial program 94.8%
associate-*l/92.0%
Simplified92.0%
Taylor expanded in y around inf 85.0%
Taylor expanded in z around 0 53.4%
mul-1-neg53.4%
distribute-frac-neg53.4%
Simplified53.4%
*-commutative53.4%
frac-2neg53.4%
remove-double-neg53.4%
associate-*r/56.5%
Applied egg-rr56.5%
if 4.1999999999999997e-301 < x < 5.5000000000000001e-229Initial program 94.2%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in y around inf 82.4%
Taylor expanded in z around inf 64.4%
Final simplification61.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2e+73)
(/ z (/ a y))
(if (<= z -3.9e-227)
x
(if (<= z -2.8e-278)
(* (/ y a) (- t))
(if (<= z 1.2e+20) x (* z (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+73) {
tmp = z / (a / y);
} else if (z <= -3.9e-227) {
tmp = x;
} else if (z <= -2.8e-278) {
tmp = (y / a) * -t;
} else if (z <= 1.2e+20) {
tmp = x;
} else {
tmp = 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 (z <= (-2d+73)) then
tmp = z / (a / y)
else if (z <= (-3.9d-227)) then
tmp = x
else if (z <= (-2.8d-278)) then
tmp = (y / a) * -t
else if (z <= 1.2d+20) then
tmp = x
else
tmp = 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 (z <= -2e+73) {
tmp = z / (a / y);
} else if (z <= -3.9e-227) {
tmp = x;
} else if (z <= -2.8e-278) {
tmp = (y / a) * -t;
} else if (z <= 1.2e+20) {
tmp = x;
} else {
tmp = z * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2e+73: tmp = z / (a / y) elif z <= -3.9e-227: tmp = x elif z <= -2.8e-278: tmp = (y / a) * -t elif z <= 1.2e+20: tmp = x else: tmp = z * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e+73) tmp = Float64(z / Float64(a / y)); elseif (z <= -3.9e-227) tmp = x; elseif (z <= -2.8e-278) tmp = Float64(Float64(y / a) * Float64(-t)); elseif (z <= 1.2e+20) tmp = x; else tmp = Float64(z * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2e+73) tmp = z / (a / y); elseif (z <= -3.9e-227) tmp = x; elseif (z <= -2.8e-278) tmp = (y / a) * -t; elseif (z <= 1.2e+20) tmp = x; else tmp = z * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e+73], N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.9e-227], x, If[LessEqual[z, -2.8e-278], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 1.2e+20], x, N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+73}:\\
\;\;\;\;\frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-227}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-278}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.99999999999999997e73Initial program 87.7%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in y around inf 72.3%
Taylor expanded in z around inf 71.5%
associate-*l/67.5%
associate-/l*75.5%
Applied egg-rr75.5%
if -1.99999999999999997e73 < z < -3.8999999999999999e-227 or -2.80000000000000008e-278 < z < 1.2e20Initial program 96.6%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in x around inf 53.5%
if -3.8999999999999999e-227 < z < -2.80000000000000008e-278Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 67.5%
Taylor expanded in z around 0 67.5%
mul-1-neg67.5%
distribute-frac-neg67.5%
Simplified67.5%
Taylor expanded in t around 0 78.1%
mul-1-neg78.1%
associate-*l/78.1%
*-commutative78.1%
distribute-rgt-neg-in78.1%
distribute-neg-frac78.1%
Simplified78.1%
if 1.2e20 < z Initial program 91.5%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in y around inf 57.3%
Taylor expanded in z around inf 48.8%
*-commutative48.8%
clear-num48.8%
un-div-inv50.3%
Applied egg-rr50.3%
associate-/r/53.8%
Applied egg-rr53.8%
Final simplification58.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5.9e-93) (not (<= y 5.4e-78))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.9e-93) || !(y <= 5.4e-78)) {
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 <= (-5.9d-93)) .or. (.not. (y <= 5.4d-78))) 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 <= -5.9e-93) || !(y <= 5.4e-78)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5.9e-93) or not (y <= 5.4e-78): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.9e-93) || !(y <= 5.4e-78)) 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 <= -5.9e-93) || ~((y <= 5.4e-78))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.9e-93], N[Not[LessEqual[y, 5.4e-78]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-93} \lor \neg \left(y \leq 5.4 \cdot 10^{-78}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.9e-93 or 5.39999999999999987e-78 < y Initial program 91.0%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in y around inf 71.0%
Taylor expanded in z around 0 71.0%
mul-1-neg71.0%
distribute-frac-neg71.0%
+-commutative71.0%
distribute-frac-neg71.0%
sub-neg71.0%
div-sub72.2%
Simplified72.2%
if -5.9e-93 < y < 5.39999999999999987e-78Initial program 99.9%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in x around inf 72.0%
Final simplification72.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -9000000000000.0) (not (<= x 1.55e-43))) (+ x (* z (/ y a))) (* y (/ (- z t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -9000000000000.0) || !(x <= 1.55e-43)) {
tmp = x + (z * (y / a));
} else {
tmp = y * ((z - t) / 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 ((x <= (-9000000000000.0d0)) .or. (.not. (x <= 1.55d-43))) then
tmp = x + (z * (y / a))
else
tmp = y * ((z - t) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -9000000000000.0) || !(x <= 1.55e-43)) {
tmp = x + (z * (y / a));
} else {
tmp = y * ((z - t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -9000000000000.0) or not (x <= 1.55e-43): tmp = x + (z * (y / a)) else: tmp = y * ((z - t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -9000000000000.0) || !(x <= 1.55e-43)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(y * Float64(Float64(z - t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -9000000000000.0) || ~((x <= 1.55e-43))) tmp = x + (z * (y / a)); else tmp = y * ((z - t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -9000000000000.0], N[Not[LessEqual[x, 1.55e-43]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9000000000000 \lor \neg \left(x \leq 1.55 \cdot 10^{-43}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if x < -9e12 or 1.55e-43 < x Initial program 93.3%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in t around 0 83.2%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
if -9e12 < x < 1.55e-43Initial program 94.9%
associate-*l/93.4%
Simplified93.4%
Taylor expanded in y around inf 79.2%
Taylor expanded in z around 0 79.2%
mul-1-neg79.2%
distribute-frac-neg79.2%
+-commutative79.2%
distribute-frac-neg79.2%
sub-neg79.2%
div-sub81.0%
Simplified81.0%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4600000000.0) (not (<= z 2.8e-7))) (+ x (* z (/ y a))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4600000000.0) || !(z <= 2.8e-7)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (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 ((z <= (-4600000000.0d0)) .or. (.not. (z <= 2.8d-7))) then
tmp = x + (z * (y / a))
else
tmp = x - (t * (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 ((z <= -4600000000.0) || !(z <= 2.8e-7)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4600000000.0) or not (z <= 2.8e-7): tmp = x + (z * (y / a)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4600000000.0) || !(z <= 2.8e-7)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x - Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4600000000.0) || ~((z <= 2.8e-7))) tmp = x + (z * (y / a)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4600000000.0], N[Not[LessEqual[z, 2.8e-7]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4600000000 \lor \neg \left(z \leq 2.8 \cdot 10^{-7}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -4.6e9 or 2.80000000000000019e-7 < z Initial program 91.6%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around 0 81.3%
associate-*l/87.3%
*-commutative87.3%
Simplified87.3%
if -4.6e9 < z < 2.80000000000000019e-7Initial program 96.3%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in z around 0 89.7%
mul-1-neg89.7%
associate-*l/89.4%
distribute-rgt-neg-out89.4%
+-commutative89.4%
*-commutative89.4%
distribute-lft-neg-out89.4%
unsub-neg89.4%
Simplified89.4%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.35e+14) (not (<= z 9.6e-7))) (+ x (* z (/ y a))) (- x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.35e+14) || !(z <= 9.6e-7)) {
tmp = x + (z * (y / a));
} else {
tmp = x - ((y * t) / 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 ((z <= (-2.35d+14)) .or. (.not. (z <= 9.6d-7))) then
tmp = x + (z * (y / a))
else
tmp = x - ((y * t) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.35e+14) || !(z <= 9.6e-7)) {
tmp = x + (z * (y / a));
} else {
tmp = x - ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.35e+14) or not (z <= 9.6e-7): tmp = x + (z * (y / a)) else: tmp = x - ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.35e+14) || !(z <= 9.6e-7)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x - Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.35e+14) || ~((z <= 9.6e-7))) tmp = x + (z * (y / a)); else tmp = x - ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.35e+14], N[Not[LessEqual[z, 9.6e-7]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+14} \lor \neg \left(z \leq 9.6 \cdot 10^{-7}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -2.35e14 or 9.59999999999999914e-7 < z Initial program 91.6%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around 0 81.3%
associate-*l/87.3%
*-commutative87.3%
Simplified87.3%
if -2.35e14 < z < 9.59999999999999914e-7Initial program 96.3%
associate-*l/93.6%
Simplified93.6%
*-commutative93.6%
clear-num93.3%
un-div-inv93.6%
Applied egg-rr93.6%
Taylor expanded in z around 0 89.7%
+-commutative89.7%
mul-1-neg89.7%
*-commutative89.7%
associate-/l*89.3%
unsub-neg89.3%
associate-/l*89.7%
*-commutative89.7%
Simplified89.7%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.4e-205) (+ x (* (- z t) (/ y a))) (+ x (/ y (/ a (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.4e-205) {
tmp = x + ((z - t) * (y / a));
} else {
tmp = x + (y / (a / (z - t)));
}
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 <= 2.4d-205) then
tmp = x + ((z - t) * (y / a))
else
tmp = x + (y / (a / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.4e-205) {
tmp = x + ((z - t) * (y / a));
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.4e-205: tmp = x + ((z - t) * (y / a)) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.4e-205) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / a))); else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.4e-205) tmp = x + ((z - t) * (y / a)); else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.4e-205], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.4 \cdot 10^{-205}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if t < 2.4000000000000002e-205Initial program 94.6%
associate-*l/98.5%
Simplified98.5%
if 2.4000000000000002e-205 < t Initial program 93.3%
associate-*l/91.1%
Simplified91.1%
associate-/r/97.5%
Applied egg-rr97.5%
Final simplification98.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.75e+75) (not (<= z 1.8e+20))) (* z (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.75e+75) || !(z <= 1.8e+20)) {
tmp = z * (y / 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 <= (-2.75d+75)) .or. (.not. (z <= 1.8d+20))) then
tmp = z * (y / 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 <= -2.75e+75) || !(z <= 1.8e+20)) {
tmp = z * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.75e+75) or not (z <= 1.8e+20): tmp = z * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.75e+75) || !(z <= 1.8e+20)) tmp = Float64(z * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.75e+75) || ~((z <= 1.8e+20))) tmp = z * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.75e+75], N[Not[LessEqual[z, 1.8e+20]], $MachinePrecision]], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+75} \lor \neg \left(z \leq 1.8 \cdot 10^{+20}\right):\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.75e75 or 1.8e20 < z Initial program 89.8%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in y around inf 64.0%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
clear-num58.9%
un-div-inv60.6%
Applied egg-rr60.6%
associate-/r/63.5%
Applied egg-rr63.5%
if -2.75e75 < z < 1.8e20Initial program 96.8%
associate-*l/94.0%
Simplified94.0%
Taylor expanded in x around inf 51.7%
Final simplification56.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+70) (/ z (/ a y)) (if (<= z 1.75e+20) x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+70) {
tmp = z / (a / y);
} else if (z <= 1.75e+20) {
tmp = x;
} else {
tmp = 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 (z <= (-1.05d+70)) then
tmp = z / (a / y)
else if (z <= 1.75d+20) then
tmp = x
else
tmp = 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 (z <= -1.05e+70) {
tmp = z / (a / y);
} else if (z <= 1.75e+20) {
tmp = x;
} else {
tmp = z * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+70: tmp = z / (a / y) elif z <= 1.75e+20: tmp = x else: tmp = z * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+70) tmp = Float64(z / Float64(a / y)); elseif (z <= 1.75e+20) tmp = x; else tmp = Float64(z * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.05e+70) tmp = z / (a / y); elseif (z <= 1.75e+20) tmp = x; else tmp = z * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+70], N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e+20], x, N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+70}:\\
\;\;\;\;\frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.05000000000000004e70Initial program 87.7%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in y around inf 72.3%
Taylor expanded in z around inf 71.5%
associate-*l/67.5%
associate-/l*75.5%
Applied egg-rr75.5%
if -1.05000000000000004e70 < z < 1.75e20Initial program 96.8%
associate-*l/94.0%
Simplified94.0%
Taylor expanded in x around inf 51.7%
if 1.75e20 < z Initial program 91.5%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in y around inf 57.3%
Taylor expanded in z around inf 48.8%
*-commutative48.8%
clear-num48.8%
un-div-inv50.3%
Applied egg-rr50.3%
associate-/r/53.8%
Applied egg-rr53.8%
Final simplification56.4%
(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 94.0%
associate-*l/95.2%
Simplified95.2%
Final simplification95.2%
(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 94.0%
associate-*l/95.2%
Simplified95.2%
Taylor expanded in x around inf 41.5%
Final simplification41.5%
(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 2023274
(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)))