
(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 (+ x (* (- t z) (* y (/ -1.0 a)))))
double code(double x, double y, double z, double t, double a) {
return x + ((t - z) * (y * (-1.0 / 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 + ((t - z) * (y * ((-1.0d0) / a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((t - z) * (y * (-1.0 / a)));
}
def code(x, y, z, t, a): return x + ((t - z) * (y * (-1.0 / a)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(t - z) * Float64(y * Float64(-1.0 / a)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((t - z) * (y * (-1.0 / a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(t - z), $MachinePrecision] * N[(y * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - z\right) \cdot \left(y \cdot \frac{-1}{a}\right)
\end{array}
Initial program 95.1%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.1%
Simplified95.1%
frac-2negN/A
div-invN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6497.6%
Applied egg-rr97.6%
frac-2negN/A
metadata-evalN/A
un-div-invN/A
sub0-negN/A
frac-2negN/A
associate-/l*N/A
associate-*l/N/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
metadata-eval97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)) (t_2 (* (/ y a) (- z t))))
(if (<= t_1 -1e+216)
t_2
(if (<= t_1 -1e+66)
(- x (/ (* t y) a))
(if (<= t_1 1e+91) (+ 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 = (y / a) * (z - t);
double tmp;
if (t_1 <= -1e+216) {
tmp = t_2;
} else if (t_1 <= -1e+66) {
tmp = x - ((t * y) / a);
} else if (t_1 <= 1e+91) {
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 = (y / a) * (z - t)
if (t_1 <= (-1d+216)) then
tmp = t_2
else if (t_1 <= (-1d+66)) then
tmp = x - ((t * y) / a)
else if (t_1 <= 1d+91) 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 = (y / a) * (z - t);
double tmp;
if (t_1 <= -1e+216) {
tmp = t_2;
} else if (t_1 <= -1e+66) {
tmp = x - ((t * y) / a);
} else if (t_1 <= 1e+91) {
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 = (y / a) * (z - t) tmp = 0 if t_1 <= -1e+216: tmp = t_2 elif t_1 <= -1e+66: tmp = x - ((t * y) / a) elif t_1 <= 1e+91: 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(y / a) * Float64(z - t)) tmp = 0.0 if (t_1 <= -1e+216) tmp = t_2; elseif (t_1 <= -1e+66) tmp = Float64(x - Float64(Float64(t * y) / a)); elseif (t_1 <= 1e+91) 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 = (y / a) * (z - t); tmp = 0.0; if (t_1 <= -1e+216) tmp = t_2; elseif (t_1 <= -1e+66) tmp = x - ((t * y) / a); elseif (t_1 <= 1e+91) 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[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+216], t$95$2, If[LessEqual[t$95$1, -1e+66], N[(x - N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+91], 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 := \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+216}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+66}:\\
\;\;\;\;x - \frac{t \cdot y}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+91}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -1e216 or 1.00000000000000008e91 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 88.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6488.8%
Simplified88.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-fracN/A
/-lowering-/.f64N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6483.0%
Simplified83.0%
*-commutativeN/A
associate-/l*N/A
sub-negN/A
+-commutativeN/A
remove-double-negN/A
distribute-neg-inN/A
sub-negN/A
frac-2negN/A
sub0-negN/A
un-div-invN/A
metadata-evalN/A
frac-2negN/A
*-commutativeN/A
*-lowering-*.f64N/A
frac-2negN/A
metadata-evalN/A
un-div-invN/A
sub0-negN/A
frac-2negN/A
/-lowering-/.f64N/A
sub-negN/A
distribute-neg-inN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
--lowering--.f6487.2%
Applied egg-rr87.2%
if -1e216 < (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999945e65Initial program 99.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.8%
Simplified99.8%
Taylor expanded in z around 0
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6488.7%
Simplified88.7%
if -9.99999999999999945e65 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1.00000000000000008e91Initial program 99.9%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in t around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6493.3%
Simplified93.3%
Final simplification90.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y a) (- z t)))) (if (<= t -3e+83) t_1 (if (<= t 9e+116) (+ x (/ (* z y) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (z - t);
double tmp;
if (t <= -3e+83) {
tmp = t_1;
} else if (t <= 9e+116) {
tmp = x + ((z * y) / a);
} 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) * (z - t)
if (t <= (-3d+83)) then
tmp = t_1
else if (t <= 9d+116) then
tmp = x + ((z * y) / a)
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) * (z - t);
double tmp;
if (t <= -3e+83) {
tmp = t_1;
} else if (t <= 9e+116) {
tmp = x + ((z * y) / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (z - t) tmp = 0 if t <= -3e+83: tmp = t_1 elif t <= 9e+116: tmp = x + ((z * y) / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(z - t)) tmp = 0.0 if (t <= -3e+83) tmp = t_1; elseif (t <= 9e+116) tmp = Float64(x + Float64(Float64(z * y) / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (z - t); tmp = 0.0; if (t <= -3e+83) tmp = t_1; elseif (t <= 9e+116) tmp = x + ((z * y) / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3e+83], t$95$1, If[LessEqual[t, 9e+116], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{if}\;t \leq -3 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9 \cdot 10^{+116}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3e83 or 9.00000000000000032e116 < t Initial program 92.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.8%
Simplified92.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-fracN/A
/-lowering-/.f64N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6472.9%
Simplified72.9%
*-commutativeN/A
associate-/l*N/A
sub-negN/A
+-commutativeN/A
remove-double-negN/A
distribute-neg-inN/A
sub-negN/A
frac-2negN/A
sub0-negN/A
un-div-invN/A
metadata-evalN/A
frac-2negN/A
*-commutativeN/A
*-lowering-*.f64N/A
frac-2negN/A
metadata-evalN/A
un-div-invN/A
sub0-negN/A
frac-2negN/A
/-lowering-/.f64N/A
sub-negN/A
distribute-neg-inN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
--lowering--.f6476.0%
Applied egg-rr76.0%
if -3e83 < t < 9.00000000000000032e116Initial program 96.4%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.4%
Simplified96.4%
Taylor expanded in t around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6488.2%
Simplified88.2%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y a) (- z t)))) (if (<= t -3.4e+83) t_1 (if (<= t 1.05e+119) (+ x (/ y (/ a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (z - t);
double tmp;
if (t <= -3.4e+83) {
tmp = t_1;
} else if (t <= 1.05e+119) {
tmp = x + (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) * (z - t)
if (t <= (-3.4d+83)) then
tmp = t_1
else if (t <= 1.05d+119) then
tmp = x + (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) * (z - t);
double tmp;
if (t <= -3.4e+83) {
tmp = t_1;
} else if (t <= 1.05e+119) {
tmp = x + (y / (a / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (z - t) tmp = 0 if t <= -3.4e+83: tmp = t_1 elif t <= 1.05e+119: tmp = x + (y / (a / z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(z - t)) tmp = 0.0 if (t <= -3.4e+83) tmp = t_1; elseif (t <= 1.05e+119) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (z - t); tmp = 0.0; if (t <= -3.4e+83) tmp = t_1; elseif (t <= 1.05e+119) tmp = x + (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] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.4e+83], t$95$1, If[LessEqual[t, 1.05e+119], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{if}\;t \leq -3.4 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+119}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.3999999999999998e83 or 1.04999999999999991e119 < t Initial program 92.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.8%
Simplified92.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-fracN/A
/-lowering-/.f64N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6472.9%
Simplified72.9%
*-commutativeN/A
associate-/l*N/A
sub-negN/A
+-commutativeN/A
remove-double-negN/A
distribute-neg-inN/A
sub-negN/A
frac-2negN/A
sub0-negN/A
un-div-invN/A
metadata-evalN/A
frac-2negN/A
*-commutativeN/A
*-lowering-*.f64N/A
frac-2negN/A
metadata-evalN/A
un-div-invN/A
sub0-negN/A
frac-2negN/A
/-lowering-/.f64N/A
sub-negN/A
distribute-neg-inN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
--lowering--.f6476.0%
Applied egg-rr76.0%
if -3.3999999999999998e83 < t < 1.04999999999999991e119Initial program 96.4%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.4%
Simplified96.4%
Taylor expanded in t around 0
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6488.2%
Simplified88.2%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6487.8%
Applied egg-rr87.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.1e+16) x (if (<= a 4.2e+23) (* (/ y a) (- z t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.1e+16) {
tmp = x;
} else if (a <= 4.2e+23) {
tmp = (y / a) * (z - t);
} 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 (a <= (-3.1d+16)) then
tmp = x
else if (a <= 4.2d+23) then
tmp = (y / a) * (z - t)
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 (a <= -3.1e+16) {
tmp = x;
} else if (a <= 4.2e+23) {
tmp = (y / a) * (z - t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.1e+16: tmp = x elif a <= 4.2e+23: tmp = (y / a) * (z - t) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.1e+16) tmp = x; elseif (a <= 4.2e+23) tmp = Float64(Float64(y / a) * Float64(z - t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.1e+16) tmp = x; elseif (a <= 4.2e+23) tmp = (y / a) * (z - t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.1e+16], x, If[LessEqual[a, 4.2e+23], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.1e16 or 4.2000000000000003e23 < a Initial program 88.7%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6488.7%
Simplified88.7%
Taylor expanded in x around inf
Simplified70.3%
if -3.1e16 < a < 4.2000000000000003e23Initial program 99.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.8%
Simplified99.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-fracN/A
/-lowering-/.f64N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6476.6%
Simplified76.6%
*-commutativeN/A
associate-/l*N/A
sub-negN/A
+-commutativeN/A
remove-double-negN/A
distribute-neg-inN/A
sub-negN/A
frac-2negN/A
sub0-negN/A
un-div-invN/A
metadata-evalN/A
frac-2negN/A
*-commutativeN/A
*-lowering-*.f64N/A
frac-2negN/A
metadata-evalN/A
un-div-invN/A
sub0-negN/A
frac-2negN/A
/-lowering-/.f64N/A
sub-negN/A
distribute-neg-inN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
--lowering--.f6474.8%
Applied egg-rr74.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.4e-27) x (if (<= a 1.42e-59) (/ (* z y) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e-27) {
tmp = x;
} else if (a <= 1.42e-59) {
tmp = (z * y) / a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.4d-27)) then
tmp = x
else if (a <= 1.42d-59) then
tmp = (z * y) / a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e-27) {
tmp = x;
} else if (a <= 1.42e-59) {
tmp = (z * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.4e-27: tmp = x elif a <= 1.42e-59: tmp = (z * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.4e-27) tmp = x; elseif (a <= 1.42e-59) tmp = Float64(Float64(z * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.4e-27) tmp = x; elseif (a <= 1.42e-59) tmp = (z * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.4e-27], x, If[LessEqual[a, 1.42e-59], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.42 \cdot 10^{-59}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.4e-27 or 1.42000000000000006e-59 < a Initial program 90.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6490.8%
Simplified90.8%
Taylor expanded in x around inf
Simplified64.3%
if -1.4e-27 < a < 1.42000000000000006e-59Initial program 99.8%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.8%
Simplified99.8%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6450.3%
Simplified50.3%
Final simplification57.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* z (/ y a)))) (if (<= z -2.55e+74) t_1 (if (<= z 8.5e+83) x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / a);
double tmp;
if (z <= -2.55e+74) {
tmp = t_1;
} else if (z <= 8.5e+83) {
tmp = x;
} 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 = z * (y / a)
if (z <= (-2.55d+74)) then
tmp = t_1
else if (z <= 8.5d+83) then
tmp = x
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 = z * (y / a);
double tmp;
if (z <= -2.55e+74) {
tmp = t_1;
} else if (z <= 8.5e+83) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / a) tmp = 0 if z <= -2.55e+74: tmp = t_1 elif z <= 8.5e+83: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / a)) tmp = 0.0 if (z <= -2.55e+74) tmp = t_1; elseif (z <= 8.5e+83) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / a); tmp = 0.0; if (z <= -2.55e+74) tmp = t_1; elseif (z <= 8.5e+83) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.55e+74], t$95$1, If[LessEqual[z, 8.5e+83], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{a}\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+83}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.5500000000000002e74 or 8.4999999999999995e83 < z Initial program 88.7%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6488.7%
Simplified88.7%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6459.6%
Simplified59.6%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6462.6%
Applied egg-rr62.6%
if -2.5500000000000002e74 < z < 8.4999999999999995e83Initial program 98.3%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.3%
Simplified98.3%
Taylor expanded in x around inf
Simplified54.4%
Final simplification57.1%
(FPCore (x y z t a) :precision binary64 (if (<= a 6e+180) (+ x (/ (* y (- z t)) a)) (+ x (* t (* y (/ -1.0 a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 6e+180) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (t * (y * (-1.0 / 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 (a <= 6d+180) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (t * (y * ((-1.0d0) / a)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 6e+180) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (t * (y * (-1.0 / a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 6e+180: tmp = x + ((y * (z - t)) / a) else: tmp = x + (t * (y * (-1.0 / a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 6e+180) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(t * Float64(y * Float64(-1.0 / a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 6e+180) tmp = x + ((y * (z - t)) / a); else tmp = x + (t * (y * (-1.0 / a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 6e+180], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 6 \cdot 10^{+180}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y \cdot \frac{-1}{a}\right)\\
\end{array}
\end{array}
if a < 6.00000000000000006e180Initial program 97.0%
if 6.00000000000000006e180 < a Initial program 77.0%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6477.0%
Simplified77.0%
frac-2negN/A
div-invN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f64N/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6499.9%
Applied egg-rr99.9%
frac-2negN/A
metadata-evalN/A
un-div-invN/A
sub0-negN/A
frac-2negN/A
associate-/l*N/A
associate-*l/N/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf
Simplified96.8%
Final simplification97.0%
(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 95.1%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.1%
Simplified95.1%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6497.6%
Applied egg-rr97.6%
Final simplification97.6%
(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}
Initial program 95.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 95.1%
*-commutativeN/A
associate-/l*N/A
cancel-sign-subN/A
sub0-negN/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
*-commutativeN/A
--lowering--.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.1%
Simplified95.1%
Taylor expanded in x around inf
Simplified44.3%
(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 2024155
(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)))