
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) (PI)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) (PI)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (+ 0.5 (* 0.5 (sin (+ (* (* (PI) (/ angle_m 180.0)) (- 2.0)) (/ (PI) 2.0))))) (* b b) (pow (* (sin (* (* (PI) angle_m) 0.005555555555555556)) a) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(0.5 + 0.5 \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right) \cdot \left(-2\right) + \frac{\mathsf{PI}\left(\right)}{2}\right), b \cdot b, {\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot 0.005555555555555556\right) \cdot a\right)}^{2}\right)
\end{array}
Initial program 82.8%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites82.8%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6482.8
Applied rewrites82.8%
Taylor expanded in a around 0
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lift-*.f6482.8
Applied rewrites82.8%
lift-cos.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6482.8
Applied rewrites82.8%
Final simplification82.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (+ 0.5 (* 0.5 (cos (* 2.0 (* (PI) (/ angle_m 180.0)))))) (* b b) (pow (* (sin (* (* (PI) angle_m) 0.005555555555555556)) a) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right), b \cdot b, {\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot 0.005555555555555556\right) \cdot a\right)}^{2}\right)
\end{array}
Initial program 82.8%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites82.8%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6482.8
Applied rewrites82.8%
Taylor expanded in a around 0
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lift-*.f6482.8
Applied rewrites82.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (+ 0.5 (* 0.5 (cos (* 2.0 (* (PI) (* 0.005555555555555556 angle_m)))))) (* b b) (pow (* (sin (* (* (PI) angle_m) 0.005555555555555556)) a) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right), b \cdot b, {\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot 0.005555555555555556\right) \cdot a\right)}^{2}\right)
\end{array}
Initial program 82.8%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites82.8%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6482.8
Applied rewrites82.8%
Taylor expanded in a around 0
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lift-*.f6482.8
Applied rewrites82.8%
Taylor expanded in angle around 0
lower-*.f6482.8
Applied rewrites82.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* (sin (* (PI) (* 0.005555555555555556 angle_m))) a))) (fma t_0 t_0 (* b b))))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right) \cdot a\\
\mathsf{fma}\left(t\_0, t\_0, b \cdot b\right)
\end{array}
\end{array}
Initial program 82.8%
Taylor expanded in angle around 0
lower-*.f6482.8
Applied rewrites82.8%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lower-fma.f64N/A
Applied rewrites82.8%
Taylor expanded in angle around 0
pow2N/A
lift-*.f6482.7
Applied rewrites82.7%
Final simplification82.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* (* 0.005555555555555556 angle_m) (PI)))) 2.0) (* b b)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + b \cdot b
\end{array}
Initial program 82.8%
Taylor expanded in angle around 0
lower-*.f6482.8
Applied rewrites82.8%
Taylor expanded in angle around 0
*-commutativeN/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
*-commutativeN/A
sin-+PI/2-revN/A
pow2N/A
lift-*.f6482.7
Applied rewrites82.7%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) angle_m)))
(if (<= b 5.8e-156)
(pow (* (sin (* t_0 0.005555555555555556)) a) 2.0)
(if (<= b 2.3e+143)
(*
(+ (/ (* (pow (* t_0 a) 2.0) 3.08641975308642e-5) (* b b)) 1.0)
(* b b))
(* (fma (cos (* 0.011111111111111112 t_0)) 0.5 0.5) (* b b))))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\_m\\
\mathbf{if}\;b \leq 5.8 \cdot 10^{-156}:\\
\;\;\;\;{\left(\sin \left(t\_0 \cdot 0.005555555555555556\right) \cdot a\right)}^{2}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+143}:\\
\;\;\;\;\left(\frac{{\left(t\_0 \cdot a\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}}{b \cdot b} + 1\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot t\_0\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if b < 5.80000000000000041e-156Initial program 80.8%
Taylor expanded in a around inf
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6448.2
Applied rewrites48.2%
if 5.80000000000000041e-156 < b < 2.3e143Initial program 78.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites58.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites59.8%
Taylor expanded in a around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
*-commutativeN/A
unpow-prod-downN/A
lift-*.f64N/A
lift-PI.f64N/A
unpow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6473.2
Applied rewrites73.2%
if 2.3e143 < b Initial program 97.9%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites97.9%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6497.9
Applied rewrites97.9%
Taylor expanded in a around 0
Applied rewrites97.9%
Final simplification60.5%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) angle_m)) (t_1 (* t_0 a)))
(if (<= b 8.5e-161)
(* (* t_0 (* a t_1)) 3.08641975308642e-5)
(if (<= b 2.3e+143)
(* (+ (/ (* (pow t_1 2.0) 3.08641975308642e-5) (* b b)) 1.0) (* b b))
(* (fma (cos (* 0.011111111111111112 t_0)) 0.5 0.5) (* b b))))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\_m\\
t_1 := t\_0 \cdot a\\
\mathbf{if}\;b \leq 8.5 \cdot 10^{-161}:\\
\;\;\;\;\left(t\_0 \cdot \left(a \cdot t\_1\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+143}:\\
\;\;\;\;\left(\frac{{t\_1}^{2} \cdot 3.08641975308642 \cdot 10^{-5}}{b \cdot b} + 1\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot t\_0\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if b < 8.50000000000000054e-161Initial program 81.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites41.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6444.6
Applied rewrites44.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6444.6
Applied rewrites44.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
if 8.50000000000000054e-161 < b < 2.3e143Initial program 78.0%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites58.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites59.2%
Taylor expanded in a around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
*-commutativeN/A
unpow-prod-downN/A
lift-*.f64N/A
lift-PI.f64N/A
unpow-prod-downN/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6471.7
Applied rewrites71.7%
if 2.3e143 < b Initial program 97.9%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites97.9%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6497.9
Applied rewrites97.9%
Taylor expanded in a around 0
Applied rewrites97.9%
Final simplification59.3%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) angle_m)))
(if (<= a 2.1e-76)
(* (fma (cos (* 0.011111111111111112 t_0)) 0.5 0.5) (* b b))
(if (<= a 2.2e+148)
(fma
(* (pow (* (PI) a) 2.0) 3.08641975308642e-5)
(* angle_m angle_m)
(* b b))
(* (* t_0 (* a (* t_0 a))) 3.08641975308642e-5)))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\_m\\
\mathbf{if}\;a \leq 2.1 \cdot 10^{-76}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot t\_0\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)\\
\mathbf{elif}\;a \leq 2.2 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{PI}\left(\right) \cdot a\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}, angle\_m \cdot angle\_m, b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \left(a \cdot \left(t\_0 \cdot a\right)\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\\
\end{array}
\end{array}
if a < 2.09999999999999992e-76Initial program 81.1%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites81.1%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6481.1
Applied rewrites81.1%
Taylor expanded in a around 0
Applied rewrites66.6%
if 2.09999999999999992e-76 < a < 2.1999999999999999e148Initial program 74.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites37.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-pow.f6467.0
Applied rewrites67.0%
if 2.1999999999999999e148 < a Initial program 99.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites40.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6481.9
Applied rewrites81.9%
lift-pow.f64N/A
unpow2N/A
lower-*.f6481.9
Applied rewrites81.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6484.8
Applied rewrites84.8%
Final simplification69.4%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) angle_m)))
(if (<= a 3.6e+140)
(* (fma (cos (* 0.011111111111111112 t_0)) 0.5 0.5) (* b b))
(* (* t_0 (* a (* t_0 a))) 3.08641975308642e-5))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\_m\\
\mathbf{if}\;a \leq 3.6 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot t\_0\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \left(a \cdot \left(t\_0 \cdot a\right)\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\\
\end{array}
\end{array}
if a < 3.6e140Initial program 80.0%
lift-+.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites80.0%
lift-pow.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
sqr-cos-aN/A
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f6480.0
Applied rewrites80.0%
Taylor expanded in a around 0
Applied rewrites65.1%
if 3.6e140 < a Initial program 97.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites40.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6480.5
Applied rewrites80.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6480.5
Applied rewrites80.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
Final simplification68.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) angle_m)))
(if (<= a 3.6e+140)
(* b b)
(* (* t_0 (* a (* t_0 a))) 3.08641975308642e-5))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\_m\\
\mathbf{if}\;a \leq 3.6 \cdot 10^{+140}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \left(a \cdot \left(t\_0 \cdot a\right)\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\\
\end{array}
\end{array}
if a < 3.6e140Initial program 80.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6465.1
Applied rewrites65.1%
if 3.6e140 < a Initial program 97.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites40.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6480.5
Applied rewrites80.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6480.5
Applied rewrites80.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
Final simplification67.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* (* (PI) angle_m) a))) (if (<= a 3.6e+140) (* b b) (* t_0 (* t_0 3.08641975308642e-5)))))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot a\\
\mathbf{if}\;a \leq 3.6 \cdot 10^{+140}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_0 \cdot 3.08641975308642 \cdot 10^{-5}\right)\\
\end{array}
\end{array}
if a < 3.6e140Initial program 80.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6465.1
Applied rewrites65.1%
if 3.6e140 < a Initial program 97.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites40.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6480.5
Applied rewrites80.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6480.5
Applied rewrites80.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6480.6
Applied rewrites80.6%
Final simplification67.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* b b))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return b * b;
}
angle_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle_m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle_m
code = b * b
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return b * b;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return b * b
angle_m = abs(angle) function code(a, b, angle_m) return Float64(b * b) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = b * b; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
b \cdot b
\end{array}
Initial program 82.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6461.2
Applied rewrites61.2%
Final simplification61.2%
herbie shell --seed 2025037
(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)))