(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 (/ a (* b 3.0)))
(t_2 (* z (/ t 3.0)))
(t_3 (fma (- (/ t 3.0)) z t_2))
(t_4 (* 2.0 (sqrt x)))
(t_5 (cbrt (* t_4 (cos y))))
(t_6 (fma 1.0 y (- t_2))))
(if (<= (* z t) -614615024502844300.0)
(- t_4 t_1)
(if (<= (* z t) 1.7974798995587906e+301)
(- (* t_4 (- (* (cos t_6) (cos t_3)) (* (sin t_6) (sin t_3)))) t_1)
(- (* t_5 (* (* (cbrt 2.0) (pow x 0.16666666666666666)) t_5)) t_1)))))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 = a / (b * 3.0);
double t_2 = z * (t / 3.0);
double t_3 = fma(-(t / 3.0), z, t_2);
double t_4 = 2.0 * sqrt(x);
double t_5 = cbrt((t_4 * cos(y)));
double t_6 = fma(1.0, y, -t_2);
double tmp;
if ((z * t) <= -614615024502844300.0) {
tmp = t_4 - t_1;
} else if ((z * t) <= 1.7974798995587906e+301) {
tmp = (t_4 * ((cos(t_6) * cos(t_3)) - (sin(t_6) * sin(t_3)))) - t_1;
} else {
tmp = (t_5 * ((cbrt(2.0) * pow(x, 0.16666666666666666)) * t_5)) - t_1;
}
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(a / Float64(b * 3.0)) t_2 = Float64(z * Float64(t / 3.0)) t_3 = fma(Float64(-Float64(t / 3.0)), z, t_2) t_4 = Float64(2.0 * sqrt(x)) t_5 = cbrt(Float64(t_4 * cos(y))) t_6 = fma(1.0, y, Float64(-t_2)) tmp = 0.0 if (Float64(z * t) <= -614615024502844300.0) tmp = Float64(t_4 - t_1); elseif (Float64(z * t) <= 1.7974798995587906e+301) tmp = Float64(Float64(t_4 * Float64(Float64(cos(t_6) * cos(t_3)) - Float64(sin(t_6) * sin(t_3)))) - t_1); else tmp = Float64(Float64(t_5 * Float64(Float64(cbrt(2.0) * (x ^ 0.16666666666666666)) * t_5)) - t_1); 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[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(t / 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[(t / 3.0), $MachinePrecision]) * z + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[(t$95$4 * N[Cos[y], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$6 = N[(1.0 * y + (-t$95$2)), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -614615024502844300.0], N[(t$95$4 - t$95$1), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1.7974798995587906e+301], N[(N[(t$95$4 * N[(N[(N[Cos[t$95$6], $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$6], $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(t$95$5 * N[(N[(N[Power[2.0, 1/3], $MachinePrecision] * N[Power[x, 0.16666666666666666], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision] - t$95$1), $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 := \frac{a}{b \cdot 3}\\
t_2 := z \cdot \frac{t}{3}\\
t_3 := \mathsf{fma}\left(-\frac{t}{3}, z, t_2\right)\\
t_4 := 2 \cdot \sqrt{x}\\
t_5 := \sqrt[3]{t_4 \cdot \cos y}\\
t_6 := \mathsf{fma}\left(1, y, -t_2\right)\\
\mathbf{if}\;z \cdot t \leq -614615024502844300:\\
\;\;\;\;t_4 - t_1\\
\mathbf{elif}\;z \cdot t \leq 1.7974798995587906 \cdot 10^{+301}:\\
\;\;\;\;t_4 \cdot \left(\cos t_6 \cdot \cos t_3 - \sin t_6 \cdot \sin t_3\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;t_5 \cdot \left(\left(\sqrt[3]{2} \cdot {x}^{0.16666666666666666}\right) \cdot t_5\right) - t_1\\
\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 | 21.1 |
|---|---|
| Target | 19.0 |
| Herbie | 16.1 |
if (*.f64 z t) < -614615024502844288Initial program 42.4
Taylor expanded in z around 0 34.1
Taylor expanded in y around 0 34.1
if -614615024502844288 < (*.f64 z t) < 1.79747989955879061e301Initial program 9.5
Applied *-un-lft-identity_binary649.5
Applied times-frac_binary649.5
Applied *-un-lft-identity_binary649.5
Applied prod-diff_binary649.5
Applied cos-sum_binary648.1
if 1.79747989955879061e301 < (*.f64 z t) Initial program 62.2
Taylor expanded in z around 0 31.9
Applied add-cube-cbrt_binary6431.9
Taylor expanded in y around 0 32.4
Final simplification16.1
herbie shell --seed 2022129
(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))))