
(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 15 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 (+ (pow (* a (sin (fma (/ angle 180.0) (PI) (/ (PI) 2.0)))) 2.0) (pow (* b (sin (* (* (PI) angle) 0.005555555555555556))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\mathsf{fma}\left(\frac{angle}{180}, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 78.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6478.6
Applied rewrites78.6%
lift-PI.f64N/A
add-cbrt-cubeN/A
lower-cbrt.f64N/A
rem-cube-cbrtN/A
add-cbrt-cubeN/A
lift-PI.f64N/A
lower-pow.f6478.6
Applied rewrites78.6%
Taylor expanded in angle around inf
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.7
Applied rewrites78.7%
(FPCore (a b angle) :precision binary64 (+ (* (pow (sin (* (PI) (fma 0.005555555555555556 angle 0.5))) 2.0) (* a a)) (pow (* b (sin (* (* (PI) angle) 0.005555555555555556))) 2.0)))
\begin{array}{l}
\\
{\sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(0.005555555555555556, angle, 0.5\right)\right)}^{2} \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 78.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6478.6
Applied rewrites78.6%
lift-PI.f64N/A
add-cbrt-cubeN/A
lower-cbrt.f64N/A
rem-cube-cbrtN/A
add-cbrt-cubeN/A
lift-PI.f64N/A
lower-pow.f6478.6
Applied rewrites78.6%
Taylor expanded in angle around inf
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.7
Applied rewrites78.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-PI.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.7
Applied rewrites78.7%
Final simplification78.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (PI) (fma 0.005555555555555556 angle 0.5)))) 2.0) (pow (* b (sin (* (* (PI) angle) 0.005555555555555556))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(0.005555555555555556, angle, 0.5\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 78.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6478.6
Applied rewrites78.6%
lift-PI.f64N/A
add-cbrt-cubeN/A
lower-cbrt.f64N/A
rem-cube-cbrtN/A
add-cbrt-cubeN/A
lift-PI.f64N/A
lower-pow.f6478.6
Applied rewrites78.6%
Taylor expanded in angle around inf
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.7
Applied rewrites78.7%
Taylor expanded in angle around inf
lower-sin.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-PI.f64N/A
lower-fma.f6478.7
Applied rewrites78.7%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (* 0.005555555555555556 (PI)) angle))) (+ (pow (* (cos t_0) a) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\\
{\left(\cos t\_0 \cdot a\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 78.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.1%
Applied rewrites78.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* 0.5 (PI)))) 2.0) (pow (* b (sin (* (* (PI) angle) 0.005555555555555556))) 2.0)))
\begin{array}{l}
\\
{\left(a \cdot \sin \left(0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 78.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6478.6
Applied rewrites78.6%
lift-PI.f64N/A
add-cbrt-cubeN/A
lower-cbrt.f64N/A
rem-cube-cbrtN/A
add-cbrt-cubeN/A
lift-PI.f64N/A
lower-pow.f6478.6
Applied rewrites78.6%
Taylor expanded in angle around inf
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.7
Applied rewrites78.7%
Taylor expanded in angle around 0
lower-sin.f64N/A
lower-*.f64N/A
lower-PI.f6478.4
Applied rewrites78.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* 1.0 a) 2.0) (pow (* b (sin (* (* 0.005555555555555556 (PI)) angle))) 2.0)))
\begin{array}{l}
\\
{\left(1 \cdot a\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)\right)}^{2}
\end{array}
Initial program 78.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.1%
Applied rewrites78.5%
Taylor expanded in angle around 0
Applied rewrites78.3%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.75e+149)
(fma
(fma
(* (* 3.08641975308642e-5 (* b b)) (PI))
(PI)
(*
(* (* 0.5 (* a a)) -0.5)
(fma (* (PI) (PI)) 0.0001234567901234568 0.0)))
(* angle angle)
(* a a))
(pow (* (pow a -1.0) (pow a -1.0)) -1.0)))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.75 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), \left(\left(0.5 \cdot \left(a \cdot a\right)\right) \cdot -0.5\right) \cdot \mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.0001234567901234568, 0\right)\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;{\left({a}^{-1} \cdot {a}^{-1}\right)}^{-1}\\
\end{array}
\end{array}
if a < 1.75000000000000006e149Initial program 75.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.6%
Applied rewrites64.0%
Taylor expanded in angle around 0
Applied rewrites51.6%
if 1.75000000000000006e149 < a Initial program 100.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Final simplification57.6%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.75e+149)
(fma
(* (* -3.08641975308642e-5 (* (PI) (PI))) (- (* a a) (* b b)))
(* angle angle)
(* a a))
(pow (* (pow a -1.0) (pow a -1.0)) -1.0)))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.75 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(a \cdot a - b \cdot b\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;{\left({a}^{-1} \cdot {a}^{-1}\right)}^{-1}\\
\end{array}
\end{array}
if a < 1.75000000000000006e149Initial program 75.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites51.5%
if 1.75000000000000006e149 < a Initial program 100.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Final simplification57.6%
(FPCore (a b angle)
:precision binary64
(if (<= angle 52.0)
(+
(*
(fma -3.08641975308642e-5 (* (* (* (PI) (PI)) angle) angle) 1.0)
(* a a))
(pow (* b (sin (* (PI) (/ angle 180.0)))) 2.0))
(fma
1.0
(* a a)
(* (pow (sin (* (* (PI) 0.005555555555555556) angle)) 2.0) (* b b)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 52:\\
\;\;\;\;\mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5}, \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right) \cdot angle, 1\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, a \cdot a, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)}^{2} \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if angle < 52Initial program 87.3%
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-*.f6474.5
Applied rewrites74.5%
if 52 < angle Initial program 55.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.6%
Taylor expanded in angle around 0
Applied rewrites56.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (* (PI) 0.005555555555555556) angle)))
(if (<= angle 55.0)
(fma
(pow (cos t_0) 2.0)
(* a a)
(* (* 3.08641975308642e-5 (* (* (* angle angle) b) b)) (* (PI) (PI))))
(fma 1.0 (* a a) (* (pow (sin t_0) 2.0) (* b b))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\\
\mathbf{if}\;angle \leq 55:\\
\;\;\;\;\mathsf{fma}\left({\cos t\_0}^{2}, a \cdot a, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\left(angle \cdot angle\right) \cdot b\right) \cdot b\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, a \cdot a, {\sin t\_0}^{2} \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if angle < 55Initial program 87.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites75.8%
Taylor expanded in angle around 0
Applied rewrites77.7%
if 55 < angle Initial program 55.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.6%
Taylor expanded in angle around 0
Applied rewrites56.1%
(FPCore (a b angle)
:precision binary64
(if (<= angle 7.3e-146)
(* a a)
(fma
1.0
(* a a)
(* (pow (sin (* (* (PI) 0.005555555555555556) angle)) 2.0) (* b b)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 7.3 \cdot 10^{-146}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, a \cdot a, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)}^{2} \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if angle < 7.29999999999999965e-146Initial program 85.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.8
Applied rewrites57.8%
if 7.29999999999999965e-146 < angle Initial program 67.9%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.9%
Taylor expanded in angle around 0
Applied rewrites67.1%
(FPCore (a b angle)
:precision binary64
(if (<= a 1e-156)
(* (pow (sin (* (* (PI) angle) 0.005555555555555556)) 2.0) (* b b))
(if (<= a 3.1e+148)
(fma
(fma
(* (* 3.08641975308642e-5 (* b b)) (PI))
(PI)
(*
(* (* 0.5 (* a a)) -0.5)
(fma (* (PI) (PI)) 0.0001234567901234568 0.0)))
(* angle angle)
(* a a))
(sqrt (pow a 4.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 10^{-156}:\\
\;\;\;\;{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2} \cdot \left(b \cdot b\right)\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), \left(\left(0.5 \cdot \left(a \cdot a\right)\right) \cdot -0.5\right) \cdot \mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.0001234567901234568, 0\right)\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{a}^{4}}\\
\end{array}
\end{array}
if a < 1.00000000000000004e-156Initial program 76.6%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6477.0
Applied rewrites77.0%
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-*.f6449.0
Applied rewrites49.0%
if 1.00000000000000004e-156 < a < 3.09999999999999975e148Initial program 72.9%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.4%
Applied rewrites61.4%
Taylor expanded in angle around 0
Applied rewrites54.4%
if 3.09999999999999975e148 < a Initial program 97.7%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Applied rewrites97.3%
Final simplification56.6%
(FPCore (a b angle)
:precision binary64
(if (<= a 1e-156)
(* (pow (sin (* (* (PI) 0.005555555555555556) angle)) 2.0) (* b b))
(if (<= a 3.1e+148)
(fma
(fma
(* (* 3.08641975308642e-5 (* b b)) (PI))
(PI)
(*
(* (* 0.5 (* a a)) -0.5)
(fma (* (PI) (PI)) 0.0001234567901234568 0.0)))
(* angle angle)
(* a a))
(sqrt (pow a 4.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 10^{-156}:\\
\;\;\;\;{\sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)}^{2} \cdot \left(b \cdot b\right)\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), \left(\left(0.5 \cdot \left(a \cdot a\right)\right) \cdot -0.5\right) \cdot \mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.0001234567901234568, 0\right)\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{a}^{4}}\\
\end{array}
\end{array}
if a < 1.00000000000000004e-156Initial program 76.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6449.0
Applied rewrites49.0%
if 1.00000000000000004e-156 < a < 3.09999999999999975e148Initial program 72.9%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.4%
Applied rewrites61.4%
Taylor expanded in angle around 0
Applied rewrites54.4%
if 3.09999999999999975e148 < a Initial program 97.7%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Applied rewrites97.3%
(FPCore (a b angle)
:precision binary64
(if (<= a 3.1e+148)
(fma
(fma
(* (* 3.08641975308642e-5 (* b b)) (PI))
(PI)
(*
(* (* 0.5 (* a a)) -0.5)
(fma (* (PI) (PI)) 0.0001234567901234568 0.0)))
(* angle angle)
(* a a))
(sqrt (pow a 4.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.1 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), \left(\left(0.5 \cdot \left(a \cdot a\right)\right) \cdot -0.5\right) \cdot \mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.0001234567901234568, 0\right)\right), angle \cdot angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{a}^{4}}\\
\end{array}
\end{array}
if a < 3.09999999999999975e148Initial program 75.5%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.8%
Applied rewrites64.2%
Taylor expanded in angle around 0
Applied rewrites51.8%
if 3.09999999999999975e148 < a Initial program 97.7%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Applied rewrites97.3%
(FPCore (a b angle) :precision binary64 (* a a))
double code(double a, double b, double angle) {
return a * a;
}
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)
use fmin_fmax_functions
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 78.4%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6452.0
Applied rewrites52.0%
herbie shell --seed 2024364
(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)))