
(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 10 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 a) (- z t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (z - t));
}
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 / a) * (z - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (z - t));
}
def code(x, y, z, t, a): return x + ((y / a) * (z - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(z - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (z - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(z - t\right)
\end{array}
Initial program 92.4%
associate-*l/97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t))))
(if (<= y -4.2e+227)
t_1
(if (<= y -1.02e+132)
(/ (* y z) a)
(if (<= y -5.3e-31)
t_1
(if (<= y 1.02e-22) x (if (<= y 4.4e+210) (* (/ y a) z) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * -t;
double tmp;
if (y <= -4.2e+227) {
tmp = t_1;
} else if (y <= -1.02e+132) {
tmp = (y * z) / a;
} else if (y <= -5.3e-31) {
tmp = t_1;
} else if (y <= 1.02e-22) {
tmp = x;
} else if (y <= 4.4e+210) {
tmp = (y / a) * z;
} 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 / a) * -t
if (y <= (-4.2d+227)) then
tmp = t_1
else if (y <= (-1.02d+132)) then
tmp = (y * z) / a
else if (y <= (-5.3d-31)) then
tmp = t_1
else if (y <= 1.02d-22) then
tmp = x
else if (y <= 4.4d+210) then
tmp = (y / a) * z
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 / a) * -t;
double tmp;
if (y <= -4.2e+227) {
tmp = t_1;
} else if (y <= -1.02e+132) {
tmp = (y * z) / a;
} else if (y <= -5.3e-31) {
tmp = t_1;
} else if (y <= 1.02e-22) {
tmp = x;
} else if (y <= 4.4e+210) {
tmp = (y / a) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * -t tmp = 0 if y <= -4.2e+227: tmp = t_1 elif y <= -1.02e+132: tmp = (y * z) / a elif y <= -5.3e-31: tmp = t_1 elif y <= 1.02e-22: tmp = x elif y <= 4.4e+210: tmp = (y / a) * z else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(-t)) tmp = 0.0 if (y <= -4.2e+227) tmp = t_1; elseif (y <= -1.02e+132) tmp = Float64(Float64(y * z) / a); elseif (y <= -5.3e-31) tmp = t_1; elseif (y <= 1.02e-22) tmp = x; elseif (y <= 4.4e+210) tmp = Float64(Float64(y / a) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * -t; tmp = 0.0; if (y <= -4.2e+227) tmp = t_1; elseif (y <= -1.02e+132) tmp = (y * z) / a; elseif (y <= -5.3e-31) tmp = t_1; elseif (y <= 1.02e-22) tmp = x; elseif (y <= 4.4e+210) tmp = (y / a) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]}, If[LessEqual[y, -4.2e+227], t$95$1, If[LessEqual[y, -1.02e+132], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, -5.3e-31], t$95$1, If[LessEqual[y, 1.02e-22], x, If[LessEqual[y, 4.4e+210], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{+227}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.02 \cdot 10^{+132}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;y \leq -5.3 \cdot 10^{-31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+210}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -4.20000000000000039e227 or -1.0200000000000001e132 < y < -5.3000000000000001e-31 or 4.39999999999999974e210 < y Initial program 82.7%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in z around 0 64.1%
mul-1-neg64.1%
associate-*l/82.1%
distribute-rgt-neg-out82.1%
+-commutative82.1%
*-commutative82.1%
distribute-lft-neg-out82.1%
unsub-neg82.1%
Simplified82.1%
Taylor expanded in x around 0 51.8%
associate-*l/67.4%
*-commutative67.4%
neg-mul-167.4%
distribute-rgt-neg-in67.4%
Simplified67.4%
if -4.20000000000000039e227 < y < -1.0200000000000001e132Initial program 91.3%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 77.8%
Taylor expanded in z around inf 56.2%
Taylor expanded in z around 0 56.3%
if -5.3000000000000001e-31 < y < 1.02000000000000002e-22Initial program 99.8%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in x around inf 64.2%
if 1.02000000000000002e-22 < y < 4.39999999999999974e210Initial program 87.9%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around inf 82.1%
Taylor expanded in z around inf 60.2%
Taylor expanded in z around 0 52.4%
associate-*l/67.7%
Simplified67.7%
Final simplification65.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t) a))))
(if (<= y -5e+229)
t_1
(if (<= y -2.45e+129)
(/ (* y z) a)
(if (<= y -2.1e-29)
t_1
(if (<= y 1.02e-22)
x
(if (<= y 1.52e+212) (* (/ y a) z) (* (/ y a) (- t)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-t / a);
double tmp;
if (y <= -5e+229) {
tmp = t_1;
} else if (y <= -2.45e+129) {
tmp = (y * z) / a;
} else if (y <= -2.1e-29) {
tmp = t_1;
} else if (y <= 1.02e-22) {
tmp = x;
} else if (y <= 1.52e+212) {
tmp = (y / a) * z;
} else {
tmp = (y / a) * -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) :: t_1
real(8) :: tmp
t_1 = y * (-t / a)
if (y <= (-5d+229)) then
tmp = t_1
else if (y <= (-2.45d+129)) then
tmp = (y * z) / a
else if (y <= (-2.1d-29)) then
tmp = t_1
else if (y <= 1.02d-22) then
tmp = x
else if (y <= 1.52d+212) then
tmp = (y / a) * z
else
tmp = (y / a) * -t
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 (y <= -5e+229) {
tmp = t_1;
} else if (y <= -2.45e+129) {
tmp = (y * z) / a;
} else if (y <= -2.1e-29) {
tmp = t_1;
} else if (y <= 1.02e-22) {
tmp = x;
} else if (y <= 1.52e+212) {
tmp = (y / a) * z;
} else {
tmp = (y / a) * -t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (-t / a) tmp = 0 if y <= -5e+229: tmp = t_1 elif y <= -2.45e+129: tmp = (y * z) / a elif y <= -2.1e-29: tmp = t_1 elif y <= 1.02e-22: tmp = x elif y <= 1.52e+212: tmp = (y / a) * z else: tmp = (y / a) * -t return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-t) / a)) tmp = 0.0 if (y <= -5e+229) tmp = t_1; elseif (y <= -2.45e+129) tmp = Float64(Float64(y * z) / a); elseif (y <= -2.1e-29) tmp = t_1; elseif (y <= 1.02e-22) tmp = x; elseif (y <= 1.52e+212) tmp = Float64(Float64(y / a) * z); else tmp = Float64(Float64(y / a) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (-t / a); tmp = 0.0; if (y <= -5e+229) tmp = t_1; elseif (y <= -2.45e+129) tmp = (y * z) / a; elseif (y <= -2.1e-29) tmp = t_1; elseif (y <= 1.02e-22) tmp = x; elseif (y <= 1.52e+212) tmp = (y / a) * z; else tmp = (y / a) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e+229], t$95$1, If[LessEqual[y, -2.45e+129], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, -2.1e-29], t$95$1, If[LessEqual[y, 1.02e-22], x, If[LessEqual[y, 1.52e+212], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-t}{a}\\
\mathbf{if}\;y \leq -5 \cdot 10^{+229}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.45 \cdot 10^{+129}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.52 \cdot 10^{+212}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if y < -5.0000000000000005e229 or -2.45e129 < y < -2.09999999999999989e-29Initial program 89.6%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around inf 82.8%
Taylor expanded in z around 0 70.3%
associate-*r/70.3%
neg-mul-170.3%
Simplified70.3%
if -5.0000000000000005e229 < y < -2.45e129Initial program 91.3%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 77.8%
Taylor expanded in z around inf 56.2%
Taylor expanded in z around 0 56.3%
if -2.09999999999999989e-29 < y < 1.02000000000000002e-22Initial program 99.8%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in x around inf 64.2%
if 1.02000000000000002e-22 < y < 1.52000000000000006e212Initial program 87.9%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around inf 82.1%
Taylor expanded in z around inf 60.2%
Taylor expanded in z around 0 52.4%
associate-*l/67.7%
Simplified67.7%
if 1.52000000000000006e212 < y Initial program 66.7%
associate-*l/90.6%
Simplified90.6%
Taylor expanded in z around 0 39.7%
mul-1-neg39.7%
associate-*l/75.6%
distribute-rgt-neg-out75.6%
+-commutative75.6%
*-commutative75.6%
distribute-lft-neg-out75.6%
unsub-neg75.6%
Simplified75.6%
Taylor expanded in x around 0 32.7%
associate-*l/60.8%
*-commutative60.8%
neg-mul-160.8%
distribute-rgt-neg-in60.8%
Simplified60.8%
Final simplification65.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* (/ y a) t))))
(if (<= t -6.5e-40)
t_1
(if (<= t 1.1e-63)
(+ x (/ (* y z) a))
(if (or (<= t 1.52e-25) (not (<= t 6.4e+42)))
t_1
(+ x (* (/ y a) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y / a) * t);
double tmp;
if (t <= -6.5e-40) {
tmp = t_1;
} else if (t <= 1.1e-63) {
tmp = x + ((y * z) / a);
} else if ((t <= 1.52e-25) || !(t <= 6.4e+42)) {
tmp = t_1;
} else {
tmp = x + ((y / a) * z);
}
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 - ((y / a) * t)
if (t <= (-6.5d-40)) then
tmp = t_1
else if (t <= 1.1d-63) then
tmp = x + ((y * z) / a)
else if ((t <= 1.52d-25) .or. (.not. (t <= 6.4d+42))) then
tmp = t_1
else
tmp = x + ((y / a) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y / a) * t);
double tmp;
if (t <= -6.5e-40) {
tmp = t_1;
} else if (t <= 1.1e-63) {
tmp = x + ((y * z) / a);
} else if ((t <= 1.52e-25) || !(t <= 6.4e+42)) {
tmp = t_1;
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y / a) * t) tmp = 0 if t <= -6.5e-40: tmp = t_1 elif t <= 1.1e-63: tmp = x + ((y * z) / a) elif (t <= 1.52e-25) or not (t <= 6.4e+42): tmp = t_1 else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y / a) * t)) tmp = 0.0 if (t <= -6.5e-40) tmp = t_1; elseif (t <= 1.1e-63) tmp = Float64(x + Float64(Float64(y * z) / a)); elseif ((t <= 1.52e-25) || !(t <= 6.4e+42)) tmp = t_1; else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y / a) * t); tmp = 0.0; if (t <= -6.5e-40) tmp = t_1; elseif (t <= 1.1e-63) tmp = x + ((y * z) / a); elseif ((t <= 1.52e-25) || ~((t <= 6.4e+42))) tmp = t_1; else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e-40], t$95$1, If[LessEqual[t, 1.1e-63], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 1.52e-25], N[Not[LessEqual[t, 6.4e+42]], $MachinePrecision]], t$95$1, N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{a} \cdot t\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{-63}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 1.52 \cdot 10^{-25} \lor \neg \left(t \leq 6.4 \cdot 10^{+42}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -6.4999999999999999e-40 or 1.1e-63 < t < 1.52000000000000006e-25 or 6.40000000000000004e42 < t Initial program 88.2%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around 0 79.8%
mul-1-neg79.8%
associate-*l/87.9%
distribute-rgt-neg-out87.9%
+-commutative87.9%
*-commutative87.9%
distribute-lft-neg-out87.9%
unsub-neg87.9%
Simplified87.9%
if -6.4999999999999999e-40 < t < 1.1e-63Initial program 98.2%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in t around 0 96.4%
if 1.52000000000000006e-25 < t < 6.40000000000000004e42Initial program 86.1%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around 0 75.6%
associate-*l/89.2%
*-commutative89.2%
Simplified89.2%
Final simplification91.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.36e+253) (not (<= t 1.25e+73))) (* (/ y a) (- t)) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.36e+253) || !(t <= 1.25e+73)) {
tmp = (y / a) * -t;
} else {
tmp = x + (y / (a / z));
}
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.36d+253)) .or. (.not. (t <= 1.25d+73))) then
tmp = (y / a) * -t
else
tmp = x + (y / (a / z))
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.36e+253) || !(t <= 1.25e+73)) {
tmp = (y / a) * -t;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.36e+253) or not (t <= 1.25e+73): tmp = (y / a) * -t else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.36e+253) || !(t <= 1.25e+73)) tmp = Float64(Float64(y / a) * Float64(-t)); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.36e+253) || ~((t <= 1.25e+73))) tmp = (y / a) * -t; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.36e+253], N[Not[LessEqual[t, 1.25e+73]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.36 \cdot 10^{+253} \lor \neg \left(t \leq 1.25 \cdot 10^{+73}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -1.36e253 or 1.24999999999999994e73 < t Initial program 83.2%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around 0 79.2%
mul-1-neg79.2%
associate-*l/95.9%
distribute-rgt-neg-out95.9%
+-commutative95.9%
*-commutative95.9%
distribute-lft-neg-out95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in x around 0 63.2%
associate-*l/79.9%
*-commutative79.9%
neg-mul-179.9%
distribute-rgt-neg-in79.9%
Simplified79.9%
if -1.36e253 < t < 1.24999999999999994e73Initial program 94.7%
associate-/l*96.2%
Simplified96.2%
Taylor expanded in z around inf 79.1%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4e+251) (not (<= t 5.5e+73))) (* (/ y a) (- t)) (+ x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e+251) || !(t <= 5.5e+73)) {
tmp = (y / a) * -t;
} else {
tmp = x + ((y / a) * z);
}
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 <= (-4d+251)) .or. (.not. (t <= 5.5d+73))) then
tmp = (y / a) * -t
else
tmp = x + ((y / a) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e+251) || !(t <= 5.5e+73)) {
tmp = (y / a) * -t;
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4e+251) or not (t <= 5.5e+73): tmp = (y / a) * -t else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4e+251) || !(t <= 5.5e+73)) tmp = Float64(Float64(y / a) * Float64(-t)); else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4e+251) || ~((t <= 5.5e+73))) tmp = (y / a) * -t; else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4e+251], N[Not[LessEqual[t, 5.5e+73]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+251} \lor \neg \left(t \leq 5.5 \cdot 10^{+73}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -4.0000000000000002e251 or 5.5000000000000003e73 < t Initial program 83.2%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around 0 79.2%
mul-1-neg79.2%
associate-*l/95.9%
distribute-rgt-neg-out95.9%
+-commutative95.9%
*-commutative95.9%
distribute-lft-neg-out95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in x around 0 63.2%
associate-*l/79.9%
*-commutative79.9%
neg-mul-179.9%
distribute-rgt-neg-in79.9%
Simplified79.9%
if -4.0000000000000002e251 < t < 5.5000000000000003e73Initial program 94.7%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in t around 0 78.6%
associate-*l/81.4%
*-commutative81.4%
Simplified81.4%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3e+21) (not (<= y 8.2e-23))) (* (/ y a) z) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3e+21) || !(y <= 8.2e-23)) {
tmp = (y / a) * z;
} 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+21)) .or. (.not. (y <= 8.2d-23))) then
tmp = (y / a) * z
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+21) || !(y <= 8.2e-23)) {
tmp = (y / a) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3e+21) or not (y <= 8.2e-23): tmp = (y / a) * z else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3e+21) || !(y <= 8.2e-23)) tmp = Float64(Float64(y / a) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3e+21) || ~((y <= 8.2e-23))) tmp = (y / a) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3e+21], N[Not[LessEqual[y, 8.2e-23]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+21} \lor \neg \left(y \leq 8.2 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3e21 or 8.20000000000000059e-23 < y Initial program 85.3%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in y around inf 81.9%
Taylor expanded in z around inf 46.8%
Taylor expanded in z around 0 44.0%
associate-*l/49.6%
Simplified49.6%
if -3e21 < y < 8.20000000000000059e-23Initial program 99.8%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 62.8%
Final simplification56.1%
(FPCore (x y z t a) :precision binary64 (if (<= y -3.7e+64) (* y (/ z a)) (if (<= y 6.8e-25) x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.7e+64) {
tmp = y * (z / a);
} else if (y <= 6.8e-25) {
tmp = x;
} else {
tmp = (y / a) * z;
}
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 <= (-3.7d+64)) then
tmp = y * (z / a)
else if (y <= 6.8d-25) then
tmp = x
else
tmp = (y / a) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.7e+64) {
tmp = y * (z / a);
} else if (y <= 6.8e-25) {
tmp = x;
} else {
tmp = (y / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.7e+64: tmp = y * (z / a) elif y <= 6.8e-25: tmp = x else: tmp = (y / a) * z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.7e+64) tmp = Float64(y * Float64(z / a)); elseif (y <= 6.8e-25) tmp = x; else tmp = Float64(Float64(y / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.7e+64) tmp = y * (z / a); elseif (y <= 6.8e-25) tmp = x; else tmp = (y / a) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.7e+64], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e-25], x, N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\end{array}
\end{array}
if y < -3.69999999999999983e64Initial program 87.2%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around inf 84.9%
Taylor expanded in z around inf 42.2%
if -3.69999999999999983e64 < y < 6.80000000000000003e-25Initial program 99.8%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in x around inf 60.5%
if 6.80000000000000003e-25 < y Initial program 81.6%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in y around inf 81.4%
Taylor expanded in z around inf 53.2%
Taylor expanded in z around 0 47.9%
associate-*l/58.7%
Simplified58.7%
Final simplification56.3%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.9e+64) (/ (* y z) a) (if (<= y 7.8e-25) x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.9e+64) {
tmp = (y * z) / a;
} else if (y <= 7.8e-25) {
tmp = x;
} else {
tmp = (y / a) * z;
}
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 <= (-2.9d+64)) then
tmp = (y * z) / a
else if (y <= 7.8d-25) then
tmp = x
else
tmp = (y / a) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.9e+64) {
tmp = (y * z) / a;
} else if (y <= 7.8e-25) {
tmp = x;
} else {
tmp = (y / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.9e+64: tmp = (y * z) / a elif y <= 7.8e-25: tmp = x else: tmp = (y / a) * z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.9e+64) tmp = Float64(Float64(y * z) / a); elseif (y <= 7.8e-25) tmp = x; else tmp = Float64(Float64(y / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.9e+64) tmp = (y * z) / a; elseif (y <= 7.8e-25) tmp = x; else tmp = (y / a) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.9e+64], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 7.8e-25], x, N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+64}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\end{array}
\end{array}
if y < -2.89999999999999993e64Initial program 87.2%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around inf 84.9%
Taylor expanded in z around inf 42.2%
Taylor expanded in z around 0 42.3%
if -2.89999999999999993e64 < y < 7.8e-25Initial program 99.8%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in x around inf 60.5%
if 7.8e-25 < y Initial program 81.6%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in y around inf 81.4%
Taylor expanded in z around inf 53.2%
Taylor expanded in z around 0 47.9%
associate-*l/58.7%
Simplified58.7%
Final simplification56.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 92.4%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 40.1%
Final simplification40.1%
(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 2023238
(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)))