
(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 10 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 (* angle (PI)))
(t_1 (* 0.005555555555555556 t_0))
(t_2 (cos t_1)))
(if (<= b_m 2.35e-55)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ t_1 t_2))) (PI)))
(*
180.0
(/
(atan
(*
(/ (- y-scale) x-scale)
(/
(pow t_2 2.0)
(* (sin t_1) (sin (fma 0.005555555555555556 t_0 (* 0.5 (PI))))))))
(PI))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := 0.005555555555555556 \cdot t\_0\\
t_2 := \cos t\_1\\
\mathbf{if}\;b\_m \leq 2.35 \cdot 10^{-55}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{t\_2}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{{t\_2}^{2}}{\sin t\_1 \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556, t\_0, 0.5 \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 2.35e-55Initial program 11.4%
Taylor expanded in x-scale around 0
Applied rewrites29.2%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
lift-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
tan-quotN/A
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-cos.f6451.0
Applied rewrites51.0%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6452.5
Applied rewrites52.5%
if 2.35e-55 < b Initial program 19.1%
Taylor expanded in x-scale around 0
Applied rewrites33.9%
lift-cos.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6433.7
Applied rewrites33.7%
Taylor expanded in a around 0
Applied rewrites61.1%
Final simplification54.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* angle (PI)))
(t_1 (* 0.005555555555555556 t_0))
(t_2 (cos t_1))
(t_3 (sin t_1)))
(if (<= b_m 5.9e-59)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ t_1 t_2))) (PI)))
(if (<= b_m 5.5e+120)
(*
180.0
(/
(atan
(*
-0.5
(*
(/ y-scale x-scale)
(/
(* 2.0 (* b_m b_m))
(*
(sin (fma 0.005555555555555556 t_0 (/ (PI) 2.0)))
(* t_3 (- (* b_m b_m) (* a a))))))))
(PI)))
(* 180.0 (/ (atan (* (/ (- y-scale) x-scale) (/ t_2 t_3))) (PI)))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := 0.005555555555555556 \cdot t\_0\\
t_2 := \cos t\_1\\
t_3 := \sin t\_1\\
\mathbf{if}\;b\_m \leq 5.9 \cdot 10^{-59}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{t\_2}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;b\_m \leq 5.5 \cdot 10^{+120}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left(b\_m \cdot b\_m\right)}{\sin \left(\mathsf{fma}\left(0.005555555555555556, t\_0, \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(t\_3 \cdot \left(b\_m \cdot b\_m - a \cdot a\right)\right)}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{t\_2}{t\_3}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 5.8999999999999998e-59Initial program 11.4%
Taylor expanded in x-scale around 0
Applied rewrites29.2%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
lift-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
tan-quotN/A
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-cos.f6451.0
Applied rewrites51.0%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6452.5
Applied rewrites52.5%
if 5.8999999999999998e-59 < b < 5.50000000000000003e120Initial program 41.4%
Taylor expanded in x-scale around 0
Applied rewrites63.2%
lift-cos.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6462.9
Applied rewrites62.9%
Taylor expanded in angle around 0
lower-*.f64N/A
pow2N/A
lift-*.f6466.8
Applied rewrites66.8%
if 5.50000000000000003e120 < b Initial program 0.0%
Taylor expanded in x-scale around 0
Applied rewrites8.8%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites58.9%
Final simplification55.0%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle (PI)))))
(if (<= b_m 1e+75)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (tan t_0))) (PI)))
(*
180.0
(/ (atan (* (/ (- y-scale) x-scale) (/ (cos t_0) (sin t_0)))) (PI))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;b\_m \leq 10^{+75}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \tan t\_0\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;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}
if b < 9.99999999999999927e74Initial program 13.8%
Taylor expanded in x-scale around 0
Applied rewrites31.7%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
if 9.99999999999999927e74 < b Initial program 11.1%
Taylor expanded in x-scale around 0
Applied rewrites24.4%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites60.5%
Final simplification52.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle (PI)))))
(if (<= b_m 2.9e-58)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ t_0 (cos t_0)))) (PI)))
(if (<= b_m 8.8e+101)
(*
180.0
(/
(atan
(*
-0.5
(*
(/ y-scale x-scale)
(/
(* 2.0 (* b_m b_m))
(* 1.0 (* (sin t_0) (- (* b_m b_m) (* a a))))))))
(PI)))
(*
180.0
(/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI)))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;b\_m \leq 2.9 \cdot 10^{-58}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_0}{\cos t\_0}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;b\_m \leq 8.8 \cdot 10^{+101}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left(b\_m \cdot b\_m\right)}{1 \cdot \left(\sin t\_0 \cdot \left(b\_m \cdot b\_m - a \cdot a\right)\right)}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 2.8999999999999999e-58Initial program 11.4%
Taylor expanded in x-scale around 0
Applied rewrites29.2%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
lift-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
tan-quotN/A
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-cos.f6451.0
Applied rewrites51.0%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6452.5
Applied rewrites52.5%
if 2.8999999999999999e-58 < b < 8.8000000000000003e101Initial program 47.9%
Taylor expanded in x-scale around 0
Applied rewrites66.7%
Taylor expanded in angle around 0
Applied rewrites66.1%
Taylor expanded in angle around 0
lower-*.f64N/A
pow2N/A
lift-*.f6462.6
Applied rewrites62.6%
if 8.8000000000000003e101 < b Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites5.4%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6460.5
Applied rewrites60.5%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 2.9e+75)
(*
180.0
(/
(atan
(* (/ y-scale x-scale) (tan (* 0.005555555555555556 (* angle (PI))))))
(PI)))
(*
180.0
(/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI)))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 2.9 \cdot 10^{+75}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \tan \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 2.8999999999999998e75Initial program 13.8%
Taylor expanded in x-scale around 0
Applied rewrites31.7%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
if 2.8999999999999998e75 < b Initial program 11.1%
Taylor expanded in angle around 0
Applied rewrites11.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6462.7
Applied rewrites62.7%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 3e-59)
(*
180.0
(/
(atan (* (/ y-scale x-scale) (* 0.005555555555555556 (* angle (PI)))))
(PI)))
(if (<= b_m 1.05e+153)
(*
180.0
(/
(atan
(*
-0.5
(*
(/ y-scale x-scale)
(*
360.0
(/ (* b_m b_m) (* angle (* (PI) (- (* b_m b_m) (* a a)))))))))
(PI)))
(*
180.0
(/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI))))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 3 \cdot 10^{-59}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;b\_m \leq 1.05 \cdot 10^{+153}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(360 \cdot \frac{b\_m \cdot b\_m}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b\_m \cdot b\_m - a \cdot a\right)\right)}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 3.0000000000000001e-59Initial program 11.4%
Taylor expanded in x-scale around 0
Applied rewrites29.2%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6449.4
Applied rewrites49.4%
if 3.0000000000000001e-59 < b < 1.05000000000000008e153Initial program 36.4%
Taylor expanded in x-scale around 0
Applied rewrites64.6%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f6467.7
Applied rewrites67.7%
if 1.05000000000000008e153 < b Initial program 0.0%
Taylor expanded in angle around 0
Applied rewrites0.0%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6456.7
Applied rewrites56.7%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 5.8e+52)
(*
180.0
(/
(atan (* (/ y-scale x-scale) (* 0.005555555555555556 (* angle (PI)))))
(PI)))
(*
180.0
(/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI)))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 5.8 \cdot 10^{+52}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if b < 5.8e52Initial program 13.4%
Taylor expanded in x-scale around 0
Applied rewrites31.5%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6449.1
Applied rewrites49.1%
if 5.8e52 < b Initial program 12.8%
Taylor expanded in angle around 0
Applied rewrites15.3%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6464.3
Applied rewrites64.3%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= a 1.55e-249)
(* 180.0 (/ (atan (* -180.0 (/ x-scale (* angle (* y-scale (PI)))))) (PI)))
(*
180.0
(/
(atan (* (/ y-scale x-scale) (* 0.005555555555555556 (* angle (PI)))))
(PI)))))\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.55 \cdot 10^{-249}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if a < 1.54999999999999993e-249Initial program 17.1%
Taylor expanded in angle around 0
Applied rewrites13.7%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6417.8
Applied rewrites17.8%
if 1.54999999999999993e-249 < a Initial program 8.9%
Taylor expanded in x-scale around 0
Applied rewrites24.6%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6455.1
Applied rewrites55.1%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6456.3
Applied rewrites56.3%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (/ y-scale x-scale) (* 0.005555555555555556 (* angle (PI))))) (PI))))
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 13.3%
Taylor expanded in x-scale around 0
Applied rewrites30.4%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6448.7
Applied rewrites48.7%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6446.6
Applied rewrites46.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* 0.005555555555555556 (/ (* angle (* y-scale (PI))) x-scale))) (PI))))
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \frac{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}{x-scale}\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 13.3%
Taylor expanded in x-scale around 0
Applied rewrites30.4%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6448.7
Applied rewrites48.7%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6441.1
Applied rewrites41.1%
herbie shell --seed 2025054
(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))))