
(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 (/ (- t z) a) y x) (+ x (/ (* (- t z) y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9e-88) {
tmp = fma(((t - z) / a), y, x);
} else {
tmp = x + (((t - z) * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9e-88) tmp = fma(Float64(Float64(t - z) / a), y, x); else tmp = Float64(x + Float64(Float64(Float64(t - z) * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9e-88], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9 \cdot 10^{-88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(t - z\right) \cdot y}{a}\\
\end{array}
\end{array}
if a < -8.99999999999999982e-88Initial program 87.9%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.3%
associate-*l/N/A
*-commutativeN/A
sub-negN/A
+-commutativeN/A
remove-double-negN/A
distribute-neg-inN/A
sub-negN/A
associate-*l/N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
frac-2negN/A
sub-negN/A
distribute-neg-inN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
--lowering--.f6499.9
Applied egg-rr99.9%
if -8.99999999999999982e-88 < a Initial program 97.7%
Final simplification98.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (- t z) (/ y a)))) (if (<= t_1 -1e+74) t_2 (if (<= t_1 2e+30) (- x (/ (* z y) a)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (t - z) * (y / a);
double tmp;
if (t_1 <= -1e+74) {
tmp = t_2;
} else if (t_1 <= 2e+30) {
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 = (y * (z - t)) / a
t_2 = (t - z) * (y / a)
if (t_1 <= (-1d+74)) then
tmp = t_2
else if (t_1 <= 2d+30) 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 = (y * (z - t)) / a;
double t_2 = (t - z) * (y / a);
double tmp;
if (t_1 <= -1e+74) {
tmp = t_2;
} else if (t_1 <= 2e+30) {
tmp = x - ((z * y) / a);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = (t - z) * (y / a) tmp = 0 if t_1 <= -1e+74: tmp = t_2 elif t_1 <= 2e+30: tmp = x - ((z * y) / a) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) t_2 = Float64(Float64(t - z) * Float64(y / a)) tmp = 0.0 if (t_1 <= -1e+74) tmp = t_2; elseif (t_1 <= 2e+30) 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 = (y * (z - t)) / a; t_2 = (t - z) * (y / a); tmp = 0.0; if (t_1 <= -1e+74) tmp = t_2; elseif (t_1 <= 2e+30) 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[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+74], t$95$2, If[LessEqual[t$95$1, 2e+30], N[(x - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \left(t - z\right) \cdot \frac{y}{a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+74}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+30}:\\
\;\;\;\;x - \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999952e73 or 2e30 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 90.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6490.2
Applied egg-rr90.2%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
neg-sub0N/A
div-subN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l/N/A
cancel-sign-sub-invN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
distribute-rgt-out--N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.8
Simplified86.8%
if -9.99999999999999952e73 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e30Initial program 98.4%
Taylor expanded in z around inf
*-lowering-*.f6493.7
Simplified93.7%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (- t z) (/ y a)))) (if (<= t_1 -2e+72) t_2 (if (<= t_1 0.002) (fma (/ y a) t x) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = (t - z) * (y / a);
double tmp;
if (t_1 <= -2e+72) {
tmp = t_2;
} else if (t_1 <= 0.002) {
tmp = fma((y / a), t, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) t_2 = Float64(Float64(t - z) * Float64(y / a)) tmp = 0.0 if (t_1 <= -2e+72) tmp = t_2; elseif (t_1 <= 0.002) tmp = fma(Float64(y / a), t, x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+72], t$95$2, If[LessEqual[t$95$1, 0.002], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := \left(t - z\right) \cdot \frac{y}{a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+72}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -1.99999999999999989e72 or 2e-3 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 91.2%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6490.4
Applied egg-rr90.4%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
neg-sub0N/A
div-subN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l/N/A
cancel-sign-sub-invN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
distribute-rgt-out--N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.1
Simplified86.1%
if -1.99999999999999989e72 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e-3Initial program 98.3%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified97.2%
Taylor expanded in t around inf
Simplified85.0%
Final simplification85.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* t (/ y a)))) (if (<= t_1 -1e+74) t_2 (if (<= t_1 2e+30) x t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = t * (y / a);
double tmp;
if (t_1 <= -1e+74) {
tmp = t_2;
} else if (t_1 <= 2e+30) {
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 = (y * (z - t)) / a
t_2 = t * (y / a)
if (t_1 <= (-1d+74)) then
tmp = t_2
else if (t_1 <= 2d+30) 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 = (y * (z - t)) / a;
double t_2 = t * (y / a);
double tmp;
if (t_1 <= -1e+74) {
tmp = t_2;
} else if (t_1 <= 2e+30) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = t * (y / a) tmp = 0 if t_1 <= -1e+74: tmp = t_2 elif t_1 <= 2e+30: tmp = x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) t_2 = Float64(t * Float64(y / a)) tmp = 0.0 if (t_1 <= -1e+74) tmp = t_2; elseif (t_1 <= 2e+30) tmp = x; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; t_2 = t * (y / a); tmp = 0.0; if (t_1 <= -1e+74) tmp = t_2; elseif (t_1 <= 2e+30) tmp = x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+74], t$95$2, If[LessEqual[t$95$1, 2e+30], x, t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := t \cdot \frac{y}{a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+74}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+30}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999952e73 or 2e30 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 90.7%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified94.9%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6451.5
Simplified51.5%
associate-*r/N/A
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6453.5
Applied egg-rr53.5%
if -9.99999999999999952e73 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e30Initial program 98.4%
Taylor expanded in x around inf
Simplified77.3%
Final simplification65.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* y (/ t a)))) (if (<= t_1 -4e+97) t_2 (if (<= t_1 1e+15) x t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double t_2 = y * (t / a);
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 1e+15) {
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 = (y * (z - t)) / a
t_2 = y * (t / a)
if (t_1 <= (-4d+97)) then
tmp = t_2
else if (t_1 <= 1d+15) 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 = (y * (z - t)) / a;
double t_2 = y * (t / a);
double tmp;
if (t_1 <= -4e+97) {
tmp = t_2;
} else if (t_1 <= 1e+15) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a t_2 = y * (t / a) tmp = 0 if t_1 <= -4e+97: tmp = t_2 elif t_1 <= 1e+15: tmp = x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) t_2 = Float64(y * Float64(t / a)) tmp = 0.0 if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 1e+15) tmp = x; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; t_2 = y * (t / a); tmp = 0.0; if (t_1 <= -4e+97) tmp = t_2; elseif (t_1 <= 1e+15) tmp = x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+97], t$95$2, If[LessEqual[t$95$1, 1e+15], x, t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
t_2 := y \cdot \frac{t}{a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+97}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+15}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000003e97 or 1e15 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 90.8%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified95.0%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6451.5
Simplified51.5%
if -4.0000000000000003e97 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1e15Initial program 98.3%
Taylor expanded in x around inf
Simplified77.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.7e+37) (/ (* z y) (- a)) (if (<= z 1.25e+164) (fma (/ y a) t x) (- (* z (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+37) {
tmp = (z * y) / -a;
} else if (z <= 1.25e+164) {
tmp = fma((y / a), t, x);
} else {
tmp = -(z * (y / a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+37) tmp = Float64(Float64(z * y) / Float64(-a)); elseif (z <= 1.25e+164) tmp = fma(Float64(y / a), t, x); else tmp = Float64(-Float64(z * Float64(y / a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+37], N[(N[(z * y), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[z, 1.25e+164], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], (-N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+37}:\\
\;\;\;\;\frac{z \cdot y}{-a}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+164}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;-z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.69999999999999986e37Initial program 97.6%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified94.6%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-mul-1N/A
neg-lowering-neg.f6468.2
Simplified68.2%
if -2.69999999999999986e37 < z < 1.24999999999999987e164Initial program 93.8%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.4%
Taylor expanded in t around inf
Simplified85.0%
if 1.24999999999999987e164 < z Initial program 93.1%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.3%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-mul-1N/A
neg-lowering-neg.f6479.3
Simplified79.3%
associate-/l*N/A
distribute-frac-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-frac-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6482.5
Applied egg-rr82.5%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.7e+37) (- (* y (/ z a))) (if (<= z 3.85e+157) (fma (/ y a) t x) (- (* z (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+37) {
tmp = -(y * (z / a));
} else if (z <= 3.85e+157) {
tmp = fma((y / a), t, x);
} else {
tmp = -(z * (y / a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+37) tmp = Float64(-Float64(y * Float64(z / a))); elseif (z <= 3.85e+157) tmp = fma(Float64(y / a), t, x); else tmp = Float64(-Float64(z * Float64(y / a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+37], (-N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), If[LessEqual[z, 3.85e+157], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], (-N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+37}:\\
\;\;\;\;-y \cdot \frac{z}{a}\\
\mathbf{elif}\;z \leq 3.85 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;-z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.69999999999999986e37Initial program 97.6%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6463.8
Simplified63.8%
if -2.69999999999999986e37 < z < 3.8500000000000002e157Initial program 93.8%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.4%
Taylor expanded in t around inf
Simplified85.0%
if 3.8500000000000002e157 < z Initial program 93.1%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.3%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-mul-1N/A
neg-lowering-neg.f6479.3
Simplified79.3%
associate-/l*N/A
distribute-frac-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-frac-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6482.5
Applied egg-rr82.5%
Final simplification81.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* y (/ z a))))) (if (<= z -2.7e+37) t_1 (if (<= z 8.7e+158) (fma (/ y a) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(y * (z / a));
double tmp;
if (z <= -2.7e+37) {
tmp = t_1;
} else if (z <= 8.7e+158) {
tmp = fma((y / a), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-Float64(y * Float64(z / a))) tmp = 0.0 if (z <= -2.7e+37) tmp = t_1; elseif (z <= 8.7e+158) tmp = fma(Float64(y / a), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[z, -2.7e+37], t$95$1, If[LessEqual[z, 8.7e+158], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -y \cdot \frac{z}{a}\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.7 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.69999999999999986e37 or 8.70000000000000024e158 < z Initial program 95.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6468.5
Simplified68.5%
if -2.69999999999999986e37 < z < 8.70000000000000024e158Initial program 93.8%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.4%
Taylor expanded in t around inf
Simplified85.0%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- t z) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (t - z), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(t - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)
\end{array}
Initial program 94.4%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.1%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) t x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), t, x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, t, x\right)
\end{array}
Initial program 94.4%
Taylor expanded in x around 0
associate-*l/N/A
distribute-lft-out--N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
associate-+l-N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
associate-+r+N/A
Simplified96.1%
Taylor expanded in t around inf
Simplified71.6%
(FPCore (x y z t a) :precision binary64 (fma y (/ t a) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, (t / a), x);
}
function code(x, y, z, t, a) return fma(y, Float64(t / a), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{t}{a}, x\right)
\end{array}
Initial program 94.4%
Taylor expanded in z around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6470.5
Simplified70.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 94.4%
Taylor expanded in x around inf
Simplified42.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024198
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))