(FPCore (x y z t a b) :precision binary64 (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (* t -0.3333333333333333))) (t_2 (/ a (* b -3.0))))
(if (<= (* z t) -1.286527903633024e+267)
(fma 2.0 (* (sqrt x) (pow (cbrt (cos y)) 3.0)) t_2)
(if (<= (* z t) 1.4496128962660704e+174)
(fma
2.0
(* (sqrt x) (- (* (cos y) (cos t_1)) (* (sin t_1) (sin y))))
(* a (/ -0.3333333333333333 b)))
(fma 2.0 (* (sqrt x) (log1p (cbrt (pow (expm1 (cos y)) 3.0)))) t_2)))))double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (t * -0.3333333333333333);
double t_2 = a / (b * -3.0);
double tmp;
if ((z * t) <= -1.286527903633024e+267) {
tmp = fma(2.0, (sqrt(x) * pow(cbrt(cos(y)), 3.0)), t_2);
} else if ((z * t) <= 1.4496128962660704e+174) {
tmp = fma(2.0, (sqrt(x) * ((cos(y) * cos(t_1)) - (sin(t_1) * sin(y)))), (a * (-0.3333333333333333 / b)));
} else {
tmp = fma(2.0, (sqrt(x) * log1p(cbrt(pow(expm1(cos(y)), 3.0)))), t_2);
}
return tmp;
}
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * sqrt(x)) * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) - Float64(a / Float64(b * 3.0))) end
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(t * -0.3333333333333333)) t_2 = Float64(a / Float64(b * -3.0)) tmp = 0.0 if (Float64(z * t) <= -1.286527903633024e+267) tmp = fma(2.0, Float64(sqrt(x) * (cbrt(cos(y)) ^ 3.0)), t_2); elseif (Float64(z * t) <= 1.4496128962660704e+174) tmp = fma(2.0, Float64(sqrt(x) * Float64(Float64(cos(y) * cos(t_1)) - Float64(sin(t_1) * sin(y)))), Float64(a * Float64(-0.3333333333333333 / b))); else tmp = fma(2.0, Float64(sqrt(x) * log1p(cbrt((expm1(cos(y)) ^ 3.0)))), t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(t * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a / N[(b * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1.286527903633024e+267], N[(2.0 * N[(N[Sqrt[x], $MachinePrecision] * N[Power[N[Power[N[Cos[y], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1.4496128962660704e+174], N[(2.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(N[(N[Cos[y], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$1], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(-0.3333333333333333 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[x], $MachinePrecision] * N[Log[1 + N[Power[N[Power[N[(Exp[N[Cos[y], $MachinePrecision]] - 1), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
\begin{array}{l}
t_1 := z \cdot \left(t \cdot -0.3333333333333333\right)\\
t_2 := \frac{a}{b \cdot -3}\\
\mathbf{if}\;z \cdot t \leq -1.286527903633024 \cdot 10^{+267}:\\
\;\;\;\;\mathsf{fma}\left(2, \sqrt{x} \cdot {\left(\sqrt[3]{\cos y}\right)}^{3}, t_2\right)\\
\mathbf{elif}\;z \cdot t \leq 1.4496128962660704 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(2, \sqrt{x} \cdot \left(\cos y \cdot \cos t_1 - \sin t_1 \cdot \sin y\right), a \cdot \frac{-0.3333333333333333}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \sqrt{x} \cdot \mathsf{log1p}\left(\sqrt[3]{{\left(\mathsf{expm1}\left(\cos y\right)\right)}^{3}}\right), t_2\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
| Original | 20.8 |
|---|---|
| Target | 19.0 |
| Herbie | 16.4 |
if (*.f64 z t) < -1.286527903633024e267Initial program 58.0
Simplified57.7
Taylor expanded in z around 0 34.6
Applied egg-rr34.6
Applied egg-rr34.6
if -1.286527903633024e267 < (*.f64 z t) < 1.44961289626607041e174Initial program 12.7
Simplified12.8
Applied egg-rr12.1
if 1.44961289626607041e174 < (*.f64 z t) Initial program 49.1
Simplified49.2
Taylor expanded in z around 0 32.2
Applied egg-rr32.2
Applied egg-rr32.2
Applied egg-rr32.2
Final simplification16.4
herbie shell --seed 2022150
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, K"
:precision binary64
:herbie-target
(if (< z -1.3793337487235141e+129) (- (* (* 2.0 (sqrt x)) (cos (- (/ 1.0 y) (/ (/ 0.3333333333333333 z) t)))) (/ (/ a 3.0) b)) (if (< z 3.516290613555987e+106) (- (* (* (sqrt x) 2.0) (cos (- y (* (/ t 3.0) z)))) (/ (/ a 3.0) b)) (- (* (cos (- y (/ (/ 0.3333333333333333 z) t))) (* 2.0 (sqrt x))) (/ (/ a b) 3.0))))
(- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))