
(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 8 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 (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
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) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x + ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 92.9%
associate-*l/96.5%
Simplified96.5%
*-commutative96.5%
clear-num96.5%
un-div-inv96.9%
Applied egg-rr96.9%
Final simplification96.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* z (/ y a)))))
(if (<= t -1.2e+133)
(/ (- y) (/ a t))
(if (<= t 4.5e+108)
t_1
(if (<= t 4.1e+139)
(* y (/ (- t) a))
(if (<= t 7.8e+242) t_1 (/ (* t (- y)) a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z * (y / a));
double tmp;
if (t <= -1.2e+133) {
tmp = -y / (a / t);
} else if (t <= 4.5e+108) {
tmp = t_1;
} else if (t <= 4.1e+139) {
tmp = y * (-t / a);
} else if (t <= 7.8e+242) {
tmp = t_1;
} else {
tmp = (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) :: t_1
real(8) :: tmp
t_1 = x + (z * (y / a))
if (t <= (-1.2d+133)) then
tmp = -y / (a / t)
else if (t <= 4.5d+108) then
tmp = t_1
else if (t <= 4.1d+139) then
tmp = y * (-t / a)
else if (t <= 7.8d+242) then
tmp = t_1
else
tmp = (t * -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 = x + (z * (y / a));
double tmp;
if (t <= -1.2e+133) {
tmp = -y / (a / t);
} else if (t <= 4.5e+108) {
tmp = t_1;
} else if (t <= 4.1e+139) {
tmp = y * (-t / a);
} else if (t <= 7.8e+242) {
tmp = t_1;
} else {
tmp = (t * -y) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z * (y / a)) tmp = 0 if t <= -1.2e+133: tmp = -y / (a / t) elif t <= 4.5e+108: tmp = t_1 elif t <= 4.1e+139: tmp = y * (-t / a) elif t <= 7.8e+242: tmp = t_1 else: tmp = (t * -y) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z * Float64(y / a))) tmp = 0.0 if (t <= -1.2e+133) tmp = Float64(Float64(-y) / Float64(a / t)); elseif (t <= 4.5e+108) tmp = t_1; elseif (t <= 4.1e+139) tmp = Float64(y * Float64(Float64(-t) / a)); elseif (t <= 7.8e+242) tmp = t_1; else tmp = Float64(Float64(t * Float64(-y)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z * (y / a)); tmp = 0.0; if (t <= -1.2e+133) tmp = -y / (a / t); elseif (t <= 4.5e+108) tmp = t_1; elseif (t <= 4.1e+139) tmp = y * (-t / a); elseif (t <= 7.8e+242) tmp = t_1; else tmp = (t * -y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.2e+133], N[((-y) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e+108], t$95$1, If[LessEqual[t, 4.1e+139], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e+242], t$95$1, N[(N[(t * (-y)), $MachinePrecision] / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{-y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.1 \cdot 10^{+139}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+242}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\
\end{array}
\end{array}
if t < -1.1999999999999999e133Initial program 84.9%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around 0 84.9%
mul-1-neg84.9%
unsub-neg84.9%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in x around 0 66.9%
associate-/l*74.4%
associate-*r/74.4%
neg-mul-174.4%
associate-/r/74.5%
*-commutative74.5%
distribute-frac-neg74.5%
Simplified74.5%
distribute-rgt-neg-out74.5%
clear-num74.4%
div-inv74.5%
distribute-neg-frac74.5%
Applied egg-rr74.5%
if -1.1999999999999999e133 < t < 4.5e108 or 4.1000000000000002e139 < t < 7.8000000000000003e242Initial program 95.0%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in z around inf 77.1%
*-commutative77.1%
associate-*r/80.6%
Simplified80.6%
if 4.5e108 < t < 4.1000000000000002e139Initial program 82.7%
associate-*l/99.6%
Simplified99.6%
Taylor expanded in z around 0 82.7%
mul-1-neg82.7%
unsub-neg82.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around 0 65.0%
associate-/l*82.0%
associate-*r/82.0%
neg-mul-182.0%
associate-/r/82.3%
*-commutative82.3%
distribute-frac-neg82.3%
Simplified82.3%
if 7.8000000000000003e242 < t Initial program 93.1%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in z around 0 93.1%
mul-1-neg93.1%
unsub-neg93.1%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in x around 0 86.0%
associate-/l*85.8%
associate-*r/85.8%
neg-mul-185.8%
associate-/r/79.6%
*-commutative79.6%
distribute-frac-neg79.6%
Simplified79.6%
distribute-neg-frac79.6%
associate-*r/86.0%
Applied egg-rr86.0%
Final simplification80.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.5e+133)
(/ (- y) (/ a t))
(if (<= t 4.5e+108)
(+ x (/ z (/ a y)))
(if (<= t 2.8e+140)
(* y (/ (- t) a))
(if (<= t 4.1e+244) (+ x (* z (/ y a))) (/ (* t (- y)) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.5e+133) {
tmp = -y / (a / t);
} else if (t <= 4.5e+108) {
tmp = x + (z / (a / y));
} else if (t <= 2.8e+140) {
tmp = y * (-t / a);
} else if (t <= 4.1e+244) {
tmp = x + (z * (y / a));
} else {
tmp = (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 (t <= (-1.5d+133)) then
tmp = -y / (a / t)
else if (t <= 4.5d+108) then
tmp = x + (z / (a / y))
else if (t <= 2.8d+140) then
tmp = y * (-t / a)
else if (t <= 4.1d+244) then
tmp = x + (z * (y / a))
else
tmp = (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 (t <= -1.5e+133) {
tmp = -y / (a / t);
} else if (t <= 4.5e+108) {
tmp = x + (z / (a / y));
} else if (t <= 2.8e+140) {
tmp = y * (-t / a);
} else if (t <= 4.1e+244) {
tmp = x + (z * (y / a));
} else {
tmp = (t * -y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.5e+133: tmp = -y / (a / t) elif t <= 4.5e+108: tmp = x + (z / (a / y)) elif t <= 2.8e+140: tmp = y * (-t / a) elif t <= 4.1e+244: tmp = x + (z * (y / a)) else: tmp = (t * -y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.5e+133) tmp = Float64(Float64(-y) / Float64(a / t)); elseif (t <= 4.5e+108) tmp = Float64(x + Float64(z / Float64(a / y))); elseif (t <= 2.8e+140) tmp = Float64(y * Float64(Float64(-t) / a)); elseif (t <= 4.1e+244) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(Float64(t * Float64(-y)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.5e+133) tmp = -y / (a / t); elseif (t <= 4.5e+108) tmp = x + (z / (a / y)); elseif (t <= 2.8e+140) tmp = y * (-t / a); elseif (t <= 4.1e+244) tmp = x + (z * (y / a)); else tmp = (t * -y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.5e+133], N[((-y) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e+108], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+140], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.1e+244], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * (-y)), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+133}:\\
\;\;\;\;\frac{-y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+140}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{elif}\;t \leq 4.1 \cdot 10^{+244}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\
\end{array}
\end{array}
if t < -1.50000000000000003e133Initial program 84.9%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around 0 84.9%
mul-1-neg84.9%
unsub-neg84.9%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in x around 0 66.9%
associate-/l*74.4%
associate-*r/74.4%
neg-mul-174.4%
associate-/r/74.5%
*-commutative74.5%
distribute-frac-neg74.5%
Simplified74.5%
distribute-rgt-neg-out74.5%
clear-num74.4%
div-inv74.5%
distribute-neg-frac74.5%
Applied egg-rr74.5%
if -1.50000000000000003e133 < t < 4.5e108Initial program 95.1%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in z around inf 79.1%
*-commutative79.1%
associate-*r/82.4%
Simplified82.4%
clear-num82.4%
div-inv82.9%
Applied egg-rr82.9%
if 4.5e108 < t < 2.79999999999999983e140Initial program 82.7%
associate-*l/99.6%
Simplified99.6%
Taylor expanded in z around 0 82.7%
mul-1-neg82.7%
unsub-neg82.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around 0 65.0%
associate-/l*82.0%
associate-*r/82.0%
neg-mul-182.0%
associate-/r/82.3%
*-commutative82.3%
distribute-frac-neg82.3%
Simplified82.3%
if 2.79999999999999983e140 < t < 4.09999999999999993e244Initial program 94.4%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in z around inf 57.7%
*-commutative57.7%
associate-*r/63.0%
Simplified63.0%
if 4.09999999999999993e244 < t Initial program 93.1%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in z around 0 93.1%
mul-1-neg93.1%
unsub-neg93.1%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in x around 0 86.0%
associate-/l*85.8%
associate-*r/85.8%
neg-mul-185.8%
associate-/r/79.6%
*-commutative79.6%
distribute-frac-neg79.6%
Simplified79.6%
distribute-neg-frac79.6%
associate-*r/86.0%
Applied egg-rr86.0%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -880000000000.0) (+ x (/ z (/ a y))) (if (<= z 6.2e-29) (- x (/ t (/ a y))) (+ x (* z (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -880000000000.0) {
tmp = x + (z / (a / y));
} else if (z <= 6.2e-29) {
tmp = x - (t / (a / y));
} 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 (z <= (-880000000000.0d0)) then
tmp = x + (z / (a / y))
else if (z <= 6.2d-29) then
tmp = x - (t / (a / y))
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 (z <= -880000000000.0) {
tmp = x + (z / (a / y));
} else if (z <= 6.2e-29) {
tmp = x - (t / (a / y));
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -880000000000.0: tmp = x + (z / (a / y)) elif z <= 6.2e-29: tmp = x - (t / (a / y)) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -880000000000.0) tmp = Float64(x + Float64(z / Float64(a / y))); elseif (z <= 6.2e-29) tmp = Float64(x - Float64(t / Float64(a / y))); 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 (z <= -880000000000.0) tmp = x + (z / (a / y)); elseif (z <= 6.2e-29) tmp = x - (t / (a / y)); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -880000000000.0], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e-29], N[(x - N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -880000000000:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-29}:\\
\;\;\;\;x - \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -8.8e11Initial program 94.3%
associate-*l/94.1%
Simplified94.1%
Taylor expanded in z around inf 83.0%
*-commutative83.0%
associate-*r/84.3%
Simplified84.3%
clear-num84.3%
div-inv84.4%
Applied egg-rr84.4%
if -8.8e11 < z < 6.20000000000000052e-29Initial program 95.5%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in z around 0 90.9%
mul-1-neg90.9%
unsub-neg90.9%
associate-/l*91.7%
Simplified91.7%
if 6.20000000000000052e-29 < z Initial program 88.7%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 77.6%
*-commutative77.6%
associate-*r/84.3%
Simplified84.3%
Final simplification87.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.5e+114) (not (<= y 5.4))) (* y (/ (- t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.5e+114) || !(y <= 5.4)) {
tmp = y * (-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 <= (-1.5d+114)) .or. (.not. (y <= 5.4d0))) then
tmp = y * (-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 <= -1.5e+114) || !(y <= 5.4)) {
tmp = y * (-t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.5e+114) or not (y <= 5.4): tmp = y * (-t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.5e+114) || !(y <= 5.4)) tmp = Float64(y * Float64(Float64(-t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.5e+114) || ~((y <= 5.4))) tmp = y * (-t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.5e+114], N[Not[LessEqual[y, 5.4]], $MachinePrecision]], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+114} \lor \neg \left(y \leq 5.4\right):\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.5e114 or 5.4000000000000004 < y Initial program 87.5%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in z around 0 63.3%
mul-1-neg63.3%
unsub-neg63.3%
associate-/l*68.3%
Simplified68.3%
Taylor expanded in x around 0 49.9%
associate-/l*54.0%
associate-*r/54.0%
neg-mul-154.0%
associate-/r/54.1%
*-commutative54.1%
distribute-frac-neg54.1%
Simplified54.1%
if -1.5e114 < y < 5.4000000000000004Initial program 97.3%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in x around inf 52.7%
Final simplification53.3%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.5e+51) (* t (/ y (- a))) (if (<= y 600.0) x (* y (/ (- t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.5e+51) {
tmp = t * (y / -a);
} else if (y <= 600.0) {
tmp = x;
} else {
tmp = 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 (y <= (-1.5d+51)) then
tmp = t * (y / -a)
else if (y <= 600.0d0) then
tmp = x
else
tmp = 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 (y <= -1.5e+51) {
tmp = t * (y / -a);
} else if (y <= 600.0) {
tmp = x;
} else {
tmp = y * (-t / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.5e+51: tmp = t * (y / -a) elif y <= 600.0: tmp = x else: tmp = y * (-t / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.5e+51) tmp = Float64(t * Float64(y / Float64(-a))); elseif (y <= 600.0) tmp = x; else tmp = Float64(y * Float64(Float64(-t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.5e+51) tmp = t * (y / -a); elseif (y <= 600.0) tmp = x; else tmp = y * (-t / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.5e+51], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 600.0], x, N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+51}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{elif}\;y \leq 600:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if y < -1.5e51Initial program 91.4%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around 0 61.1%
mul-1-neg61.1%
unsub-neg61.1%
associate-/l*63.3%
Simplified63.3%
Taylor expanded in x around 0 45.9%
mul-1-neg45.9%
associate-*r/48.2%
distribute-rgt-neg-out48.2%
distribute-neg-frac48.2%
associate-*r/45.9%
associate-/l*46.2%
Simplified46.2%
associate-/l*45.9%
associate-*r/48.2%
*-commutative48.2%
frac-2neg48.2%
remove-double-neg48.2%
Applied egg-rr48.2%
if -1.5e51 < y < 600Initial program 98.5%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 54.3%
if 600 < y Initial program 84.4%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in z around 0 62.1%
mul-1-neg62.1%
unsub-neg62.1%
associate-/l*69.3%
Simplified69.3%
Taylor expanded in x around 0 48.8%
associate-/l*54.7%
associate-*r/54.7%
neg-mul-154.7%
associate-/r/55.0%
*-commutative55.0%
distribute-frac-neg55.0%
Simplified55.0%
Final simplification53.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 92.9%
associate-*l/96.5%
Simplified96.5%
Final simplification96.5%
(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 92.9%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in x around inf 36.4%
Final simplification36.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 2023297
(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)))