
(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
(let* ((t_1 (* (- z t) y)))
(if (or (<= t_1 -5e+258) (not (<= t_1 2e+164)))
(+ x (* y (/ (- z t) a)))
(+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if ((t_1 <= -5e+258) || !(t_1 <= 2e+164)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + (t_1 / 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 = (z - t) * y
if ((t_1 <= (-5d+258)) .or. (.not. (t_1 <= 2d+164))) then
tmp = x + (y * ((z - t) / a))
else
tmp = x + (t_1 / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if ((t_1 <= -5e+258) || !(t_1 <= 2e+164)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) * y tmp = 0 if (t_1 <= -5e+258) or not (t_1 <= 2e+164): tmp = x + (y * ((z - t) / a)) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) * y) tmp = 0.0 if ((t_1 <= -5e+258) || !(t_1 <= 2e+164)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) * y; tmp = 0.0; if ((t_1 <= -5e+258) || ~((t_1 <= 2e+164))) tmp = x + (y * ((z - t) / a)); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+258], N[Not[LessEqual[t$95$1, 2e+164]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - t\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+258} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+164}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -5e258 or 2e164 < (*.f64 y (-.f64 z t)) Initial program 79.1%
associate-/l*99.9%
Simplified99.9%
if -5e258 < (*.f64 y (-.f64 z t)) < 2e164Initial program 99.4%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2e+25) (not (<= z 8.5e-11))) (+ x (/ z (/ a y))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2e+25) || !(z <= 8.5e-11)) {
tmp = x + (z / (a / y));
} 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 <= (-2d+25)) .or. (.not. (z <= 8.5d-11))) then
tmp = x + (z / (a / y))
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 <= -2e+25) || !(z <= 8.5e-11)) {
tmp = x + (z / (a / y));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2e+25) or not (z <= 8.5e-11): tmp = x + (z / (a / y)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2e+25) || !(z <= 8.5e-11)) tmp = Float64(x + Float64(z / Float64(a / y))); 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 <= -2e+25) || ~((z <= 8.5e-11))) tmp = x + (z / (a / y)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2e+25], N[Not[LessEqual[z, 8.5e-11]], $MachinePrecision]], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+25} \lor \neg \left(z \leq 8.5 \cdot 10^{-11}\right):\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.00000000000000018e25 or 8.50000000000000037e-11 < z Initial program 87.6%
+-commutative87.6%
associate-/l*90.9%
fma-define90.9%
Simplified90.9%
fma-undefine90.9%
associate-*r/87.6%
*-commutative87.6%
associate-/l*98.8%
Applied egg-rr98.8%
clear-num98.7%
un-div-inv98.9%
sub-neg98.9%
add-sqr-sqrt47.6%
sqrt-unprod79.2%
sqr-neg79.2%
sqrt-unprod41.9%
add-sqr-sqrt84.2%
Applied egg-rr84.2%
Taylor expanded in z around inf 86.2%
if -2.00000000000000018e25 < z < 8.50000000000000037e-11Initial program 94.7%
+-commutative94.7%
associate-/l*95.2%
fma-define95.2%
Simplified95.2%
fma-undefine95.2%
associate-*r/94.7%
*-commutative94.7%
associate-/l*95.4%
Applied egg-rr95.4%
Taylor expanded in z around 0 89.5%
mul-1-neg89.5%
associate-*r/90.8%
distribute-lft-neg-in90.8%
cancel-sign-sub-inv90.8%
Simplified90.8%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.4e+120) (/ (* t y) (- a)) (if (<= t 6.2e+181) (+ x (/ z (/ a y))) (* (/ t a) (- y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.4e+120) {
tmp = (t * y) / -a;
} else if (t <= 6.2e+181) {
tmp = x + (z / (a / y));
} else {
tmp = (t / a) * -y;
}
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.4d+120)) then
tmp = (t * y) / -a
else if (t <= 6.2d+181) then
tmp = x + (z / (a / y))
else
tmp = (t / a) * -y
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.4e+120) {
tmp = (t * y) / -a;
} else if (t <= 6.2e+181) {
tmp = x + (z / (a / y));
} else {
tmp = (t / a) * -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.4e+120: tmp = (t * y) / -a elif t <= 6.2e+181: tmp = x + (z / (a / y)) else: tmp = (t / a) * -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.4e+120) tmp = Float64(Float64(t * y) / Float64(-a)); elseif (t <= 6.2e+181) tmp = Float64(x + Float64(z / Float64(a / y))); else tmp = Float64(Float64(t / a) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.4e+120) tmp = (t * y) / -a; elseif (t <= 6.2e+181) tmp = x + (z / (a / y)); else tmp = (t / a) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.4e+120], N[(N[(t * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[t, 6.2e+181], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+120}:\\
\;\;\;\;\frac{t \cdot y}{-a}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{+181}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -4.4000000000000003e120Initial program 91.7%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in x around 0 64.1%
*-commutative64.1%
associate-/l*56.0%
associate-*r*56.0%
neg-mul-156.0%
*-commutative56.0%
Simplified56.0%
associate-*l/64.1%
distribute-rgt-neg-out64.1%
distribute-neg-frac64.1%
distribute-neg-frac264.1%
*-commutative64.1%
Applied egg-rr64.1%
if -4.4000000000000003e120 < t < 6.19999999999999978e181Initial program 92.6%
+-commutative92.6%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
fma-undefine94.9%
associate-*r/92.6%
*-commutative92.6%
associate-/l*97.3%
Applied egg-rr97.3%
clear-num97.2%
un-div-inv97.3%
sub-neg97.3%
add-sqr-sqrt43.8%
sqrt-unprod84.1%
sqr-neg84.1%
sqrt-unprod41.5%
add-sqr-sqrt79.0%
Applied egg-rr79.0%
Taylor expanded in z around inf 82.7%
if 6.19999999999999978e181 < t Initial program 81.9%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in z around 0 81.9%
mul-1-neg81.9%
unsub-neg81.9%
*-commutative81.9%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in x around 0 72.8%
*-commutative72.8%
associate-/l*82.1%
associate-*r*82.1%
neg-mul-182.1%
*-commutative82.1%
Simplified82.1%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.2e+119) (/ (* t y) (- a)) (if (<= t 1.4e+181) (+ x (* z (/ y a))) (* (/ t a) (- y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.2e+119) {
tmp = (t * y) / -a;
} else if (t <= 1.4e+181) {
tmp = x + (z * (y / a));
} else {
tmp = (t / a) * -y;
}
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.2d+119)) then
tmp = (t * y) / -a
else if (t <= 1.4d+181) then
tmp = x + (z * (y / a))
else
tmp = (t / a) * -y
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.2e+119) {
tmp = (t * y) / -a;
} else if (t <= 1.4e+181) {
tmp = x + (z * (y / a));
} else {
tmp = (t / a) * -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.2e+119: tmp = (t * y) / -a elif t <= 1.4e+181: tmp = x + (z * (y / a)) else: tmp = (t / a) * -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.2e+119) tmp = Float64(Float64(t * y) / Float64(-a)); elseif (t <= 1.4e+181) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(Float64(t / a) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.2e+119) tmp = (t * y) / -a; elseif (t <= 1.4e+181) tmp = x + (z * (y / a)); else tmp = (t / a) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.2e+119], N[(N[(t * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[t, 1.4e+181], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{+119}:\\
\;\;\;\;\frac{t \cdot y}{-a}\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+181}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -2.2000000000000001e119Initial program 91.7%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in x around 0 64.1%
*-commutative64.1%
associate-/l*56.0%
associate-*r*56.0%
neg-mul-156.0%
*-commutative56.0%
Simplified56.0%
associate-*l/64.1%
distribute-rgt-neg-out64.1%
distribute-neg-frac64.1%
distribute-neg-frac264.1%
*-commutative64.1%
Applied egg-rr64.1%
if -2.2000000000000001e119 < t < 1.39999999999999992e181Initial program 92.6%
+-commutative92.6%
associate-/l*94.9%
fma-define94.9%
Simplified94.9%
fma-undefine94.9%
associate-*r/92.6%
*-commutative92.6%
associate-/l*97.3%
Applied egg-rr97.3%
Taylor expanded in z around inf 82.7%
if 1.39999999999999992e181 < t Initial program 81.9%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in z around 0 81.9%
mul-1-neg81.9%
unsub-neg81.9%
*-commutative81.9%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in x around 0 72.8%
*-commutative72.8%
associate-/l*82.1%
associate-*r*82.1%
neg-mul-182.1%
*-commutative82.1%
Simplified82.1%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.8e+119) (/ (* t y) (- a)) (if (<= t 6e+181) (+ x (* y (/ z a))) (* (/ t a) (- y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e+119) {
tmp = (t * y) / -a;
} else if (t <= 6e+181) {
tmp = x + (y * (z / a));
} else {
tmp = (t / a) * -y;
}
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.8d+119)) then
tmp = (t * y) / -a
else if (t <= 6d+181) then
tmp = x + (y * (z / a))
else
tmp = (t / a) * -y
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.8e+119) {
tmp = (t * y) / -a;
} else if (t <= 6e+181) {
tmp = x + (y * (z / a));
} else {
tmp = (t / a) * -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.8e+119: tmp = (t * y) / -a elif t <= 6e+181: tmp = x + (y * (z / a)) else: tmp = (t / a) * -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.8e+119) tmp = Float64(Float64(t * y) / Float64(-a)); elseif (t <= 6e+181) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(Float64(t / a) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.8e+119) tmp = (t * y) / -a; elseif (t <= 6e+181) tmp = x + (y * (z / a)); else tmp = (t / a) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.8e+119], N[(N[(t * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[t, 6e+181], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+119}:\\
\;\;\;\;\frac{t \cdot y}{-a}\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+181}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -1.80000000000000001e119Initial program 91.7%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in x around 0 64.1%
*-commutative64.1%
associate-/l*56.0%
associate-*r*56.0%
neg-mul-156.0%
*-commutative56.0%
Simplified56.0%
associate-*l/64.1%
distribute-rgt-neg-out64.1%
distribute-neg-frac64.1%
distribute-neg-frac264.1%
*-commutative64.1%
Applied egg-rr64.1%
if -1.80000000000000001e119 < t < 6.00000000000000024e181Initial program 92.6%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in t around 0 76.4%
+-commutative76.4%
associate-/l*77.4%
Simplified77.4%
if 6.00000000000000024e181 < t Initial program 81.9%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in z around 0 81.9%
mul-1-neg81.9%
unsub-neg81.9%
*-commutative81.9%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in x around 0 72.8%
*-commutative72.8%
associate-/l*82.1%
associate-*r*82.1%
neg-mul-182.1%
*-commutative82.1%
Simplified82.1%
Final simplification75.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -7.2e+119) (/ (* t y) (- a)) (if (<= t 3.4e+152) (+ x (/ (* z y) a)) (* (/ t a) (- y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.2e+119) {
tmp = (t * y) / -a;
} else if (t <= 3.4e+152) {
tmp = x + ((z * y) / a);
} else {
tmp = (t / a) * -y;
}
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 <= (-7.2d+119)) then
tmp = (t * y) / -a
else if (t <= 3.4d+152) then
tmp = x + ((z * y) / a)
else
tmp = (t / a) * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.2e+119) {
tmp = (t * y) / -a;
} else if (t <= 3.4e+152) {
tmp = x + ((z * y) / a);
} else {
tmp = (t / a) * -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7.2e+119: tmp = (t * y) / -a elif t <= 3.4e+152: tmp = x + ((z * y) / a) else: tmp = (t / a) * -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.2e+119) tmp = Float64(Float64(t * y) / Float64(-a)); elseif (t <= 3.4e+152) tmp = Float64(x + Float64(Float64(z * y) / a)); else tmp = Float64(Float64(t / a) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7.2e+119) tmp = (t * y) / -a; elseif (t <= 3.4e+152) tmp = x + ((z * y) / a); else tmp = (t / a) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.2e+119], N[(N[(t * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[t, 3.4e+152], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+119}:\\
\;\;\;\;\frac{t \cdot y}{-a}\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+152}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -7.20000000000000003e119Initial program 91.7%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in x around 0 64.1%
*-commutative64.1%
associate-/l*56.0%
associate-*r*56.0%
neg-mul-156.0%
*-commutative56.0%
Simplified56.0%
associate-*l/64.1%
distribute-rgt-neg-out64.1%
distribute-neg-frac64.1%
distribute-neg-frac264.1%
*-commutative64.1%
Applied egg-rr64.1%
if -7.20000000000000003e119 < t < 3.4000000000000002e152Initial program 93.3%
associate-/l*95.1%
Simplified95.1%
Taylor expanded in z around inf 77.9%
if 3.4000000000000002e152 < t Initial program 80.8%
associate-/l*90.5%
Simplified90.5%
Taylor expanded in z around 0 77.7%
mul-1-neg77.7%
unsub-neg77.7%
*-commutative77.7%
associate-/l*84.6%
Simplified84.6%
Taylor expanded in x around 0 64.9%
*-commutative64.9%
associate-/l*71.7%
associate-*r*71.7%
neg-mul-171.7%
*-commutative71.7%
Simplified71.7%
Final simplification74.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3e+29) (not (<= y 1.15e+110))) (* (/ t a) (- y)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3e+29) || !(y <= 1.15e+110)) {
tmp = (t / a) * -y;
} 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 <= (-3d+29)) .or. (.not. (y <= 1.15d+110))) then
tmp = (t / a) * -y
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 <= -3e+29) || !(y <= 1.15e+110)) {
tmp = (t / a) * -y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3e+29) or not (y <= 1.15e+110): tmp = (t / a) * -y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3e+29) || !(y <= 1.15e+110)) tmp = Float64(Float64(t / a) * Float64(-y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3e+29) || ~((y <= 1.15e+110))) tmp = (t / a) * -y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3e+29], N[Not[LessEqual[y, 1.15e+110]], $MachinePrecision]], N[(N[(t / a), $MachinePrecision] * (-y)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+29} \lor \neg \left(y \leq 1.15 \cdot 10^{+110}\right):\\
\;\;\;\;\frac{t}{a} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.9999999999999999e29 or 1.15e110 < y Initial program 81.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 54.4%
mul-1-neg54.4%
unsub-neg54.4%
*-commutative54.4%
associate-/l*62.4%
Simplified62.4%
Taylor expanded in x around 0 40.8%
*-commutative40.8%
associate-/l*47.8%
associate-*r*47.8%
neg-mul-147.8%
*-commutative47.8%
Simplified47.8%
if -2.9999999999999999e29 < y < 1.15e110Initial program 98.8%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in x around inf 52.3%
Final simplification50.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.8e+120) (/ (* t y) (- a)) (if (<= t 1e-37) x (* (/ t a) (- y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e+120) {
tmp = (t * y) / -a;
} else if (t <= 1e-37) {
tmp = x;
} else {
tmp = (t / a) * -y;
}
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.8d+120)) then
tmp = (t * y) / -a
else if (t <= 1d-37) then
tmp = x
else
tmp = (t / a) * -y
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.8e+120) {
tmp = (t * y) / -a;
} else if (t <= 1e-37) {
tmp = x;
} else {
tmp = (t / a) * -y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.8e+120: tmp = (t * y) / -a elif t <= 1e-37: tmp = x else: tmp = (t / a) * -y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.8e+120) tmp = Float64(Float64(t * y) / Float64(-a)); elseif (t <= 1e-37) tmp = x; else tmp = Float64(Float64(t / a) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.8e+120) tmp = (t * y) / -a; elseif (t <= 1e-37) tmp = x; else tmp = (t / a) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.8e+120], N[(N[(t * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[t, 1e-37], x, N[(N[(t / a), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+120}:\\
\;\;\;\;\frac{t \cdot y}{-a}\\
\mathbf{elif}\;t \leq 10^{-37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -1.80000000000000008e120Initial program 91.7%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in x around 0 64.1%
*-commutative64.1%
associate-/l*56.0%
associate-*r*56.0%
neg-mul-156.0%
*-commutative56.0%
Simplified56.0%
associate-*l/64.1%
distribute-rgt-neg-out64.1%
distribute-neg-frac64.1%
distribute-neg-frac264.1%
*-commutative64.1%
Applied egg-rr64.1%
if -1.80000000000000008e120 < t < 1.00000000000000007e-37Initial program 93.0%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in x around inf 45.8%
if 1.00000000000000007e-37 < t Initial program 88.2%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in z around 0 75.2%
mul-1-neg75.2%
unsub-neg75.2%
*-commutative75.2%
associate-/l*75.4%
Simplified75.4%
Taylor expanded in x around 0 53.7%
*-commutative53.7%
associate-/l*55.4%
associate-*r*55.4%
neg-mul-155.4%
*-commutative55.4%
Simplified55.4%
Final simplification51.5%
(FPCore (x y z t a) :precision binary64 (+ (* (- z t) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + 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 = ((z - t) * (y / a)) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + x;
}
def code(x, y, z, t, a): return ((z - t) * (y / a)) + x
function code(x, y, z, t, a) return Float64(Float64(Float64(z - t) * Float64(y / a)) + x) end
function tmp = code(x, y, z, t, a) tmp = ((z - t) * (y / a)) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(z - t\right) \cdot \frac{y}{a} + x
\end{array}
Initial program 91.5%
+-commutative91.5%
associate-/l*93.3%
fma-define93.3%
Simplified93.3%
fma-undefine93.3%
associate-*r/91.5%
*-commutative91.5%
associate-/l*96.9%
Applied egg-rr96.9%
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a}
\end{array}
Initial program 91.5%
associate-/l*93.3%
Simplified93.3%
(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 91.5%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in x around inf 37.2%
(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 2024151
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t)))))))
(+ x (/ (* y (- z t)) a)))