
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (PI) (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (PI) (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (/ angle_m 180.0) 2e+257)
(*
(* (sin (* 0.011111111111111112 (* (PI) angle_m))) (- b a))
(/ 1.0 (pow (+ a b) -1.0)))
(*
(* (- b a) (+ a b))
(*
(* 2.0 (sin (* (* 0.005555555555555556 angle_m) (PI))))
(cos (/ (* (cbrt (pow (PI) 3.0)) angle_m) -180.0)))))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+257}:\\
\;\;\;\;\left(\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right) \cdot \left(b - a\right)\right) \cdot \frac{1}{{\left(a + b\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(a + b\right)\right) \cdot \left(\left(2 \cdot \sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\_m}{-180}\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 2.00000000000000006e257Initial program 54.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites68.8%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6468.8
lift-+.f64N/A
+-commutativeN/A
lift-+.f6468.8
Applied rewrites68.8%
if 2.00000000000000006e257 < (/.f64 angle #s(literal 180 binary64)) Initial program 12.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites21.7%
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.f6435.6
Applied rewrites35.6%
Final simplification67.1%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (pow a 2.0)))
(t_1 (sin (* 0.011111111111111112 (* (PI) angle_m)))))
(*
angle_s
(if (<= t_0 -2e+307)
(* (* (* -0.011111111111111112 a) angle_m) (* (PI) a))
(if (<= t_0 5e-230) (* (* (- a) a) t_1) (* (* t_1 b) b))))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := {b}^{2} - {a}^{2}\\
t_1 := \sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+307}:\\
\;\;\;\;\left(\left(-0.011111111111111112 \cdot a\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-230}:\\
\;\;\;\;\left(\left(-a\right) \cdot a\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot b\right) \cdot b\\
\end{array}
\end{array}
\end{array}
if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -1.99999999999999997e307Initial program 54.0%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6459.3
Applied rewrites59.3%
Taylor expanded in b around 0
Applied rewrites59.3%
Applied rewrites76.3%
Applied rewrites76.4%
if -1.99999999999999997e307 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 5.00000000000000035e-230Initial program 54.8%
Applied rewrites24.0%
Taylor expanded in b around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
unpow2N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6455.4
Applied rewrites55.4%
if 5.00000000000000035e-230 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) Initial program 49.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.1%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6469.1
lift-+.f64N/A
+-commutativeN/A
lift-+.f6469.1
Applied rewrites69.1%
lift-PI.f64N/A
add-sqr-sqrtN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lift-PI.f64N/A
lower-sqrt.f6462.8
Applied rewrites62.8%
Taylor expanded in a around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
associate-*r*N/A
mul0-lftN/A
mul0-lftN/A
associate-*r*N/A
mul0-lftN/A
metadata-evalN/A
distribute-rgt1-inN/A
*-commutativeN/A
Applied rewrites65.0%
Final simplification64.8%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) angle_m)))
(*
angle_s
(if (<= (/ angle_m 180.0) 6.3e+232)
(*
(* (sin (* 0.011111111111111112 t_0)) (- b a))
(/ 1.0 (pow (+ a b) -1.0)))
(*
(*
(*
(sin (* (* 0.005555555555555556 angle_m) (cbrt (pow (PI) 3.0))))
2.0)
(cos (/ t_0 -180.0)))
(* (- b a) (+ a b)))))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\_m\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 6.3 \cdot 10^{+232}:\\
\;\;\;\;\left(\sin \left(0.011111111111111112 \cdot t\_0\right) \cdot \left(b - a\right)\right) \cdot \frac{1}{{\left(a + b\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \sqrt[3]{{\mathsf{PI}\left(\right)}^{3}}\right) \cdot 2\right) \cdot \cos \left(\frac{t\_0}{-180}\right)\right) \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 6.2999999999999995e232Initial program 54.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites70.2%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6470.2
lift-+.f64N/A
+-commutativeN/A
lift-+.f6470.2
Applied rewrites70.2%
if 6.2999999999999995e232 < (/.f64 angle #s(literal 180 binary64)) Initial program 19.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites25.0%
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.f6429.0
Applied rewrites29.0%
Final simplification66.8%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (sin (* 0.011111111111111112 (* (PI) angle_m)))))
(*
angle_s
(if (<= (- (pow b 2.0) (pow a 2.0)) 5e-230)
(* a (* t_0 (- b a)))
(* (* t_0 b) b)))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq 5 \cdot 10^{-230}:\\
\;\;\;\;a \cdot \left(t\_0 \cdot \left(b - a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot b\right) \cdot b\\
\end{array}
\end{array}
\end{array}
if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 5.00000000000000035e-230Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.5%
lift-+.f64N/A
unpow1N/A
sqr-powN/A
lower-fma.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6431.2
Applied rewrites31.2%
Taylor expanded in a around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identity64.5
Applied rewrites64.5%
if 5.00000000000000035e-230 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) Initial program 49.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.1%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6469.1
lift-+.f64N/A
+-commutativeN/A
lift-+.f6469.1
Applied rewrites69.1%
lift-PI.f64N/A
add-sqr-sqrtN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lift-PI.f64N/A
lower-sqrt.f6462.8
Applied rewrites62.8%
Taylor expanded in a around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
associate-*r*N/A
mul0-lftN/A
mul0-lftN/A
associate-*r*N/A
mul0-lftN/A
metadata-evalN/A
distribute-rgt1-inN/A
*-commutativeN/A
Applied rewrites65.0%
Final simplification64.7%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (sin (* 0.011111111111111112 (* (PI) angle_m)))))
(*
angle_s
(if (<= (- (pow b 2.0) (pow a 2.0)) 5e-230)
(* (* (- a) t_0) a)
(* (* t_0 b) b)))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq 5 \cdot 10^{-230}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\_0\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot b\right) \cdot b\\
\end{array}
\end{array}
\end{array}
if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 5.00000000000000035e-230Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.5%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6464.6
lift-+.f64N/A
+-commutativeN/A
lift-+.f6464.6
Applied rewrites64.6%
lift-PI.f64N/A
add-sqr-sqrtN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lift-PI.f64N/A
lower-sqrt.f6462.4
Applied rewrites62.4%
Taylor expanded in b around 0
*-commutativeN/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
Applied rewrites64.6%
if 5.00000000000000035e-230 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) Initial program 49.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.1%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6469.1
lift-+.f64N/A
+-commutativeN/A
lift-+.f6469.1
Applied rewrites69.1%
lift-PI.f64N/A
add-sqr-sqrtN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lift-PI.f64N/A
lower-sqrt.f6462.8
Applied rewrites62.8%
Taylor expanded in a around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
associate-*r*N/A
mul0-lftN/A
mul0-lftN/A
associate-*r*N/A
mul0-lftN/A
metadata-evalN/A
distribute-rgt1-inN/A
*-commutativeN/A
Applied rewrites65.0%
Final simplification64.8%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (* (sin (* 0.011111111111111112 (* (PI) angle_m))) (- b a)) (/ 1.0 (pow (+ a b) -1.0)))))
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right) \cdot \left(b - a\right)\right) \cdot \frac{1}{{\left(a + b\right)}^{-1}}\right)
\end{array}
Initial program 51.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites66.7%
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
lift-*.f64N/A
flip-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6466.7
lift-+.f64N/A
+-commutativeN/A
lift-+.f6466.7
Applied rewrites66.7%
Final simplification66.7%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (- (pow b 2.0) (pow a 2.0)) 1e-158)
(* (* (* -0.011111111111111112 a) angle_m) (* (PI) a))
(* (* (fma 0.0 (PI) (* (PI) b)) (* 0.011111111111111112 angle_m)) b))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq 10^{-158}:\\
\;\;\;\;\left(\left(-0.011111111111111112 \cdot a\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(0, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right) \cdot b\right) \cdot \left(0.011111111111111112 \cdot angle\_m\right)\right) \cdot b\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 1.00000000000000006e-158Initial program 54.1%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6453.5
Applied rewrites53.5%
Taylor expanded in b around 0
Applied rewrites53.5%
Applied rewrites58.2%
Applied rewrites58.3%
if 1.00000000000000006e-158 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) Initial program 49.4%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in b around 0
Applied rewrites13.1%
Applied rewrites13.8%
Taylor expanded in a around 0
Applied rewrites53.8%
Final simplification56.2%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (- (pow b 2.0) (pow a 2.0)) -1e-266)
(* (* (* -0.011111111111111112 a) angle_m) (* (PI) a))
(* (* (* (* (PI) b) b) angle_m) 0.011111111111111112))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq -1 \cdot 10^{-266}:\\
\;\;\;\;\left(\left(-0.011111111111111112 \cdot a\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot b\right) \cdot angle\_m\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -9.9999999999999998e-267Initial program 51.4%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6450.9
Applied rewrites50.9%
Taylor expanded in b around 0
Applied rewrites50.9%
Applied rewrites59.6%
Applied rewrites59.6%
if -9.9999999999999998e-267 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) Initial program 52.3%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6448.6
Applied rewrites48.6%
Taylor expanded in b around 0
Applied rewrites21.8%
Applied rewrites20.0%
Taylor expanded in b around inf
Applied rewrites48.6%
Final simplification53.6%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (- (pow b 2.0) (pow a 2.0)) -1e-266)
(* (* (* -0.011111111111111112 a) angle_m) (* (PI) a))
(* (* (* (* b b) (PI)) angle_m) 0.011111111111111112))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq -1 \cdot 10^{-266}:\\
\;\;\;\;\left(\left(-0.011111111111111112 \cdot a\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(b \cdot b\right) \cdot \mathsf{PI}\left(\right)\right) \cdot angle\_m\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -9.9999999999999998e-267Initial program 51.4%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6450.9
Applied rewrites50.9%
Taylor expanded in b around 0
Applied rewrites50.9%
Applied rewrites59.6%
Applied rewrites59.6%
if -9.9999999999999998e-267 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) Initial program 52.3%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6448.6
Applied rewrites48.6%
Taylor expanded in b around inf
Applied rewrites48.6%
Final simplification53.6%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (pow a 2.0) 5e-242)
(* (* b b) (sin (* 0.011111111111111112 (* (PI) angle_m))))
(* (* (* (* 0.011111111111111112 (PI)) angle_m) (- b a)) (+ a b)))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 5 \cdot 10^{-242}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(0.011111111111111112 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\_m\right) \cdot \left(b - a\right)\right) \cdot \left(a + b\right)\\
\end{array}
\end{array}
if (pow.f64 a #s(literal 2 binary64)) < 4.9999999999999998e-242Initial program 62.4%
Applied rewrites13.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6461.3
Applied rewrites61.3%
if 4.9999999999999998e-242 < (pow.f64 a #s(literal 2 binary64)) Initial program 47.5%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6450.5
Applied rewrites50.5%
Applied rewrites60.7%
Final simplification60.9%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-47)
(* (* (* (* 0.011111111111111112 (PI)) angle_m) (- b a)) (+ a b))
(* (sin (* 0.011111111111111112 (* (PI) angle_m))) (* (- b a) (+ a b))))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-47}:\\
\;\;\;\;\left(\left(\left(0.011111111111111112 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\_m\right) \cdot \left(b - a\right)\right) \cdot \left(a + b\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right) \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 9.9999999999999997e-48Initial program 56.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6457.6
Applied rewrites57.6%
Applied rewrites68.3%
if 9.9999999999999997e-48 < (/.f64 angle #s(literal 180 binary64)) Initial program 41.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites48.6%
Final simplification62.0%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (* (sin (* 0.011111111111111112 (* (PI) angle_m))) (- b a)) (+ a b))))
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right) \cdot \left(b - a\right)\right) \cdot \left(a + b\right)\right)
\end{array}
Initial program 51.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites66.7%
Final simplification66.7%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (* (sin (* (* 0.011111111111111112 angle_m) (PI))) (- b a)) (+ a b))))
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(\sin \left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b - a\right)\right) \cdot \left(a + b\right)\right)
\end{array}
Initial program 51.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6465.8
Applied rewrites65.8%
Final simplification65.8%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (* 0.011111111111111112 (PI)) angle_m)))
(*
angle_s
(if (<= (/ angle_m 180.0) 23000000000000.0)
(* (* t_0 (- b a)) (+ a b))
(* (* (- a) (+ a b)) t_0)))))\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(0.011111111111111112 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\_m\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 23000000000000:\\
\;\;\;\;\left(t\_0 \cdot \left(b - a\right)\right) \cdot \left(a + b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-a\right) \cdot \left(a + b\right)\right) \cdot t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 2.3e13Initial program 58.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6458.3
Applied rewrites58.3%
Applied rewrites68.4%
if 2.3e13 < (/.f64 angle #s(literal 180 binary64)) Initial program 34.4%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6427.1
Applied rewrites27.1%
Taylor expanded in b around 0
Applied rewrites25.3%
Final simplification56.4%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (* (* -0.011111111111111112 a) angle_m) (* (PI) a))))
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(\left(-0.011111111111111112 \cdot a\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\right)
\end{array}
Initial program 51.9%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6449.7
Applied rewrites49.7%
Taylor expanded in b around 0
Applied rewrites34.9%
Applied rewrites37.8%
Applied rewrites37.8%
Final simplification37.8%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (* (* (PI) angle_m) a) (* -0.011111111111111112 a))))
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot a\right) \cdot \left(-0.011111111111111112 \cdot a\right)\right)
\end{array}
Initial program 51.9%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6449.7
Applied rewrites49.7%
Taylor expanded in b around 0
Applied rewrites34.9%
Applied rewrites37.8%
Final simplification37.8%
herbie shell --seed 2024276
(FPCore (a b angle)
:name "ab-angle->ABCF B"
:precision binary64
(* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (PI) (/ angle 180.0)))) (cos (* (PI) (/ angle 180.0)))))