
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) (PI)))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_1) x-scale)
y-scale))
(t_4
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale))
(t_5
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale)))
(*
180.0
(/
(atan
(/ (- (- t_4 t_5) (sqrt (+ (pow (- t_5 t_4) 2.0) (pow t_3 2.0)))) t_3))
(PI)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\
180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) (PI)))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_1) x-scale)
y-scale))
(t_4
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale))
(t_5
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale)))
(*
180.0
(/
(atan
(/ (- (- t_4 t_5) (sqrt (+ (pow (- t_5 t_4) 2.0) (pow t_3 2.0)))) t_3))
(PI)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\
180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (cbrt (pow (PI) 1.5)))
(t_1 (* (* 0.005555555555555556 angle) (PI)))
(t_2 (* (* (PI) angle) 0.005555555555555556))
(t_3 (sin t_2))
(t_4 (sqrt (PI)))
(t_5 (cos t_2)))
(if (<= a_m 1.1e+34)
(*
180.0
(/
(atan
(*
(*
(pow (cos (* (* 0.005555555555555556 angle) (* t_4 t_4))) 2.0)
(/ (* -2.0 y-scale) x-scale))
(/ 0.5 (* (sin t_1) (cos t_1)))))
(PI)))
(if (<= a_m 2.2e+88)
(*
180.0
(/
(atan
(*
(/
(*
(* 2.0 (fma (* a_m a_m) (pow t_3 2.0) (* (pow t_5 2.0) (* b b))))
y-scale)
(* (* x-scale t_5) (* (* (+ b a_m) (- b a_m)) t_3)))
-0.5))
(PI)))
(*
180.0
(/
(atan
(*
(/
(/
(*
(* -2.0 y-scale)
(pow (cos (* 0.005555555555555556 (* angle (* t_0 t_0)))) 2.0))
x-scale)
(*
t_5
(sin (* (* (cbrt (pow (PI) 3.0)) angle) 0.005555555555555556))))
0.5))
(PI)))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{{\mathsf{PI}\left(\right)}^{1.5}}\\
t_1 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
t_2 := \left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\\
t_3 := \sin t\_2\\
t_4 := \sqrt{\mathsf{PI}\left(\right)}\\
t_5 := \cos t\_2\\
\mathbf{if}\;a\_m \leq 1.1 \cdot 10^{+34}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left({\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \left(t\_4 \cdot t\_4\right)\right)}^{2} \cdot \frac{-2 \cdot y-scale}{x-scale}\right) \cdot \frac{0.5}{\sin t\_1 \cdot \cos t\_1}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 2.2 \cdot 10^{+88}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(2 \cdot \mathsf{fma}\left(a\_m \cdot a\_m, {t\_3}^{2}, {t\_5}^{2} \cdot \left(b \cdot b\right)\right)\right) \cdot y-scale}{\left(x-scale \cdot t\_5\right) \cdot \left(\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot t\_3\right)} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\frac{\left(-2 \cdot y-scale\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}^{2}}{x-scale}}{t\_5 \cdot \sin \left(\left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right) \cdot 0.005555555555555556\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 1.1000000000000001e34Initial program 12.5%
Taylor expanded in b around inf
Applied rewrites25.7%
Taylor expanded in x-scale around 0
Applied rewrites47.7%
Applied rewrites50.8%
Applied rewrites50.8%
if 1.1000000000000001e34 < a < 2.20000000000000009e88Initial program 9.3%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites44.9%
if 2.20000000000000009e88 < a Initial program 0.1%
Taylor expanded in b around inf
Applied rewrites16.5%
Taylor expanded in x-scale around 0
Applied rewrites38.5%
Applied rewrites45.7%
Applied rewrites46.0%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* 0.005555555555555556 angle) (PI)))
(t_1 (* (* (PI) angle) 0.005555555555555556))
(t_2 (sin t_1))
(t_3 (sqrt (PI)))
(t_4 (cos t_1)))
(if (<= a_m 1.1e+34)
(*
180.0
(/
(atan
(*
(*
(pow (cos (* (* 0.005555555555555556 angle) (* t_3 t_3))) 2.0)
(/ (* -2.0 y-scale) x-scale))
(/ 0.5 (* (sin t_0) (cos t_0)))))
(PI)))
(if (<= a_m 2.2e+88)
(*
180.0
(/
(atan
(*
(/
(*
(* 2.0 (fma (* a_m a_m) (pow t_2 2.0) (* (pow t_4 2.0) (* b b))))
y-scale)
(* (* x-scale t_4) (* (* (+ b a_m) (- b a_m)) t_2)))
-0.5))
(PI)))
(*
180.0
(/
(atan
(*
(/
(/
(*
(* -2.0 y-scale)
(pow (cos (* 0.005555555555555556 (* angle (PI)))) 2.0))
x-scale)
(*
t_4
(sin (* (* (cbrt (pow (PI) 3.0)) angle) 0.005555555555555556))))
0.5))
(PI)))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
t_1 := \left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\\
t_2 := \sin t\_1\\
t_3 := \sqrt{\mathsf{PI}\left(\right)}\\
t_4 := \cos t\_1\\
\mathbf{if}\;a\_m \leq 1.1 \cdot 10^{+34}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left({\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \left(t\_3 \cdot t\_3\right)\right)}^{2} \cdot \frac{-2 \cdot y-scale}{x-scale}\right) \cdot \frac{0.5}{\sin t\_0 \cdot \cos t\_0}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 2.2 \cdot 10^{+88}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(2 \cdot \mathsf{fma}\left(a\_m \cdot a\_m, {t\_2}^{2}, {t\_4}^{2} \cdot \left(b \cdot b\right)\right)\right) \cdot y-scale}{\left(x-scale \cdot t\_4\right) \cdot \left(\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot t\_2\right)} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\frac{\left(-2 \cdot y-scale\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{t\_4 \cdot \sin \left(\left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right) \cdot 0.005555555555555556\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 1.1000000000000001e34Initial program 12.5%
Taylor expanded in b around inf
Applied rewrites25.7%
Taylor expanded in x-scale around 0
Applied rewrites47.7%
Applied rewrites50.8%
Applied rewrites50.8%
if 1.1000000000000001e34 < a < 2.20000000000000009e88Initial program 9.3%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites44.9%
if 2.20000000000000009e88 < a Initial program 0.1%
Taylor expanded in b around inf
Applied rewrites16.5%
Taylor expanded in x-scale around 0
Applied rewrites38.5%
Applied rewrites45.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* angle (PI)))
(t_1 (sqrt (PI)))
(t_2 (* (* 0.005555555555555556 angle) (PI)))
(t_3 (* 0.005555555555555556 t_0))
(t_4 (pow (cos t_3) 2.0)))
(if (<= a_m 4.8e+33)
(*
180.0
(/
(atan
(*
(*
(pow (cos (* (* 0.005555555555555556 angle) (* t_1 t_1))) 2.0)
(/ (* -2.0 y-scale) x-scale))
(/ 0.5 (* (sin t_2) (cos t_2)))))
(PI)))
(if (<= a_m 2.2e+88)
(*
180.0
(/
(atan
(*
(/
(* (- 2.0) (fma (* a_m a_m) (pow (sin t_3) 2.0) (* (* b b) t_4)))
(*
(* x-scale (sin (* 0.011111111111111112 t_0)))
(* (+ a_m b) (- b a_m))))
y-scale))
(PI)))
(*
180.0
(/
(atan
(*
(/
(/ (* (* -2.0 y-scale) t_4) x-scale)
(*
(cos (* (* (PI) angle) 0.005555555555555556))
(sin (* (* (cbrt (pow (PI) 3.0)) angle) 0.005555555555555556))))
0.5))
(PI)))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := \sqrt{\mathsf{PI}\left(\right)}\\
t_2 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
t_3 := 0.005555555555555556 \cdot t\_0\\
t_4 := {\cos t\_3}^{2}\\
\mathbf{if}\;a\_m \leq 4.8 \cdot 10^{+33}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left({\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \left(t\_1 \cdot t\_1\right)\right)}^{2} \cdot \frac{-2 \cdot y-scale}{x-scale}\right) \cdot \frac{0.5}{\sin t\_2 \cdot \cos t\_2}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 2.2 \cdot 10^{+88}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(-2\right) \cdot \mathsf{fma}\left(a\_m \cdot a\_m, {\sin t\_3}^{2}, \left(b \cdot b\right) \cdot t\_4\right)}{\left(x-scale \cdot \sin \left(0.011111111111111112 \cdot t\_0\right)\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)} \cdot y-scale\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\frac{\left(-2 \cdot y-scale\right) \cdot t\_4}{x-scale}}{\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \sin \left(\left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right) \cdot 0.005555555555555556\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 4.8e33Initial program 12.6%
Taylor expanded in b around inf
Applied rewrites25.8%
Taylor expanded in x-scale around 0
Applied rewrites48.0%
Applied rewrites51.1%
Applied rewrites51.1%
if 4.8e33 < a < 2.20000000000000009e88Initial program 8.7%
Applied rewrites8.9%
Taylor expanded in x-scale around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites34.7%
if 2.20000000000000009e88 < a Initial program 0.1%
Taylor expanded in b around inf
Applied rewrites16.5%
Taylor expanded in x-scale around 0
Applied rewrites38.5%
Applied rewrites45.7%
Final simplification49.1%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* 0.005555555555555556 angle) (PI))))
(*
180.0
(/
(atan
(*
(*
(pow
(cos (* (* 0.005555555555555556 angle) (cbrt (pow (PI) 3.0))))
2.0)
(/ (* -2.0 y-scale) x-scale))
(/ 0.5 (* (sin t_0) (cos t_0)))))
(PI)))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
180 \cdot \frac{\tan^{-1} \left(\left({\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \sqrt[3]{{\mathsf{PI}\left(\right)}^{3}}\right)}^{2} \cdot \frac{-2 \cdot y-scale}{x-scale}\right) \cdot \frac{0.5}{\sin t\_0 \cdot \cos t\_0}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
Applied rewrites46.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (sqrt (PI))) (t_1 (* (* 0.005555555555555556 angle) (PI))))
(*
180.0
(/
(atan
(*
(*
(pow (cos (* (* 0.005555555555555556 angle) (* t_0 t_0))) 2.0)
(/ (* -2.0 y-scale) x-scale))
(/ 0.5 (* (sin t_1) (cos t_1)))))
(PI)))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
t_1 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
180 \cdot \frac{\tan^{-1} \left(\left({\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}^{2} \cdot \frac{-2 \cdot y-scale}{x-scale}\right) \cdot \frac{0.5}{\sin t\_1 \cdot \cos t\_1}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
Applied rewrites46.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* 0.005555555555555556 angle) (PI))) (t_1 (cos t_0)))
(*
180.0
(/
(atan
(*
(* (pow t_1 2.0) (/ (* -2.0 y-scale) x-scale))
(/ 0.5 (* (sin t_0) t_1))))
(PI)))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\\
t_1 := \cos t\_0\\
180 \cdot \frac{\tan^{-1} \left(\left({t\_1}^{2} \cdot \frac{-2 \cdot y-scale}{x-scale}\right) \cdot \frac{0.5}{\sin t\_0 \cdot t\_1}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(*
180.0
(/
(atan
(/
(*
0.5
(*
(/ (* -2.0 y-scale) x-scale)
(pow (cos (* (* 0.005555555555555556 angle) (PI))) 2.0)))
(* (sin (* (* angle (PI)) 0.011111111111111112)) 0.5)))
(PI))))\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\frac{0.5 \cdot \left(\frac{-2 \cdot y-scale}{x-scale} \cdot {\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)}^{2}\right)}{\sin \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.011111111111111112\right) \cdot 0.5}\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
Applied rewrites43.8%
Final simplification43.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(*
180.0
(/
(atan
(*
(* (/ 0.5 (sin (* (* angle (PI)) 0.011111111111111112))) 2.0)
(*
(/ (* -2.0 y-scale) x-scale)
(pow (cos (* (* 0.005555555555555556 angle) (PI))) 2.0))))
(PI))))\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\left(\frac{0.5}{\sin \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.011111111111111112\right)} \cdot 2\right) \cdot \left(\frac{-2 \cdot y-scale}{x-scale} \cdot {\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)}^{2}\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
Applied rewrites43.7%
Final simplification43.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* (PI) angle) 0.005555555555555556)))
(*
180.0
(/ (atan (* (/ (- y-scale) x-scale) (/ (cos t_0) (sin t_0)))) (PI)))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\\
180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{\cos t\_0}{\sin t\_0}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
Taylor expanded in x-scale around 0
Applied rewrites43.7%
Final simplification43.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (or (<= b 9.6e-39) (not (<= b 2.9e+122)))
(* 180.0 (/ (atan (* -180.0 (/ y-scale (* (* x-scale (PI)) angle)))) (PI)))
(*
180.0
(/
(atan
(*
(/
(* -2.0 (* (* b b) y-scale))
(* (* angle x-scale) (* (* (PI) (+ b a_m)) (- b a_m))))
90.0))
(PI)))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.6 \cdot 10^{-39} \lor \neg \left(b \leq 2.9 \cdot 10^{+122}\right):\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{\left(x-scale \cdot \mathsf{PI}\left(\right)\right) \cdot angle}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \left(\left(b \cdot b\right) \cdot y-scale\right)}{\left(angle \cdot x-scale\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \left(b + a\_m\right)\right) \cdot \left(b - a\_m\right)\right)} \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 9.60000000000000063e-39 or 2.9000000000000001e122 < b Initial program 7.7%
Taylor expanded in b around inf
Applied rewrites22.8%
Taylor expanded in x-scale around 0
Applied rewrites43.5%
Applied rewrites46.8%
Taylor expanded in angle around 0
Applied rewrites35.3%
if 9.60000000000000063e-39 < b < 2.9000000000000001e122Initial program 23.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.2%
Taylor expanded in a around inf
Applied rewrites12.1%
Taylor expanded in x-scale around 0
Applied rewrites54.7%
Final simplification37.8%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* -180.0 (/ y-scale (* (* x-scale (PI)) angle)))) (PI))))
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{\left(x-scale \cdot \mathsf{PI}\left(\right)\right) \cdot angle}\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 9.8%
Taylor expanded in b around inf
Applied rewrites23.0%
Taylor expanded in x-scale around 0
Applied rewrites43.8%
Applied rewrites46.7%
Taylor expanded in angle around 0
Applied rewrites36.0%
herbie shell --seed 2024298
(FPCore (a b angle x-scale y-scale)
:name "raw-angle from scale-rotated-ellipse"
:precision binary64
(* 180.0 (/ (atan (/ (- (- (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (sin (* (/ angle 180.0) (PI)))) 2.0)) y-scale) y-scale) (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (/ angle 180.0) (PI)))) 2.0)) x-scale) x-scale)) (sqrt (+ (pow (- (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (/ angle 180.0) (PI)))) 2.0)) x-scale) x-scale) (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (sin (* (/ angle 180.0) (PI)))) 2.0)) y-scale) y-scale)) 2.0) (pow (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale) 2.0)))) (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale))) (PI))))