Average Error: 20.3 → 20.3
Time: 22.5s
Precision: binary64
Cost: 97472
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
\[\begin{array}{l} t_0 := \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 1\right)\\ {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left({\left(\sqrt[3]{\cos t_0}\right)}^{3}, \cos 1, \sin t_0 \cdot \sin 1\right)\right)}^{2} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+
  (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
  (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (fma 0.005555555555555556 (* angle PI) 1.0)))
   (+
    (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
    (pow
     (* b (fma (pow (cbrt (cos t_0)) 3.0) (cos 1.0) (* (sin t_0) (sin 1.0))))
     2.0))))
double code(double a, double b, double angle) {
	return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
double code(double a, double b, double angle) {
	double t_0 = fma(0.005555555555555556, (angle * ((double) M_PI)), 1.0);
	return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * fma(pow(cbrt(cos(t_0)), 3.0), cos(1.0), (sin(t_0) * sin(1.0)))), 2.0);
}
function code(a, b, angle)
	return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0))
end
function code(a, b, angle)
	t_0 = fma(0.005555555555555556, Float64(angle * pi), 1.0)
	return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * fma((cbrt(cos(t_0)) ^ 3.0), cos(1.0), Float64(sin(t_0) * sin(1.0)))) ^ 2.0))
end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[Power[N[Power[N[Cos[t$95$0], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[t$95$0], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 1\right)\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left({\left(\sqrt[3]{\cos t_0}\right)}^{3}, \cos 1, \sin t_0 \cdot \sin 1\right)\right)}^{2}
\end{array}

Error

Derivation

  1. Initial program 20.3

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Applied egg-rr24.5

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)}\right)}^{2} \]
  3. Applied egg-rr20.3

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \color{blue}{\left(\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right) + 1\right) \cdot \cos 1 + \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right) + 1\right) \cdot \sin 1\right)}\right)}^{2} \]
  4. Simplified20.3

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \color{blue}{\mathsf{fma}\left(\cos \left(\mathsf{fma}\left(0.005555555555555556, \pi \cdot angle, 1\right)\right), \cos 1, \sin \left(\mathsf{fma}\left(0.005555555555555556, \pi \cdot angle, 1\right)\right) \cdot \sin 1\right)}\right)}^{2} \]
    Proof
    (fma.f64 (cos.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (fma.f64 1/180 (Rewrite<= *-commutative_binary64 (*.f64 angle (PI.f64))) 1)) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 1/180 (*.f64 angle (PI.f64))) 1))) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 angle (PI.f64)) 1/180)) 1)) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (*.f64 (Rewrite=> *-commutative_binary64 (*.f64 (PI.f64) angle)) 1/180) 1)) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (Rewrite<= associate-*r*_binary64 (*.f64 (PI.f64) (*.f64 angle 1/180))) 1)) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (*.f64 (PI.f64) angle) 1)) (sin.f64 1))): 17 points increase in error, 22 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (cos.f64 1) (*.f64 (sin.f64 (fma.f64 1/180 (Rewrite<= *-commutative_binary64 (*.f64 angle (PI.f64))) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (cos.f64 1) (*.f64 (sin.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 1/180 (*.f64 angle (PI.f64))) 1))) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (cos.f64 1) (*.f64 (sin.f64 (+.f64 (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 angle (PI.f64)) 1/180)) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (cos.f64 1) (*.f64 (sin.f64 (+.f64 (*.f64 (Rewrite=> *-commutative_binary64 (*.f64 (PI.f64) angle)) 1/180) 1)) (sin.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 (cos.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (cos.f64 1) (*.f64 (sin.f64 (+.f64 (Rewrite<= associate-*r*_binary64 (*.f64 (PI.f64) (*.f64 angle 1/180))) 1)) (sin.f64 1))): 18 points increase in error, 21 points decrease in error
    (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (cos.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (cos.f64 1)) (*.f64 (sin.f64 (+.f64 (*.f64 (PI.f64) (*.f64 angle 1/180)) 1)) (sin.f64 1)))): 21 points increase in error, 18 points decrease in error
  5. Applied egg-rr20.3

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(0.005555555555555556, \pi \cdot angle, 1\right)\right)}\right)}^{3}}, \cos 1, \sin \left(\mathsf{fma}\left(0.005555555555555556, \pi \cdot angle, 1\right)\right) \cdot \sin 1\right)\right)}^{2} \]
  6. Final simplification20.3

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left({\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 1\right)\right)}\right)}^{3}, \cos 1, \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 1\right)\right) \cdot \sin 1\right)\right)}^{2} \]

