(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 (* 2.0 (sqrt x)))
(t_2 (* z (/ t 3.0)))
(t_3 (fma 1.0 y (- t_2)))
(t_4 (- y (/ (* z t) 3.0)))
(t_5 (fma (- (/ t 3.0)) z t_2))
(t_6 (/ a (* 3.0 b))))
(if (<= t_4 -3.2697914759171068e+156)
(- (* t_1 (cos y)) (/ (/ a 3.0) b))
(if (<= t_4 1.0098144165049147e+297)
(- (* t_1 (- (* (cos t_3) (cos t_5)) (* (sin t_3) (sin t_5)))) t_6)
(- t_1 t_6)))))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 = 2.0 * sqrt(x);
double t_2 = z * (t / 3.0);
double t_3 = fma(1.0, y, -t_2);
double t_4 = y - ((z * t) / 3.0);
double t_5 = fma(-(t / 3.0), z, t_2);
double t_6 = a / (3.0 * b);
double tmp;
if (t_4 <= -3.2697914759171068e+156) {
tmp = (t_1 * cos(y)) - ((a / 3.0) / b);
} else if (t_4 <= 1.0098144165049147e+297) {
tmp = (t_1 * ((cos(t_3) * cos(t_5)) - (sin(t_3) * sin(t_5)))) - t_6;
} else {
tmp = t_1 - t_6;
}
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(2.0 * sqrt(x)) t_2 = Float64(z * Float64(t / 3.0)) t_3 = fma(1.0, y, Float64(-t_2)) t_4 = Float64(y - Float64(Float64(z * t) / 3.0)) t_5 = fma(Float64(-Float64(t / 3.0)), z, t_2) t_6 = Float64(a / Float64(3.0 * b)) tmp = 0.0 if (t_4 <= -3.2697914759171068e+156) tmp = Float64(Float64(t_1 * cos(y)) - Float64(Float64(a / 3.0) / b)); elseif (t_4 <= 1.0098144165049147e+297) tmp = Float64(Float64(t_1 * Float64(Float64(cos(t_3) * cos(t_5)) - Float64(sin(t_3) * sin(t_5)))) - t_6); else tmp = Float64(t_1 - t_6); 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[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(t / 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 * y + (-t$95$2)), $MachinePrecision]}, Block[{t$95$4 = N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[((-N[(t / 3.0), $MachinePrecision]) * z + t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[(a / N[(3.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -3.2697914759171068e+156], N[(N[(t$95$1 * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[(a / 3.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1.0098144165049147e+297], N[(N[(t$95$1 * N[(N[(N[Cos[t$95$3], $MachinePrecision] * N[Cos[t$95$5], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$3], $MachinePrecision] * N[Sin[t$95$5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$6), $MachinePrecision], N[(t$95$1 - t$95$6), $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 := 2 \cdot \sqrt{x}\\
t_2 := z \cdot \frac{t}{3}\\
t_3 := \mathsf{fma}\left(1, y, -t_2\right)\\
t_4 := y - \frac{z \cdot t}{3}\\
t_5 := \mathsf{fma}\left(-\frac{t}{3}, z, t_2\right)\\
t_6 := \frac{a}{3 \cdot b}\\
\mathbf{if}\;t_4 \leq -3.2697914759171068 \cdot 10^{+156}:\\
\;\;\;\;t_1 \cdot \cos y - \frac{\frac{a}{3}}{b}\\
\mathbf{elif}\;t_4 \leq 1.0098144165049147 \cdot 10^{+297}:\\
\;\;\;\;t_1 \cdot \left(\cos t_3 \cdot \cos t_5 - \sin t_3 \cdot \sin t_5\right) - t_6\\
\mathbf{else}:\\
\;\;\;\;t_1 - t_6\\
\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.6 |
|---|---|
| Target | 18.7 |
| Herbie | 15.4 |
if (-.f64 y (/.f64 (*.f64 z t) 3)) < -3.26979147591710678e156Initial program 33.0
Taylor expanded in z around 0 24.2
Applied *-un-lft-identity_binary6424.2
Applied times-frac_binary6424.3
Applied associate-*l/_binary6424.2
if -3.26979147591710678e156 < (-.f64 y (/.f64 (*.f64 z t) 3)) < 1.0098144165049147e297Initial program 12.7
Applied *-un-lft-identity_binary6412.7
Applied times-frac_binary6412.6
Applied *-un-lft-identity_binary6412.6
Applied prod-diff_binary6412.6
Applied cos-sum_binary6410.4
if 1.0098144165049147e297 < (-.f64 y (/.f64 (*.f64 z t) 3)) Initial program 57.2
Taylor expanded in z around 0 32.3
Taylor expanded in y around 0 34.4
Final simplification15.4
herbie shell --seed 2022131
(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))))