
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (PI) (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (PI) (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (pow (PI) 0.25)))
(+
(pow (* a (cos (* (PI) (/ angle 180.0)))) 2.0)
(pow
(* b (sin (* t_0 (* t_0 (* (* (sqrt (PI)) angle) 0.005555555555555556)))))
2.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\mathsf{PI}\left(\right)}^{0.25}\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(t\_0 \cdot \left(t\_0 \cdot \left(\left(\sqrt{\mathsf{PI}\left(\right)} \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 73.8%
lift-*.f64N/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*l*N/A
rem-square-sqrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/2N/A
sqrt-pow1N/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/2N/A
sqrt-pow1N/A
lower-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
associate-*r*N/A
Applied rewrites73.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (PI) (/ angle 180.0)))
(t_1 (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0)))
(t_2 (* (PI) (PI)))
(t_3 (sqrt (PI))))
(if (<= t_1 5e-286)
(fma
(* (* (- a b) (+ b a)) (* (* t_2 -3.08641975308642e-5) angle))
angle
(* a a))
(if (<= t_1 1e+202)
(+
(fma
(* -3.08641975308642e-5 (* angle angle))
(* (* (* a a) (PI)) (PI))
(* a a))
(pow (* b (sin (* (* (* t_3 angle) 0.005555555555555556) t_3))) 2.0))
(fma
(* (* (* 3.08641975308642e-5 (* angle angle)) b) t_2)
b
(pow (* (cos (* (* 0.005555555555555556 angle) (PI))) a) 2.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_1 := {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}\\
t_2 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
t_3 := \sqrt{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(a - b\right) \cdot \left(b + a\right)\right) \cdot \left(\left(t\_2 \cdot -3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right), angle, a \cdot a\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+202}:\\
\;\;\;\;\mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right), \left(\left(a \cdot a\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right), a \cdot a\right) + {\left(b \cdot \sin \left(\left(\left(t\_3 \cdot angle\right) \cdot 0.005555555555555556\right) \cdot t\_3\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot t\_2, b, {\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right)}^{2}\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 5.00000000000000037e-286Initial program 96.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites80.7%
Applied rewrites96.2%
if 5.00000000000000037e-286 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 9.999999999999999e201Initial program 55.0%
*-rgt-identityN/A
metadata-evalN/A
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
times-fracN/A
lift-PI.f64N/A
*-rgt-identity-revN/A
add-sqr-sqrtN/A
times-fracN/A
un-div-invN/A
clear-numN/A
lift-/.f64N/A
/-rgt-identityN/A
lower-*.f64N/A
Applied rewrites55.3%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f64N/A
unpow2N/A
Applied rewrites48.3%
if 9.999999999999999e201 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites85.4%
Taylor expanded in angle around 0
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6484.0
Applied rewrites84.0%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (PI) (/ angle 180.0)))
(t_1 (pow (* b (sin t_0)) 2.0))
(t_2 (+ (pow (* a (cos t_0)) 2.0) t_1))
(t_3 (* (PI) (PI))))
(if (<= t_2 1e-192)
(fma
(* (* (- a b) (+ b a)) (* (* t_3 -3.08641975308642e-5) angle))
angle
(* a a))
(if (<= t_2 1e+202)
(+
(* (fma -3.08641975308642e-5 (* (* t_3 angle) angle) 1.0) (* a a))
t_1)
(fma
(* (* (* 3.08641975308642e-5 (* angle angle)) b) t_3)
b
(pow (* (cos (* (* 0.005555555555555556 angle) (PI))) a) 2.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_1 := {\left(b \cdot \sin t\_0\right)}^{2}\\
t_2 := {\left(a \cdot \cos t\_0\right)}^{2} + t\_1\\
t_3 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;t\_2 \leq 10^{-192}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(a - b\right) \cdot \left(b + a\right)\right) \cdot \left(\left(t\_3 \cdot -3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right), angle, a \cdot a\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+202}:\\
\;\;\;\;\mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5}, \left(t\_3 \cdot angle\right) \cdot angle, 1\right) \cdot \left(a \cdot a\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot t\_3, b, {\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right)}^{2}\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 1.0000000000000001e-192Initial program 81.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites68.0%
Applied rewrites78.1%
if 1.0000000000000001e-192 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 9.999999999999999e201Initial program 55.2%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6448.7
Applied rewrites48.7%
if 9.999999999999999e201 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites85.4%
Taylor expanded in angle around 0
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6484.0
Applied rewrites84.0%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (pow (PI) 0.25)))
(+
(pow (* 1.0 a) 2.0)
(pow
(* b (sin (* t_0 (* t_0 (* (* (sqrt (PI)) angle) 0.005555555555555556)))))
2.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\mathsf{PI}\left(\right)}^{0.25}\\
{\left(1 \cdot a\right)}^{2} + {\left(b \cdot \sin \left(t\_0 \cdot \left(t\_0 \cdot \left(\left(\sqrt{\mathsf{PI}\left(\right)} \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 73.8%
lift-*.f64N/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*l*N/A
rem-square-sqrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/2N/A
sqrt-pow1N/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/2N/A
sqrt-pow1N/A
lower-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
associate-*r*N/A
Applied rewrites73.9%
Applied rewrites73.9%
Taylor expanded in angle around 0
Applied rewrites73.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sqrt (PI))))
(+
(pow (* a (cos (* (PI) (/ angle 180.0)))) 2.0)
(pow (* b (sin (* (* (* t_0 angle) 0.005555555555555556) t_0))) 2.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\left(t\_0 \cdot angle\right) \cdot 0.005555555555555556\right) \cdot t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 73.8%
*-rgt-identityN/A
metadata-evalN/A
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
times-fracN/A
lift-PI.f64N/A
*-rgt-identity-revN/A
add-sqr-sqrtN/A
times-fracN/A
un-div-invN/A
clear-numN/A
lift-/.f64N/A
/-rgt-identityN/A
lower-*.f64N/A
Applied rewrites73.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sqrt (PI))))
(+
(pow (* (cos (* -0.005555555555555556 (* angle (PI)))) a) 2.0)
(pow (* b (sin (* (* (* t_0 angle) 0.005555555555555556) t_0))) 2.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
{\left(\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot a\right)}^{2} + {\left(b \cdot \sin \left(\left(\left(t\_0 \cdot angle\right) \cdot 0.005555555555555556\right) \cdot t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 73.8%
*-rgt-identityN/A
metadata-evalN/A
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
times-fracN/A
lift-PI.f64N/A
*-rgt-identity-revN/A
add-sqr-sqrtN/A
times-fracN/A
un-div-invN/A
clear-numN/A
lift-/.f64N/A
/-rgt-identityN/A
lower-*.f64N/A
Applied rewrites73.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lift-*.f64N/A
lift-cos.f64N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-squareN/A
lower-*.f64N/A
Applied rewrites73.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* (PI) (/ angle 180.0)))) 2.0) (pow (* b (sin (/ (* angle (PI)) 180.0))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle \cdot \mathsf{PI}\left(\right)}{180}\right)\right)}^{2}
\end{array}
Initial program 73.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6473.9
Applied rewrites73.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (PI))))
(+
(pow (* (cos (* -0.005555555555555556 t_0)) a) 2.0)
(pow (* b (sin (/ t_0 180.0))) 2.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
{\left(\cos \left(-0.005555555555555556 \cdot t\_0\right) \cdot a\right)}^{2} + {\left(b \cdot \sin \left(\frac{t\_0}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 73.8%
lift-*.f64N/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*l*N/A
rem-square-sqrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/2N/A
sqrt-pow1N/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/2N/A
sqrt-pow1N/A
lower-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
associate-*r*N/A
Applied rewrites73.9%
Applied rewrites73.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
lift-pow.f64N/A
pow-powN/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites73.9%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (* 0.005555555555555556 angle) (PI)))) (fma (pow (cos t_0) 2.0) (* a a) (pow (* (sin t_0) b) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
\mathsf{fma}\left({\cos t\_0}^{2}, a \cdot a, {\left(\sin t\_0 \cdot b\right)}^{2}\right)
\end{array}
\end{array}
Initial program 73.8%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lower-fma.f64N/A
Applied rewrites73.9%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (* 0.005555555555555556 angle) (PI)))) (+ (pow (* (sin t_0) b) 2.0) (pow (* (cos t_0) a) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
{\left(\sin t\_0 \cdot b\right)}^{2} + {\left(\cos t\_0 \cdot a\right)}^{2}
\end{array}
\end{array}
Initial program 73.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.8
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
metadata-eval73.9
Applied rewrites73.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a 1.0) 2.0) (pow (* b (sin (* (PI) (/ angle 180.0)))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 73.8%
Taylor expanded in angle around 0
Applied rewrites73.8%
(FPCore (a b angle)
:precision binary64
(if (<= a 9.4e-160)
(* (pow (sin (* (* (PI) angle) 0.005555555555555556)) 2.0) (* b b))
(fma
(* (* (* (* 3.08641975308642e-5 (* angle angle)) (PI)) (PI)) b)
b
(pow (* (cos (* (* 0.005555555555555556 angle) (PI))) a) 2.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.4 \cdot 10^{-160}:\\
\;\;\;\;{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2} \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, b, {\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right)}^{2}\right)\\
\end{array}
\end{array}
if a < 9.3999999999999995e-160Initial program 74.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6435.1
Applied rewrites35.1%
if 9.3999999999999995e-160 < a Initial program 73.3%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites72.0%
Taylor expanded in angle around 0
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6468.7
Applied rewrites68.7%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.85e-159)
(* (pow (sin (* (* (PI) angle) 0.005555555555555556)) 2.0) (* b b))
(fma
(* (* (* 3.08641975308642e-5 (* angle angle)) b) (* (PI) (PI)))
b
(pow (* (cos (* (* 0.005555555555555556 angle) (PI))) a) 2.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.85 \cdot 10^{-159}:\\
\;\;\;\;{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2} \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), b, {\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right)}^{2}\right)\\
\end{array}
\end{array}
if a < 1.8499999999999999e-159Initial program 74.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6435.1
Applied rewrites35.1%
if 1.8499999999999999e-159 < a Initial program 73.3%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites72.0%
Taylor expanded in angle around 0
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6468.7
Applied rewrites68.7%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.1e+69)
(fma
(* (* (- a b) (+ b a)) (* (* (* (PI) (PI)) -3.08641975308642e-5) angle))
angle
(* a a))
(* a a)))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.1 \cdot 10^{+69}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(a - b\right) \cdot \left(b + a\right)\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot -3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right), angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 1.1000000000000001e69Initial program 70.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites38.5%
Applied rewrites44.4%
if 1.1000000000000001e69 < a Initial program 88.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6489.3
Applied rewrites89.3%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.2e+69)
(fma
(* (* -3.08641975308642e-5 (* (PI) (PI))) (* (- b) b))
(* angle angle)
(* a a))
(* a a)))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.2 \cdot 10^{+69}:\\
\;\;\;\;\mathsf{fma}\left(\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(-b\right) \cdot b\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 1.2000000000000001e69Initial program 70.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites38.5%
Taylor expanded in a around 0
Applied rewrites53.8%
if 1.2000000000000001e69 < a Initial program 88.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6489.3
Applied rewrites89.3%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.2e+69)
(fma
(* (* (* 3.08641975308642e-5 (* b b)) (PI)) (PI))
(* angle angle)
(* a a))
(* a a)))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.2 \cdot 10^{+69}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 1.2000000000000001e69Initial program 70.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites38.5%
Taylor expanded in a around 0
Applied rewrites53.8%
if 1.2000000000000001e69 < a Initial program 88.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6489.3
Applied rewrites89.3%
(FPCore (a b angle) :precision binary64 (if (<= b 1.18e+229) (* a a) (* (* (* angle angle) 3.08641975308642e-5) (* (* (* (PI) (PI)) b) b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.18 \cdot 10^{+229}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\\
\end{array}
\end{array}
if b < 1.18e229Initial program 72.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.9
Applied rewrites57.9%
if 1.18e229 < b Initial program 99.8%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites62.5%
Taylor expanded in a around 0
Applied rewrites81.3%
(FPCore (a b angle) :precision binary64 (* a a))
double code(double a, double b, double angle) {
return a * a;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = a * a
end function
public static double code(double a, double b, double angle) {
return a * a;
}
def code(a, b, angle): return a * a
function code(a, b, angle) return Float64(a * a) end
function tmp = code(a, b, angle) tmp = a * a; end
code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
\\
a \cdot a
\end{array}
Initial program 73.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6456.4
Applied rewrites56.4%
herbie shell --seed 2024305
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* (PI) (/ angle 180.0)))) 2.0) (pow (* b (sin (* (PI) (/ angle 180.0)))) 2.0)))