Alternatives

Alternative 1
Error20.3
Cost84864
\[\begin{array}{l} t_0 := \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 1\right)\\ {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left(\left(1 + \cos t_0\right) + -1, \cos 1, \sin t_0 \cdot \sin 1\right)\right)}^{2} \end{array} \]
Alternative 2
Error20.3
Cost84608
\[\begin{array}{l} t_0 := \mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 1\right)\\ {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left(\cos t_0, \cos 1, \sin t_0 \cdot \sin 1\right)\right)}^{2} \end{array} \]
Alternative 3
Error20.3
Cost71616
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\sqrt[3]{angle}\right)}^{2} \cdot \left({\left(\sqrt[3]{\sqrt[3]{angle}}\right)}^{3} \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
Alternative 4
Error20.3
Cost71552
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\sqrt[3]{angle}\right)}^{2}\right)\right) \cdot \left(\sqrt[3]{angle} \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
Alternative 5
Error20.3
Cost52224
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\sqrt[3]{angle \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)}^{3}\right)\right)}^{2} \]
Alternative 6
Error20.3
Cost39360
\[{\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} \]
Alternative 7
Error20.3
Cost39360
\[\begin{array}{l} t_0 := angle \cdot \frac{\pi}{180}\\ {\left(b \cdot \cos t_0\right)}^{2} + {\left(a \cdot \sin t_0\right)}^{2} \end{array} \]
Alternative 8
Error20.3
Cost39360
\[{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
Alternative 9
Error20.3
Cost39360
\[{\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} \]
Alternative 10
Error20.4
Cost26240
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {b}^{2} \]
Alternative 11
Error20.3
Cost26240
\[{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2} \]
Alternative 12
Error20.4
Cost26240
\[{\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {b}^{2} \]
Alternative 13
Error20.9
Cost20552
\[\begin{array}{l} t_0 := {b}^{2} + \left(0.5 + \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot -0.5\right) \cdot \left(a \cdot a\right)\\ \mathbf{if}\;angle \leq -0.0032:\\ \;\;\;\;t_0\\ \mathbf{elif}\;angle \leq 6.6 \cdot 10^{-28}:\\ \;\;\;\;{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot angle\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 14
Error23.7
Cost20360
\[\begin{array}{l} t_0 := \pi \cdot \left(a \cdot angle\right)\\ \mathbf{if}\;a \leq -5 \cdot 10^{+17}:\\ \;\;\;\;{b}^{2} + {\left(0.005555555555555556 \cdot t_0\right)}^{2}\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{-162}:\\ \;\;\;\;{b}^{2} + {\left(\pi \cdot 0.005555555555555556\right)}^{2} \cdot \left(angle \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot angle\right) \cdot \left(\pi \cdot t_0\right)\right)\\ \end{array} \]
Alternative 15
Error26.1
Cost20096
\[{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot angle\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right) \]
Alternative 16
Error23.8
Cost20096
\[{b}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(1 + \left(a \cdot \pi + -1\right)\right)\right)\right)}^{2} \]
Alternative 17
Error26.1
Cost19840
\[{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(a \cdot \left(angle \cdot \pi\right)\right)}^{2} \]
Alternative 18
Error26.1
Cost19840
\[{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(\pi \cdot \left(a \cdot angle\right)\right)}^{2} \]

Error

Reproduce

herbie shell --seed 2022335 
(FPCore (a b angle)
  :name "ab-angle->ABCF A"
  :precision binary64
  (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))