
(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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- z t) y)))
(if (or (<= t_1 -5e+194) (not (<= t_1 4e+209)))
(+ x (/ y (/ a (- z t))))
(+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if ((t_1 <= -5e+194) || !(t_1 <= 4e+209)) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (z - t) * y
if ((t_1 <= (-5d+194)) .or. (.not. (t_1 <= 4d+209))) then
tmp = x + (y / (a / (z - t)))
else
tmp = x + (t_1 / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if ((t_1 <= -5e+194) || !(t_1 <= 4e+209)) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) * y tmp = 0 if (t_1 <= -5e+194) or not (t_1 <= 4e+209): tmp = x + (y / (a / (z - t))) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) * y) tmp = 0.0 if ((t_1 <= -5e+194) || !(t_1 <= 4e+209)) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) * y; tmp = 0.0; if ((t_1 <= -5e+194) || ~((t_1 <= 4e+209))) tmp = x + (y / (a / (z - t))); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+194], N[Not[LessEqual[t$95$1, 4e+209]], $MachinePrecision]], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - t\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+194} \lor \neg \left(t\_1 \leq 4 \cdot 10^{+209}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -4.99999999999999989e194 or 4.0000000000000003e209 < (*.f64 y (-.f64 z t)) Initial program 80.9%
associate-/l*99.8%
Simplified99.8%
if -4.99999999999999989e194 < (*.f64 y (-.f64 z t)) < 4.0000000000000003e209Initial program 98.9%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* t (/ y a)))) (t_2 (+ x (* z (/ y a)))))
(if (<= z -1.3e+164)
t_2
(if (<= z -1.5e-144)
t_1
(if (<= z 6.4e-224)
(- x (* y (/ t a)))
(if (<= z 4.35e+61) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (t * (y / a));
double t_2 = x + (z * (y / a));
double tmp;
if (z <= -1.3e+164) {
tmp = t_2;
} else if (z <= -1.5e-144) {
tmp = t_1;
} else if (z <= 6.4e-224) {
tmp = x - (y * (t / a));
} else if (z <= 4.35e+61) {
tmp = t_1;
} 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 = x - (t * (y / a))
t_2 = x + (z * (y / a))
if (z <= (-1.3d+164)) then
tmp = t_2
else if (z <= (-1.5d-144)) then
tmp = t_1
else if (z <= 6.4d-224) then
tmp = x - (y * (t / a))
else if (z <= 4.35d+61) then
tmp = t_1
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 = x - (t * (y / a));
double t_2 = x + (z * (y / a));
double tmp;
if (z <= -1.3e+164) {
tmp = t_2;
} else if (z <= -1.5e-144) {
tmp = t_1;
} else if (z <= 6.4e-224) {
tmp = x - (y * (t / a));
} else if (z <= 4.35e+61) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (t * (y / a)) t_2 = x + (z * (y / a)) tmp = 0 if z <= -1.3e+164: tmp = t_2 elif z <= -1.5e-144: tmp = t_1 elif z <= 6.4e-224: tmp = x - (y * (t / a)) elif z <= 4.35e+61: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(t * Float64(y / a))) t_2 = Float64(x + Float64(z * Float64(y / a))) tmp = 0.0 if (z <= -1.3e+164) tmp = t_2; elseif (z <= -1.5e-144) tmp = t_1; elseif (z <= 6.4e-224) tmp = Float64(x - Float64(y * Float64(t / a))); elseif (z <= 4.35e+61) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (t * (y / a)); t_2 = x + (z * (y / a)); tmp = 0.0; if (z <= -1.3e+164) tmp = t_2; elseif (z <= -1.5e-144) tmp = t_1; elseif (z <= 6.4e-224) tmp = x - (y * (t / a)); elseif (z <= 4.35e+61) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+164], t$95$2, If[LessEqual[z, -1.5e-144], t$95$1, If[LessEqual[z, 6.4e-224], N[(x - N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.35e+61], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - t \cdot \frac{y}{a}\\
t_2 := x + z \cdot \frac{y}{a}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+164}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-224}:\\
\;\;\;\;x - y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 4.35 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.3e164 or 4.3500000000000001e61 < z Initial program 91.5%
*-commutative91.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 86.4%
+-commutative86.4%
associate-/l*79.0%
Simplified79.0%
associate-/r/93.5%
Applied egg-rr93.5%
if -1.3e164 < z < -1.4999999999999999e-144 or 6.3999999999999997e-224 < z < 4.3500000000000001e61Initial program 93.6%
associate-/l*89.9%
Simplified89.9%
Taylor expanded in z around 0 74.7%
associate-*r/74.7%
neg-mul-174.7%
Simplified74.7%
associate-/r/85.1%
add-sqr-sqrt40.8%
sqrt-unprod52.3%
sqr-neg52.3%
sqrt-unprod23.8%
add-sqr-sqrt43.9%
frac-2neg43.9%
distribute-frac-neg43.9%
cancel-sign-sub-inv43.9%
*-commutative43.9%
add-sqr-sqrt20.1%
sqrt-unprod54.5%
sqr-neg54.5%
sqrt-unprod44.2%
add-sqr-sqrt85.1%
Applied egg-rr85.1%
if -1.4999999999999999e-144 < z < 6.3999999999999997e-224Initial program 95.3%
*-commutative95.3%
associate-/l*90.8%
Simplified90.8%
Taylor expanded in z around 0 92.4%
mul-1-neg92.4%
associate-*r/88.0%
unsub-neg88.0%
associate-*r/92.4%
associate-/l*88.1%
associate-/r/95.5%
Simplified95.5%
Final simplification90.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* z (/ y a)))))
(if (<= z -3.3e+162)
t_1
(if (<= z -6.6e-254)
(- x (* t (/ y a)))
(if (<= z 3.05e+63) (- x (/ (* t y) a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z * (y / a));
double tmp;
if (z <= -3.3e+162) {
tmp = t_1;
} else if (z <= -6.6e-254) {
tmp = x - (t * (y / a));
} else if (z <= 3.05e+63) {
tmp = x - ((t * 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 = x + (z * (y / a))
if (z <= (-3.3d+162)) then
tmp = t_1
else if (z <= (-6.6d-254)) then
tmp = x - (t * (y / a))
else if (z <= 3.05d+63) then
tmp = x - ((t * 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 = x + (z * (y / a));
double tmp;
if (z <= -3.3e+162) {
tmp = t_1;
} else if (z <= -6.6e-254) {
tmp = x - (t * (y / a));
} else if (z <= 3.05e+63) {
tmp = x - ((t * y) / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z * (y / a)) tmp = 0 if z <= -3.3e+162: tmp = t_1 elif z <= -6.6e-254: tmp = x - (t * (y / a)) elif z <= 3.05e+63: tmp = x - ((t * y) / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z * Float64(y / a))) tmp = 0.0 if (z <= -3.3e+162) tmp = t_1; elseif (z <= -6.6e-254) tmp = Float64(x - Float64(t * Float64(y / a))); elseif (z <= 3.05e+63) tmp = Float64(x - Float64(Float64(t * y) / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z * (y / a)); tmp = 0.0; if (z <= -3.3e+162) tmp = t_1; elseif (z <= -6.6e-254) tmp = x - (t * (y / a)); elseif (z <= 3.05e+63) tmp = x - ((t * y) / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+162], t$95$1, If[LessEqual[z, -6.6e-254], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.05e+63], N[(x - N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{a}\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{-254}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{+63}:\\
\;\;\;\;x - \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999987e162 or 3.04999999999999984e63 < z Initial program 91.5%
*-commutative91.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 86.4%
+-commutative86.4%
associate-/l*79.0%
Simplified79.0%
associate-/r/93.5%
Applied egg-rr93.5%
if -3.29999999999999987e162 < z < -6.60000000000000033e-254Initial program 91.6%
associate-/l*91.1%
Simplified91.1%
Taylor expanded in z around 0 76.5%
associate-*r/76.5%
neg-mul-176.5%
Simplified76.5%
associate-/r/85.1%
add-sqr-sqrt42.1%
sqrt-unprod52.7%
sqr-neg52.7%
sqrt-unprod23.3%
add-sqr-sqrt40.4%
frac-2neg40.4%
distribute-frac-neg40.4%
cancel-sign-sub-inv40.4%
*-commutative40.4%
add-sqr-sqrt17.1%
sqrt-unprod48.6%
sqr-neg48.6%
sqrt-unprod42.9%
add-sqr-sqrt85.1%
Applied egg-rr85.1%
if -6.60000000000000033e-254 < z < 3.04999999999999984e63Initial program 97.5%
+-commutative97.5%
associate-*r/94.0%
fma-udef94.0%
Simplified94.0%
fma-udef94.0%
associate-*r/97.5%
div-inv97.4%
div-inv97.5%
*-commutative97.5%
associate-*r/93.5%
Applied egg-rr93.5%
Taylor expanded in z around 0 92.7%
mul-1-neg92.7%
associate-*l/89.2%
distribute-lft-neg-in89.2%
cancel-sign-sub-inv89.2%
associate-*l/92.7%
Simplified92.7%
Final simplification90.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e+162) (not (<= z 1.26e+63))) (+ x (* z (/ y a))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+162) || !(z <= 1.26e+63)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.3d+162)) .or. (.not. (z <= 1.26d+63))) then
tmp = x + (z * (y / a))
else
tmp = x - (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+162) || !(z <= 1.26e+63)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.3e+162) or not (z <= 1.26e+63): tmp = x + (z * (y / a)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.3e+162) || !(z <= 1.26e+63)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x - Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e+162) || ~((z <= 1.26e+63))) tmp = x + (z * (y / a)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e+162], N[Not[LessEqual[z, 1.26e+63]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+162} \lor \neg \left(z \leq 1.26 \cdot 10^{+63}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.29999999999999987e162 or 1.26e63 < z Initial program 91.5%
*-commutative91.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 86.4%
+-commutative86.4%
associate-/l*79.0%
Simplified79.0%
associate-/r/93.5%
Applied egg-rr93.5%
if -3.29999999999999987e162 < z < 1.26e63Initial program 94.2%
associate-/l*92.3%
Simplified92.3%
Taylor expanded in z around 0 82.1%
associate-*r/82.1%
neg-mul-182.1%
Simplified82.1%
associate-/r/86.2%
add-sqr-sqrt40.8%
sqrt-unprod55.1%
sqr-neg55.1%
sqrt-unprod24.3%
add-sqr-sqrt44.0%
frac-2neg44.0%
distribute-frac-neg44.0%
cancel-sign-sub-inv44.0%
*-commutative44.0%
add-sqr-sqrt19.7%
sqrt-unprod54.9%
sqr-neg54.9%
sqrt-unprod45.2%
add-sqr-sqrt86.2%
Applied egg-rr86.2%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.2e+207) (+ x (/ (* z y) a)) (+ x (/ y (/ a (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.2e+207) {
tmp = x + ((z * y) / a);
} else {
tmp = x + (y / (a / (z - 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) :: tmp
if (z <= (-9.2d+207)) then
tmp = x + ((z * y) / a)
else
tmp = x + (y / (a / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.2e+207) {
tmp = x + ((z * y) / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.2e+207: tmp = x + ((z * y) / a) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.2e+207) tmp = Float64(x + Float64(Float64(z * y) / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -9.2e+207) tmp = x + ((z * y) / a); else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.2e+207], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+207}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if z < -9.19999999999999979e207Initial program 99.9%
*-commutative99.9%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in z around inf 99.9%
if -9.19999999999999979e207 < z Initial program 92.8%
associate-/l*91.6%
Simplified91.6%
Final simplification92.3%
(FPCore (x y z t a) :precision binary64 (+ x (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
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 + ((z - t) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x + ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 93.4%
*-commutative93.4%
associate-/l*96.7%
Simplified96.7%
Final simplification96.7%
(FPCore (x y z t a) :precision binary64 (+ x (/ (* z y) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((z * y) / 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 + ((z * y) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z * y) / a);
}
def code(x, y, z, t, a): return x + ((z * y) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z * y) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((z * y) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z \cdot y}{a}
\end{array}
Initial program 93.4%
*-commutative93.4%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in z around inf 66.4%
Final simplification66.4%
(FPCore (x y z t a) :precision binary64 (+ x (* z (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + (z * (y / 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 + (z * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (z * (y / a));
}
def code(x, y, z, t, a): return x + (z * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(z * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (z * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \frac{y}{a}
\end{array}
Initial program 93.4%
*-commutative93.4%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in t around 0 66.4%
+-commutative66.4%
associate-/l*64.0%
Simplified64.0%
associate-/r/68.8%
Applied egg-rr68.8%
Final simplification68.8%
(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 93.4%
*-commutative93.4%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in x around inf 38.3%
Final simplification38.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 2024027
(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)))