
(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 (if (<= a -9e-88) (fma (/ (- z t) a) y x) (+ x (/ (* (- z t) y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9e-88) {
tmp = fma(((z - t) / a), y, x);
} else {
tmp = x + (((z - t) * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9e-88) tmp = fma(Float64(Float64(z - t) / a), y, x); else tmp = Float64(x + Float64(Float64(Float64(z - t) * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9e-88], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(z - t\right) \cdot y}{a}\\
\end{array}
\end{array}
if a < -8.99999999999999982e-88Initial program 88.1%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.9
Applied egg-rr99.9%
if -8.99999999999999982e-88 < a Initial program 97.7%
Final simplification98.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- z t) y) a)))
(if (<= t_1 -4e+97)
t_1
(if (<= t_1 2e+30)
(+ x (/ (* z y) a))
(if (<= t_1 2e+301) t_1 (* (/ (- z t) a) y))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double tmp;
if (t_1 <= -4e+97) {
tmp = t_1;
} else if (t_1 <= 2e+30) {
tmp = x + ((z * y) / a);
} else if (t_1 <= 2e+301) {
tmp = t_1;
} else {
tmp = ((z - 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) :: t_1
real(8) :: tmp
t_1 = ((z - t) * y) / a
if (t_1 <= (-4d+97)) then
tmp = t_1
else if (t_1 <= 2d+30) then
tmp = x + ((z * y) / a)
else if (t_1 <= 2d+301) then
tmp = t_1
else
tmp = ((z - t) / a) * y
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) / a;
double tmp;
if (t_1 <= -4e+97) {
tmp = t_1;
} else if (t_1 <= 2e+30) {
tmp = x + ((z * y) / a);
} else if (t_1 <= 2e+301) {
tmp = t_1;
} else {
tmp = ((z - t) / a) * y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / a tmp = 0 if t_1 <= -4e+97: tmp = t_1 elif t_1 <= 2e+30: tmp = x + ((z * y) / a) elif t_1 <= 2e+301: tmp = t_1 else: tmp = ((z - t) / a) * y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / a) tmp = 0.0 if (t_1 <= -4e+97) tmp = t_1; elseif (t_1 <= 2e+30) tmp = Float64(x + Float64(Float64(z * y) / a)); elseif (t_1 <= 2e+301) tmp = t_1; else tmp = Float64(Float64(Float64(z - t) / a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / a; tmp = 0.0; if (t_1 <= -4e+97) tmp = t_1; elseif (t_1 <= 2e+30) tmp = x + ((z * y) / a); elseif (t_1 <= 2e+301) tmp = t_1; else tmp = ((z - t) / a) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+97], t$95$1, If[LessEqual[t$95$1, 2e+30], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+301], t$95$1, N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+30}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{a} \cdot y\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000003e97 or 2e30 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2.00000000000000011e301Initial program 92.7%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6484.9
Simplified84.9%
if -4.0000000000000003e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e30Initial program 98.4%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6493.1
Simplified93.1%
if 2.00000000000000011e301 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 86.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6484.3
Simplified84.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6498.1
Applied egg-rr98.1%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* (- z t) y) a)) (t_2 (* (/ (- z t) a) y))) (if (<= t_1 -4e+97) t_2 (if (<= t_1 1e+212) (+ x (/ (* z y) a)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double t_2 = ((z - t) / a) * y;
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 1e+212) {
tmp = x + ((z * y) / a);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((z - t) * y) / a
t_2 = ((z - t) / a) * y
if (t_1 <= (-4d+97)) then
tmp = t_2
else if (t_1 <= 1d+212) then
tmp = x + ((z * y) / a)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double t_2 = ((z - t) / a) * y;
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 1e+212) {
tmp = x + ((z * y) / a);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / a t_2 = ((z - t) / a) * y tmp = 0 if t_1 <= -4e+97: tmp = t_2 elif t_1 <= 1e+212: tmp = x + ((z * y) / a) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / a) t_2 = Float64(Float64(Float64(z - t) / a) * y) tmp = 0.0 if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 1e+212) tmp = Float64(x + Float64(Float64(z * y) / a)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / a; t_2 = ((z - t) / a) * y; tmp = 0.0; if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 1e+212) tmp = x + ((z * y) / a); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+97], t$95$2, If[LessEqual[t$95$1, 1e+212], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{a}\\
t_2 := \frac{z - t}{a} \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+97}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+212}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000003e97 or 9.9999999999999991e211 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 88.4%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6486.4
Simplified86.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6489.1
Applied egg-rr89.1%
if -4.0000000000000003e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 9.9999999999999991e211Initial program 98.6%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6487.4
Simplified87.4%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* (- z t) y) a)) (t_2 (* (/ (- z t) a) y))) (if (<= t_1 -4e+97) t_2 (if (<= t_1 2e+30) (fma y (/ z a) x) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double t_2 = ((z - t) / a) * y;
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 2e+30) {
tmp = fma(y, (z / a), x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / a) t_2 = Float64(Float64(Float64(z - t) / a) * y) tmp = 0.0 if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 2e+30) tmp = fma(y, Float64(z / a), x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+97], t$95$2, If[LessEqual[t$95$1, 2e+30], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{a}\\
t_2 := \frac{z - t}{a} \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+97}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000003e97 or 2e30 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 90.6%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6484.7
Simplified84.7%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6483.2
Applied egg-rr83.2%
if -4.0000000000000003e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e30Initial program 98.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6492.2
Simplified92.2%
Final simplification87.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* (- z t) y) a))) (if (<= t_1 -4e+97) (* z (/ y a)) (if (<= t_1 0.002) x (/ (* z y) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double tmp;
if (t_1 <= -4e+97) {
tmp = z * (y / a);
} else if (t_1 <= 0.002) {
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) :: t_1
real(8) :: tmp
t_1 = ((z - t) * y) / a
if (t_1 <= (-4d+97)) then
tmp = z * (y / a)
else if (t_1 <= 0.002d0) 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 t_1 = ((z - t) * y) / a;
double tmp;
if (t_1 <= -4e+97) {
tmp = z * (y / a);
} else if (t_1 <= 0.002) {
tmp = x;
} else {
tmp = (z * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / a tmp = 0 if t_1 <= -4e+97: tmp = z * (y / a) elif t_1 <= 0.002: tmp = x else: tmp = (z * y) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / a) tmp = 0.0 if (t_1 <= -4e+97) tmp = Float64(z * Float64(y / a)); elseif (t_1 <= 0.002) tmp = x; else tmp = Float64(Float64(z * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / a; tmp = 0.0; if (t_1 <= -4e+97) tmp = z * (y / a); elseif (t_1 <= 0.002) tmp = x; else tmp = (z * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+97], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.002], x, N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+97}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000003e97Initial program 87.7%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6438.9
Simplified38.9%
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6442.4
Applied egg-rr42.4%
if -4.0000000000000003e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e-3Initial program 98.4%
Taylor expanded in x around inf
Simplified79.8%
if 2e-3 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 93.2%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6447.6
Simplified47.6%
Final simplification61.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* (- z t) y) a)) (t_2 (* z (/ y a)))) (if (<= t_1 -4e+97) t_2 (if (<= t_1 0.002) x t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double t_2 = z * (y / a);
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 0.002) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((z - t) * y) / a
t_2 = z * (y / a)
if (t_1 <= (-4d+97)) then
tmp = t_2
else if (t_1 <= 0.002d0) then
tmp = x
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double t_2 = z * (y / a);
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 0.002) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / a t_2 = z * (y / a) tmp = 0 if t_1 <= -4e+97: tmp = t_2 elif t_1 <= 0.002: tmp = x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / a) t_2 = Float64(z * Float64(y / a)) tmp = 0.0 if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 0.002) tmp = x; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / a; t_2 = z * (y / a); tmp = 0.0; if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 0.002) tmp = x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+97], t$95$2, If[LessEqual[t$95$1, 0.002], x, t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{a}\\
t_2 := z \cdot \frac{y}{a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+97}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000003e97 or 2e-3 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 91.1%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6444.2
Simplified44.2%
clear-numN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6445.0
Applied egg-rr45.0%
if -4.0000000000000003e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e-3Initial program 98.4%
Taylor expanded in x around inf
Simplified79.8%
Final simplification61.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ y a) (- t) x))) (if (<= t -1e+70) t_1 (if (<= t 7e-18) (+ x (/ (* z y) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), -t, x);
double tmp;
if (t <= -1e+70) {
tmp = t_1;
} else if (t <= 7e-18) {
tmp = x + ((z * y) / a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), Float64(-t), x) tmp = 0.0 if (t <= -1e+70) tmp = t_1; elseif (t <= 7e-18) tmp = Float64(x + Float64(Float64(z * y) / a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-t) + x), $MachinePrecision]}, If[LessEqual[t, -1e+70], t$95$1, If[LessEqual[t, 7e-18], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, -t, x\right)\\
\mathbf{if}\;t \leq -1 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-18}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.00000000000000007e70 or 6.9999999999999997e-18 < t Initial program 88.8%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.8
Applied egg-rr99.8%
Taylor expanded in z around 0
mul-1-negN/A
neg-lowering-neg.f6489.7
Simplified89.7%
if -1.00000000000000007e70 < t < 6.9999999999999997e-18Initial program 98.1%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6489.3
Simplified89.3%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* t (/ y a))))) (if (<= t -1.16e+94) t_1 (if (<= t 1.5e+185) (fma (/ y a) z x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(t * (y / a));
double tmp;
if (t <= -1.16e+94) {
tmp = t_1;
} else if (t <= 1.5e+185) {
tmp = fma((y / a), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-Float64(t * Float64(y / a))) tmp = 0.0 if (t <= -1.16e+94) tmp = t_1; elseif (t <= 1.5e+185) tmp = fma(Float64(y / a), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t, -1.16e+94], t$95$1, If[LessEqual[t, 1.5e+185], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -t \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -1.16 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.1599999999999999e94 or 1.49999999999999997e185 < t Initial program 86.0%
Taylor expanded in t around inf
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6468.7
Simplified68.7%
if -1.1599999999999999e94 < t < 1.49999999999999997e185Initial program 97.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6482.1
Simplified82.1%
clear-numN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6483.1
Applied egg-rr83.1%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- z t) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (z - t), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)
\end{array}
Initial program 94.4%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6496.1
Applied egg-rr96.1%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) z x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), z, x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), z, x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z, x\right)
\end{array}
Initial program 94.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6470.1
Simplified70.1%
clear-numN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6471.2
Applied egg-rr71.2%
(FPCore (x y z t a) :precision binary64 (fma y (/ z a) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, (z / a), x);
}
function code(x, y, z, t, a) return fma(y, Float64(z / a), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z}{a}, x\right)
\end{array}
Initial program 94.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6470.1
Simplified70.1%
(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.4%
Taylor expanded in x around inf
Simplified42.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 2024198
(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)))