(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 (/ a (* b 3.0)))
(t_3 (* 2.0 (sqrt x)))
(t_4 (sqrt t_3))
(t_5 (fma t_4 (* t_4 (cos y)) (- t_2))))
(if (<= (* z t) -3.4987150309268354e+47)
t_5
(if (<= (* z t) 7.053942751863652e+25)
(- (+ (* t_3 (* (cos y) (cos t_1))) (* t_3 (* (sin y) (sin t_1)))) t_2)
t_5))))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 = a / (b * 3.0);
double t_3 = 2.0 * sqrt(x);
double t_4 = sqrt(t_3);
double t_5 = fma(t_4, (t_4 * cos(y)), -t_2);
double tmp;
if ((z * t) <= -3.4987150309268354e+47) {
tmp = t_5;
} else if ((z * t) <= 7.053942751863652e+25) {
tmp = ((t_3 * (cos(y) * cos(t_1))) + (t_3 * (sin(y) * sin(t_1)))) - t_2;
} else {
tmp = t_5;
}
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(Float64(z * t) / 3.0) t_2 = Float64(a / Float64(b * 3.0)) t_3 = Float64(2.0 * sqrt(x)) t_4 = sqrt(t_3) t_5 = fma(t_4, Float64(t_4 * cos(y)), Float64(-t_2)) tmp = 0.0 if (Float64(z * t) <= -3.4987150309268354e+47) tmp = t_5; elseif (Float64(z * t) <= 7.053942751863652e+25) tmp = Float64(Float64(Float64(t_3 * Float64(cos(y) * cos(t_1))) + Float64(t_3 * Float64(sin(y) * sin(t_1)))) - t_2); else tmp = t_5; 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[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]}, Block[{t$95$2 = N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * N[(t$95$4 * N[Cos[y], $MachinePrecision]), $MachinePrecision] + (-t$95$2)), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -3.4987150309268354e+47], t$95$5, If[LessEqual[N[(z * t), $MachinePrecision], 7.053942751863652e+25], N[(N[(N[(t$95$3 * N[(N[Cos[y], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(N[Sin[y], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], t$95$5]]]]]]]
\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{z \cdot t}{3}\\
t_2 := \frac{a}{b \cdot 3}\\
t_3 := 2 \cdot \sqrt{x}\\
t_4 := \sqrt{t_3}\\
t_5 := \mathsf{fma}\left(t_4, t_4 \cdot \cos y, -t_2\right)\\
\mathbf{if}\;z \cdot t \leq -3.4987150309268354 \cdot 10^{+47}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;z \cdot t \leq 7.053942751863652 \cdot 10^{+25}:\\
\;\;\;\;\left(t_3 \cdot \left(\cos y \cdot \cos t_1\right) + t_3 \cdot \left(\sin y \cdot \sin t_1\right)\right) - t_2\\
\mathbf{else}:\\
\;\;\;\;t_5\\
\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.5 |
|---|---|
| Target | 19.3 |
| Herbie | 17.0 |
if (*.f64 z t) < -3.4987150309268354e47 or 7.0539427518636517e25 < (*.f64 z t) Initial program 42.8
Taylor expanded in z around 0 33.9
Applied egg-rr33.9
if -3.4987150309268354e47 < (*.f64 z t) < 7.0539427518636517e25Initial program 3.5
Applied egg-rr2.8
Final simplification17.0
herbie shell --seed 2022133
(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))))