
(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 (sin (* (PI) (* 0.005555555555555556 angle))))
(t_1 (* angle (PI)))
(t_2 (cos (* -0.005555555555555556 t_1)))
(t_3 (sin (* 0.005555555555555556 t_1))))
(if (<= a_m 7.8e-84)
(*
180.0
(/ (atan (* (* 2.0 (* (/ y-scale x-scale) (/ t_2 t_3))) -0.5)) (PI)))
(if (<= a_m 1.5e-14)
(*
180.0
(/ (atan (* (* -2.0 (* (/ y-scale x-scale) (/ t_3 t_2))) -0.5)) (PI)))
(if (<= a_m 7.2e+82)
(/
(*
(atan
(*
(*
-0.5
(*
(+ (pow (* t_0 a_m) 2.0) (pow (* 1.0 b) 2.0))
(/
2.0
(* (cos (* (* (PI) angle) -0.005555555555555556)) x-scale))))
(/ (/ y-scale (* t_0 (+ b a_m))) (- b a_m))))
180.0)
(PI))
(*
180.0
(/
(atan
(*
(*
-2.0
(/
(fma y-scale t_3 (/ (* y-scale (* t_3 (* 0.0 b))) a_m))
(* x-scale 1.0)))
-0.5))
(PI))))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right)\\
t_1 := angle \cdot \mathsf{PI}\left(\right)\\
t_2 := \cos \left(-0.005555555555555556 \cdot t\_1\right)\\
t_3 := \sin \left(0.005555555555555556 \cdot t\_1\right)\\
\mathbf{if}\;a\_m \leq 7.8 \cdot 10^{-84}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_2}{t\_3}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 1.5 \cdot 10^{-14}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_3}{t\_2}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 7.2 \cdot 10^{+82}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(-0.5 \cdot \left(\left({\left(t\_0 \cdot a\_m\right)}^{2} + {\left(1 \cdot b\right)}^{2}\right) \cdot \frac{2}{\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot -0.005555555555555556\right) \cdot x-scale}\right)\right) \cdot \frac{\frac{y-scale}{t\_0 \cdot \left(b + a\_m\right)}}{b - a\_m}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\mathsf{fma}\left(y-scale, t\_3, \frac{y-scale \cdot \left(t\_3 \cdot \left(0 \cdot b\right)\right)}{a\_m}\right)}{x-scale \cdot 1}\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 7.80000000000000045e-84Initial program 17.0%
Taylor expanded in x-scale around 0
Applied rewrites31.9%
Taylor expanded in a around 0
Applied rewrites52.1%
if 7.80000000000000045e-84 < a < 1.4999999999999999e-14Initial program 11.9%
Taylor expanded in x-scale around 0
Applied rewrites40.6%
Taylor expanded in a around inf
Applied rewrites52.6%
if 1.4999999999999999e-14 < a < 7.20000000000000028e82Initial program 26.2%
Taylor expanded in x-scale around 0
Applied rewrites51.4%
Taylor expanded in angle around 0
Applied rewrites51.4%
Applied rewrites76.6%
if 7.20000000000000028e82 < a Initial program 0.1%
Taylor expanded in x-scale around 0
Applied rewrites23.2%
Taylor expanded in a around inf
Applied rewrites65.2%
Taylor expanded in angle around 0
Applied rewrites73.1%
Final simplification57.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (sin (* (PI) (* 0.005555555555555556 angle))))
(t_1 (* angle (PI)))
(t_2 (cos (* -0.005555555555555556 t_1)))
(t_3 (sin (* 0.005555555555555556 t_1))))
(if (<= a_m 7.8e-84)
(*
180.0
(/ (atan (* (* 2.0 (* (/ y-scale x-scale) (/ t_2 t_3))) -0.5)) (PI)))
(if (<= a_m 1.62e+28)
(*
180.0
(/ (atan (* (* -2.0 (* (/ y-scale x-scale) (/ t_3 t_2))) -0.5)) (PI)))
(if (<= a_m 1.4e+131)
(*
180.0
(/
(atan
(*
(/
(* (* y-scale 2.0) (+ (pow (* t_0 a_m) 2.0) (pow (* 1.0 b) 2.0)))
(*
(*
(* (cos (* (* (PI) angle) -0.005555555555555556)) x-scale)
(* t_0 (+ b a_m)))
(- b a_m)))
-0.5))
(PI)))
(*
180.0
(/
(atan
(*
(*
-2.0
(/
(fma y-scale t_3 (/ (* y-scale (* t_3 (* 0.0 b))) a_m))
(* x-scale 1.0)))
-0.5))
(PI))))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right)\\
t_1 := angle \cdot \mathsf{PI}\left(\right)\\
t_2 := \cos \left(-0.005555555555555556 \cdot t\_1\right)\\
t_3 := \sin \left(0.005555555555555556 \cdot t\_1\right)\\
\mathbf{if}\;a\_m \leq 7.8 \cdot 10^{-84}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_2}{t\_3}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 1.62 \cdot 10^{+28}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_3}{t\_2}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 1.4 \cdot 10^{+131}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(y-scale \cdot 2\right) \cdot \left({\left(t\_0 \cdot a\_m\right)}^{2} + {\left(1 \cdot b\right)}^{2}\right)}{\left(\left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot -0.005555555555555556\right) \cdot x-scale\right) \cdot \left(t\_0 \cdot \left(b + a\_m\right)\right)\right) \cdot \left(b - a\_m\right)} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\mathsf{fma}\left(y-scale, t\_3, \frac{y-scale \cdot \left(t\_3 \cdot \left(0 \cdot b\right)\right)}{a\_m}\right)}{x-scale \cdot 1}\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 7.80000000000000045e-84Initial program 17.0%
Taylor expanded in x-scale around 0
Applied rewrites31.9%
Taylor expanded in a around 0
Applied rewrites52.1%
if 7.80000000000000045e-84 < a < 1.62000000000000006e28Initial program 15.8%
Taylor expanded in x-scale around 0
Applied rewrites50.2%
Taylor expanded in a around inf
Applied rewrites54.4%
if 1.62000000000000006e28 < a < 1.4e131Initial program 12.0%
Taylor expanded in x-scale around 0
Applied rewrites48.4%
Taylor expanded in angle around 0
Applied rewrites47.4%
Applied rewrites75.1%
if 1.4e131 < a Initial program 0.1%
Taylor expanded in x-scale around 0
Applied rewrites6.9%
Taylor expanded in a around inf
Applied rewrites64.1%
Taylor expanded in angle around 0
Applied rewrites75.3%
Final simplification57.5%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* angle (PI)))
(t_1 (cos (* -0.005555555555555556 t_0)))
(t_2 (sin (* 0.005555555555555556 t_0))))
(if (<= a_m 7.8e-84)
(*
180.0
(/ (atan (* (* 2.0 (* (/ y-scale x-scale) (/ t_1 t_2))) -0.5)) (PI)))
(if (<= a_m 29000000000000.0)
(*
180.0
(/ (atan (* (* -2.0 (* (/ y-scale x-scale) (/ t_2 t_1))) -0.5)) (PI)))
(*
180.0
(/
(atan
(*
(*
-2.0
(/
(fma y-scale t_2 (/ (* y-scale (* t_2 (* 0.0 b))) a_m))
(* x-scale 1.0)))
-0.5))
(PI)))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := \cos \left(-0.005555555555555556 \cdot t\_0\right)\\
t_2 := \sin \left(0.005555555555555556 \cdot t\_0\right)\\
\mathbf{if}\;a\_m \leq 7.8 \cdot 10^{-84}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{t\_2}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;a\_m \leq 29000000000000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_2}{t\_1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\mathsf{fma}\left(y-scale, t\_2, \frac{y-scale \cdot \left(t\_2 \cdot \left(0 \cdot b\right)\right)}{a\_m}\right)}{x-scale \cdot 1}\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 7.80000000000000045e-84Initial program 17.0%
Taylor expanded in x-scale around 0
Applied rewrites31.9%
Taylor expanded in a around 0
Applied rewrites52.1%
if 7.80000000000000045e-84 < a < 2.9e13Initial program 16.4%
Taylor expanded in x-scale around 0
Applied rewrites48.3%
Taylor expanded in a around inf
Applied rewrites52.7%
if 2.9e13 < a Initial program 5.5%
Taylor expanded in x-scale around 0
Applied rewrites27.1%
Taylor expanded in a around inf
Applied rewrites58.9%
Taylor expanded in angle around 0
Applied rewrites67.1%
Final simplification55.6%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* angle (PI)))
(t_1 (sin (* 0.005555555555555556 t_0)))
(t_2 (cos (* -0.005555555555555556 t_0))))
(if (<= b 1.6e-63)
(*
180.0
(/ (atan (* (* -2.0 (* (/ y-scale x-scale) (/ t_1 t_2))) -0.5)) (PI)))
(*
180.0
(/ (atan (* (* 2.0 (* (/ y-scale x-scale) (/ t_2 t_1))) -0.5)) (PI))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot t\_0\right)\\
t_2 := \cos \left(-0.005555555555555556 \cdot t\_0\right)\\
\mathbf{if}\;b \leq 1.6 \cdot 10^{-63}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{t\_2}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_2}{t\_1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 1.59999999999999994e-63Initial program 13.9%
Taylor expanded in x-scale around 0
Applied rewrites33.7%
Taylor expanded in a around inf
Applied rewrites46.4%
if 1.59999999999999994e-63 < b Initial program 15.3%
Taylor expanded in x-scale around 0
Applied rewrites29.3%
Taylor expanded in a around 0
Applied rewrites57.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* angle (PI))))
(if (<= a_m 3.9e-83)
(*
180.0
(/ (atan (* (* -2.0 (/ (/ y-scale (* (PI) x-scale)) angle)) 90.0)) (PI)))
(*
180.0
(/
(atan
(*
(*
-2.0
(*
(/ y-scale x-scale)
(/
(sin (* 0.005555555555555556 t_0))
(cos (* -0.005555555555555556 t_0)))))
-0.5))
(PI))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;a\_m \leq 3.9 \cdot 10^{-83}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\frac{y-scale}{\mathsf{PI}\left(\right) \cdot x-scale}}{angle}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot t\_0\right)}{\cos \left(-0.005555555555555556 \cdot t\_0\right)}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 3.9e-83Initial program 17.0%
Taylor expanded in angle around 0
Applied rewrites15.4%
Taylor expanded in a around 0
Applied rewrites38.9%
Applied rewrites40.0%
if 3.9e-83 < a Initial program 8.9%
Taylor expanded in x-scale around 0
Applied rewrites33.7%
Taylor expanded in a around inf
Applied rewrites57.4%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* angle (PI))))
(if (<= a_m 3.9e-83)
(*
180.0
(/ (atan (* (* -2.0 (/ (/ y-scale (* (PI) x-scale)) angle)) 90.0)) (PI)))
(*
180.0
(/
(atan
(*
(*
-2.0
(/
(fma y-scale (sin (* 0.005555555555555556 t_0)) 0.0)
(* x-scale (cos (* -0.005555555555555556 t_0)))))
-0.5))
(PI))))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;a\_m \leq 3.9 \cdot 10^{-83}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\frac{y-scale}{\mathsf{PI}\left(\right) \cdot x-scale}}{angle}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\mathsf{fma}\left(y-scale, \sin \left(0.005555555555555556 \cdot t\_0\right), 0\right)}{x-scale \cdot \cos \left(-0.005555555555555556 \cdot t\_0\right)}\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 3.9e-83Initial program 17.0%
Taylor expanded in angle around 0
Applied rewrites15.4%
Taylor expanded in a around 0
Applied rewrites38.9%
Applied rewrites40.0%
if 3.9e-83 < a Initial program 8.9%
Taylor expanded in x-scale around 0
Applied rewrites33.7%
Taylor expanded in a around inf
Applied rewrites57.0%
Taylor expanded in a around 0
Applied rewrites57.0%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= b 1.5e-74)
(*
180.0
(/
(atan
(*
(*
y-scale
(/
(* -2.0 (/ (* b b) angle))
(* (* x-scale (PI)) (* (+ b a_m) (- b a_m)))))
90.0))
(PI)))
(*
180.0
(/ (atan (* (* -2.0 (/ (/ y-scale (* (PI) x-scale)) angle)) 90.0)) (PI)))))\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.5 \cdot 10^{-74}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(y-scale \cdot \frac{-2 \cdot \frac{b \cdot b}{angle}}{\left(x-scale \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\frac{y-scale}{\mathsf{PI}\left(\right) \cdot x-scale}}{angle}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 1.50000000000000003e-74Initial program 14.0%
Taylor expanded in angle around 0
Applied rewrites12.2%
Taylor expanded in y-scale around inf
Applied rewrites9.9%
Taylor expanded in x-scale around 0
Applied rewrites27.0%
if 1.50000000000000003e-74 < b Initial program 15.0%
Taylor expanded in angle around 0
Applied rewrites14.0%
Taylor expanded in a around 0
Applied rewrites41.9%
Applied rewrites46.8%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (* -2.0 (/ (/ y-scale (* (PI) x-scale)) angle)) 90.0)) (PI))))
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{\frac{y-scale}{\mathsf{PI}\left(\right) \cdot x-scale}}{angle}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 14.3%
Taylor expanded in angle around 0
Applied rewrites12.7%
Taylor expanded in a around 0
Applied rewrites35.7%
Applied rewrites37.5%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (* y-scale (/ -2.0 (* angle (* x-scale (PI))))) 90.0)) (PI))))
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\left(y-scale \cdot \frac{-2}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 14.3%
Taylor expanded in angle around 0
Applied rewrites12.7%
Taylor expanded in y-scale around inf
Applied rewrites10.4%
Taylor expanded in a around 0
Applied rewrites35.7%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (* -2.0 (/ y-scale (* angle (* x-scale (PI))))) 90.0)) (PI))))
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 14.3%
Taylor expanded in angle around 0
Applied rewrites12.7%
Taylor expanded in a around 0
Applied rewrites35.7%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (* -2.0 (/ x-scale (* angle (* y-scale (PI))))) 90.0)) (PI))))
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 14.3%
Taylor expanded in angle around 0
Applied rewrites12.7%
Taylor expanded in a around inf
Applied rewrites13.2%
herbie shell --seed 2025018
(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))))