
(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 14 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}
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (PI) angle)) (t_1 (* t_0 0.005555555555555556)))
(if (<= b_m 4.1e+39)
(* (/ (atan (* (/ (sin t_1) (cos t_1)) (/ y-scale x-scale))) (PI)) 180.0)
(/
1.0
(/
(PI)
(*
(atan
(*
(/
(*
(/
(pow
(cos (* (* (cbrt (pow (PI) 3.0)) angle) 0.005555555555555556))
2.0)
x-scale)
(* -2.0 y-scale))
(* (sin (* 0.011111111111111112 t_0)) 0.5))
0.5))
180.0))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\\
t_1 := t\_0 \cdot 0.005555555555555556\\
\mathbf{if}\;b\_m \leq 4.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\sin t\_1}{\cos t\_1} \cdot \frac{y-scale}{x-scale}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{\frac{{\cos \left(\left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{x-scale} \cdot \left(-2 \cdot y-scale\right)}{\sin \left(0.011111111111111112 \cdot t\_0\right) \cdot 0.5} \cdot 0.5\right) \cdot 180}}\\
\end{array}
\end{array}
if b < 4.10000000000000004e39Initial program 15.2%
Taylor expanded in y-scale around inf
Applied rewrites18.4%
Applied rewrites18.4%
Taylor expanded in b around 0
Applied rewrites49.0%
if 4.10000000000000004e39 < b Initial program 11.3%
Taylor expanded in b around inf
Applied rewrites24.3%
Taylor expanded in x-scale around 0
Applied rewrites60.0%
Applied rewrites60.1%
Applied rewrites60.4%
Final simplification51.8%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* (PI) angle) 0.005555555555555556))
(t_1 (cos t_0))
(t_2 (sin t_0)))
(if (<= b_m 4.1e+39)
(* (/ (atan (* (/ t_2 t_1) (/ y-scale x-scale))) (PI)) 180.0)
(*
(/
(atan
(*
(/
(*
(/
(*
(pow
(cos (* (* (cbrt (pow (PI) 3.0)) angle) 0.005555555555555556))
2.0)
y-scale)
x-scale)
-2.0)
(* t_2 t_1))
0.5))
(PI))
180.0))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
\mathbf{if}\;b\_m \leq 4.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{t\_2}{t\_1} \cdot \frac{y-scale}{x-scale}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\frac{{\cos \left(\left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right) \cdot 0.005555555555555556\right)}^{2} \cdot y-scale}{x-scale} \cdot -2}{t\_2 \cdot t\_1} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if b < 4.10000000000000004e39Initial program 15.2%
Taylor expanded in y-scale around inf
Applied rewrites18.4%
Applied rewrites18.4%
Taylor expanded in b around 0
Applied rewrites49.0%
if 4.10000000000000004e39 < b Initial program 11.3%
Taylor expanded in b around inf
Applied rewrites24.3%
Taylor expanded in x-scale around 0
Applied rewrites60.0%
Applied rewrites60.3%
Final simplification51.8%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (PI) angle))
(t_1 (sqrt (PI)))
(t_2 (* t_0 0.005555555555555556)))
(if (<= b_m 4.1e+39)
(* (/ (atan (* (/ (sin t_2) (cos t_2)) (/ y-scale x-scale))) (PI)) 180.0)
(/
1.0
(/
(PI)
(*
(atan
(*
(/
(*
(/
(pow (cos (* (* (* t_1 t_1) angle) 0.005555555555555556)) 2.0)
x-scale)
(* -2.0 y-scale))
(* (sin (* 0.011111111111111112 t_0)) 0.5))
0.5))
180.0))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\\
t_1 := \sqrt{\mathsf{PI}\left(\right)}\\
t_2 := t\_0 \cdot 0.005555555555555556\\
\mathbf{if}\;b\_m \leq 4.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\sin t\_2}{\cos t\_2} \cdot \frac{y-scale}{x-scale}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{\frac{{\cos \left(\left(\left(t\_1 \cdot t\_1\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{x-scale} \cdot \left(-2 \cdot y-scale\right)}{\sin \left(0.011111111111111112 \cdot t\_0\right) \cdot 0.5} \cdot 0.5\right) \cdot 180}}\\
\end{array}
\end{array}
if b < 4.10000000000000004e39Initial program 15.2%
Taylor expanded in y-scale around inf
Applied rewrites18.4%
Applied rewrites18.4%
Taylor expanded in b around 0
Applied rewrites49.0%
if 4.10000000000000004e39 < b Initial program 11.3%
Taylor expanded in b around inf
Applied rewrites24.3%
Taylor expanded in x-scale around 0
Applied rewrites60.0%
Applied rewrites60.1%
Applied rewrites60.1%
Final simplification51.7%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (PI) angle))
(t_1 (* t_0 0.005555555555555556))
(t_2 (cos t_1)))
(if (<= b_m 4.1e+39)
(* (/ (atan (* (/ (sin t_1) t_2) (/ y-scale x-scale))) (PI)) 180.0)
(/
1.0
(/
(PI)
(*
(atan
(*
(*
(/ (pow t_2 2.0) (sin (* 0.011111111111111112 t_0)))
(/ y-scale x-scale))
-2.0))
180.0))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\\
t_1 := t\_0 \cdot 0.005555555555555556\\
t_2 := \cos t\_1\\
\mathbf{if}\;b\_m \leq 4.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\sin t\_1}{t\_2} \cdot \frac{y-scale}{x-scale}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\left(\frac{{t\_2}^{2}}{\sin \left(0.011111111111111112 \cdot t\_0\right)} \cdot \frac{y-scale}{x-scale}\right) \cdot -2\right) \cdot 180}}\\
\end{array}
\end{array}
if b < 4.10000000000000004e39Initial program 15.2%
Taylor expanded in y-scale around inf
Applied rewrites18.4%
Applied rewrites18.4%
Taylor expanded in b around 0
Applied rewrites49.0%
if 4.10000000000000004e39 < b Initial program 11.3%
Taylor expanded in b around inf
Applied rewrites24.3%
Taylor expanded in x-scale around 0
Applied rewrites60.0%
Applied rewrites60.1%
Taylor expanded in x-scale around 0
Applied rewrites60.1%
Final simplification51.8%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* (PI) angle) 0.005555555555555556))
(t_1 (cos t_0))
(t_2 (sin t_0)))
(if (<= b_m 4.1e+39)
(* (/ (atan (* (/ t_2 t_1) (/ y-scale x-scale))) (PI)) 180.0)
(*
(/ (atan (* (* (* (/ t_1 t_2) (/ y-scale x-scale)) 2.0) -0.5)) (PI))
180.0))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
\mathbf{if}\;b\_m \leq 4.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{t\_2}{t\_1} \cdot \frac{y-scale}{x-scale}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\left(\frac{t\_1}{t\_2} \cdot \frac{y-scale}{x-scale}\right) \cdot 2\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if b < 4.10000000000000004e39Initial program 15.2%
Taylor expanded in y-scale around inf
Applied rewrites18.4%
Applied rewrites18.4%
Taylor expanded in b around 0
Applied rewrites49.0%
if 4.10000000000000004e39 < b Initial program 11.3%
Taylor expanded in y-scale around inf
Applied rewrites18.0%
Taylor expanded in b around inf
Applied rewrites60.0%
Final simplification51.7%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (PI) angle)) (t_1 (* t_0 0.005555555555555556)))
(if (<= b_m 4.1e+39)
(* (/ (atan (* (/ (sin t_1) (cos t_1)) (/ y-scale x-scale))) (PI)) 180.0)
(/
1.0
(/
(PI)
(*
(atan
(*
(/
(* -2.0 (/ y-scale x-scale))
(* (sin (* 0.011111111111111112 t_0)) 0.5))
0.5))
180.0))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot angle\\
t_1 := t\_0 \cdot 0.005555555555555556\\
\mathbf{if}\;b\_m \leq 4.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\sin t\_1}{\cos t\_1} \cdot \frac{y-scale}{x-scale}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale}{x-scale}}{\sin \left(0.011111111111111112 \cdot t\_0\right) \cdot 0.5} \cdot 0.5\right) \cdot 180}}\\
\end{array}
\end{array}
if b < 4.10000000000000004e39Initial program 15.2%
Taylor expanded in y-scale around inf
Applied rewrites18.4%
Applied rewrites18.4%
Taylor expanded in b around 0
Applied rewrites49.0%
if 4.10000000000000004e39 < b Initial program 11.3%
Taylor expanded in b around inf
Applied rewrites24.3%
Taylor expanded in angle around 0
Applied rewrites58.9%
Applied rewrites59.0%
Final simplification51.5%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(/
1.0
(/
(PI)
(*
(atan
(*
(/
(* -2.0 (/ y-scale x-scale))
(* (sin (* 0.011111111111111112 (* (PI) angle))) 0.5))
0.5))
180.0))))\begin{array}{l}
b_m = \left|b\right|
\\
\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale}{x-scale}}{\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right) \cdot 0.5} \cdot 0.5\right) \cdot 180}}
\end{array}
Initial program 14.3%
Taylor expanded in b around inf
Applied rewrites26.8%
Taylor expanded in angle around 0
Applied rewrites46.6%
Applied rewrites46.6%
Final simplification46.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= a 1.7e-217)
(*
(/ (atan (* 90.0 (* (/ y-scale (* (* (PI) x-scale) angle)) -2.0))) (PI))
180.0)
(*
(/
(atan
(*
(/
(* -2.0 (/ y-scale x-scale))
(* 1.0 (sin (* (* (PI) angle) 0.005555555555555556))))
0.5))
(PI))
180.0)))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.7 \cdot 10^{-217}:\\
\;\;\;\;\frac{\tan^{-1} \left(90 \cdot \left(\frac{y-scale}{\left(\mathsf{PI}\left(\right) \cdot x-scale\right) \cdot angle} \cdot -2\right)\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale}{x-scale}}{1 \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if a < 1.70000000000000008e-217Initial program 12.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites7.6%
Taylor expanded in b around 0
Applied rewrites14.5%
Taylor expanded in b around inf
Applied rewrites40.9%
if 1.70000000000000008e-217 < a Initial program 16.5%
Taylor expanded in b around inf
Applied rewrites29.5%
Taylor expanded in angle around 0
Applied rewrites46.3%
Taylor expanded in angle around 0
Applied rewrites42.9%
Final simplification41.8%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(/
180.0
(/
(PI)
(atan
(*
(/
(* -2.0 (/ y-scale x-scale))
(* (sin (* 0.011111111111111112 (* (PI) angle))) 0.5))
0.5)))))\begin{array}{l}
b_m = \left|b\right|
\\
\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale}{x-scale}}{\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right) \cdot 0.5} \cdot 0.5\right)}}
\end{array}
Initial program 14.3%
Taylor expanded in b around inf
Applied rewrites26.8%
Taylor expanded in angle around 0
Applied rewrites46.6%
Applied rewrites46.6%
Final simplification46.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(*
(/
(atan
(*
(/
(* -2.0 (/ y-scale x-scale))
(* (sin (* 0.011111111111111112 (* (PI) angle))) 0.5))
0.5))
(PI))
180.0))\begin{array}{l}
b_m = \left|b\right|
\\
\frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale}{x-scale}}{\sin \left(0.011111111111111112 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right) \cdot 0.5} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180
\end{array}
Initial program 14.3%
Taylor expanded in b around inf
Applied rewrites26.8%
Taylor expanded in angle around 0
Applied rewrites46.6%
Applied rewrites46.6%
Final simplification46.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 5.6e+82)
(*
(/
(atan
(*
(/
(* (* (* b_m b_m) y-scale) -2.0)
(* (* (* (+ a b_m) (PI)) (- b_m a)) (* x-scale angle)))
90.0))
(PI))
180.0)
(/
1.0
(/
(PI)
(* (atan (* -180.0 (/ y-scale (* (* (PI) x-scale) angle)))) 180.0)))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 5.6 \cdot 10^{+82}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(\left(b\_m \cdot b\_m\right) \cdot y-scale\right) \cdot -2}{\left(\left(\left(a + b\_m\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b\_m - a\right)\right) \cdot \left(x-scale \cdot angle\right)} \cdot 90\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(-180 \cdot \frac{y-scale}{\left(\mathsf{PI}\left(\right) \cdot x-scale\right) \cdot angle}\right) \cdot 180}}\\
\end{array}
\end{array}
if b < 5.6000000000000001e82Initial program 16.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites9.4%
Taylor expanded in b around 0
Applied rewrites11.8%
Taylor expanded in x-scale around 0
Applied rewrites26.9%
if 5.6000000000000001e82 < b Initial program 6.2%
Taylor expanded in b around inf
Applied rewrites26.3%
Taylor expanded in x-scale around 0
Applied rewrites57.3%
Applied rewrites57.4%
Taylor expanded in angle around 0
Applied rewrites50.7%
Final simplification31.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 5.6e+82)
(*
(/
(atan
(/
(* -180.0 (* (* b_m b_m) y-scale))
(* (* (* (+ a b_m) (PI)) (- b_m a)) (* x-scale angle))))
(PI))
180.0)
(/
1.0
(/
(PI)
(* (atan (* -180.0 (/ y-scale (* (* (PI) x-scale) angle)))) 180.0)))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 5.6 \cdot 10^{+82}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-180 \cdot \left(\left(b\_m \cdot b\_m\right) \cdot y-scale\right)}{\left(\left(\left(a + b\_m\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b\_m - a\right)\right) \cdot \left(x-scale \cdot angle\right)}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(-180 \cdot \frac{y-scale}{\left(\mathsf{PI}\left(\right) \cdot x-scale\right) \cdot angle}\right) \cdot 180}}\\
\end{array}
\end{array}
if b < 5.6000000000000001e82Initial program 16.3%
Taylor expanded in y-scale around inf
Applied rewrites19.8%
Applied rewrites19.8%
Taylor expanded in angle around 0
Applied rewrites26.9%
if 5.6000000000000001e82 < b Initial program 6.2%
Taylor expanded in b around inf
Applied rewrites26.3%
Taylor expanded in x-scale around 0
Applied rewrites57.3%
Applied rewrites57.4%
Taylor expanded in angle around 0
Applied rewrites50.7%
Final simplification31.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* (/ (atan (* 90.0 (* (/ y-scale (* (* (PI) x-scale) angle)) -2.0))) (PI)) 180.0))
\begin{array}{l}
b_m = \left|b\right|
\\
\frac{\tan^{-1} \left(90 \cdot \left(\frac{y-scale}{\left(\mathsf{PI}\left(\right) \cdot x-scale\right) \cdot angle} \cdot -2\right)\right)}{\mathsf{PI}\left(\right)} \cdot 180
\end{array}
Initial program 14.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites8.8%
Taylor expanded in b around 0
Applied rewrites14.0%
Taylor expanded in b around inf
Applied rewrites36.7%
Final simplification36.7%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* (/ (atan (* (* (/ x-scale (* (* (PI) y-scale) angle)) -2.0) 90.0)) (PI)) 180.0))
\begin{array}{l}
b_m = \left|b\right|
\\
\frac{\tan^{-1} \left(\left(\frac{x-scale}{\left(\mathsf{PI}\left(\right) \cdot y-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \cdot 180
\end{array}
Initial program 14.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites8.8%
Taylor expanded in b around 0
Applied rewrites14.0%
Taylor expanded in b around 0
Applied rewrites13.9%
Final simplification13.9%
herbie shell --seed 2024276
(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))))