(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 3.0)))
(t_2 (fma (- (/ t 3.0)) z t_1))
(t_3 (/ a (* b 3.0)))
(t_4 (* 2.0 (sqrt x)))
(t_5 (fma 1.0 y (- t_1))))
(if (<= (* z t) -9.068849681521214e+303)
(- t_4 (* a (/ 0.3333333333333333 b)))
(if (<= (* z t) 4.50876227333934e+210)
(- (* t_4 (- (* (cos t_5) (cos t_2)) (* (sin t_5) (sin t_2)))) t_3)
(- (* t_4 (cos y)) t_3)))))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 / 3.0);
double t_2 = fma(-(t / 3.0), z, t_1);
double t_3 = a / (b * 3.0);
double t_4 = 2.0 * sqrt(x);
double t_5 = fma(1.0, y, -t_1);
double tmp;
if ((z * t) <= -9.068849681521214e+303) {
tmp = t_4 - (a * (0.3333333333333333 / b));
} else if ((z * t) <= 4.50876227333934e+210) {
tmp = (t_4 * ((cos(t_5) * cos(t_2)) - (sin(t_5) * sin(t_2)))) - t_3;
} else {
tmp = (t_4 * cos(y)) - t_3;
}
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 / 3.0)) t_2 = fma(Float64(-Float64(t / 3.0)), z, t_1) t_3 = Float64(a / Float64(b * 3.0)) t_4 = Float64(2.0 * sqrt(x)) t_5 = fma(1.0, y, Float64(-t_1)) tmp = 0.0 if (Float64(z * t) <= -9.068849681521214e+303) tmp = Float64(t_4 - Float64(a * Float64(0.3333333333333333 / b))); elseif (Float64(z * t) <= 4.50876227333934e+210) tmp = Float64(Float64(t_4 * Float64(Float64(cos(t_5) * cos(t_2)) - Float64(sin(t_5) * sin(t_2)))) - t_3); else tmp = Float64(Float64(t_4 * cos(y)) - t_3); 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 / 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[(t / 3.0), $MachinePrecision]) * z + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 * y + (-t$95$1)), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -9.068849681521214e+303], N[(t$95$4 - N[(a * N[(0.3333333333333333 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4.50876227333934e+210], N[(N[(t$95$4 * N[(N[(N[Cos[t$95$5], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$5], $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision], N[(N[(t$95$4 * N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$3), $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 \frac{t}{3}\\
t_2 := \mathsf{fma}\left(-\frac{t}{3}, z, t_1\right)\\
t_3 := \frac{a}{b \cdot 3}\\
t_4 := 2 \cdot \sqrt{x}\\
t_5 := \mathsf{fma}\left(1, y, -t_1\right)\\
\mathbf{if}\;z \cdot t \leq -9.068849681521214 \cdot 10^{+303}:\\
\;\;\;\;t_4 - a \cdot \frac{0.3333333333333333}{b}\\
\mathbf{elif}\;z \cdot t \leq 4.50876227333934 \cdot 10^{+210}:\\
\;\;\;\;t_4 \cdot \left(\cos t_5 \cdot \cos t_2 - \sin t_5 \cdot \sin t_2\right) - t_3\\
\mathbf{else}:\\
\;\;\;\;t_4 \cdot \cos y - t_3\\
\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.4 |
|---|---|
| Target | 18.5 |
| Herbie | 15.0 |
if (*.f64 z t) < -9.068849681521214e303Initial program 63.0
Taylor expanded in z around 0 34.3
Applied div-inv_binary6434.3
Simplified34.3
Taylor expanded in y around 0 34.1
if -9.068849681521214e303 < (*.f64 z t) < 4.50876227333934e210Initial program 13.1
Applied *-un-lft-identity_binary6413.1
Applied times-frac_binary6413.2
Applied *-un-lft-identity_binary6413.2
Applied prod-diff_binary6413.2
Applied cos-sum_binary6411.1
if 4.50876227333934e210 < (*.f64 z t) Initial program 51.2
Taylor expanded in z around 0 33.8
Applied sub-neg_binary6433.8
Final simplification15.0
herbie shell --seed 2022130
(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))))