
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) (PI)))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\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 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (* a b) (* y-scale x-scale)))
(t_1 (* (PI) (/ angle 180.0)))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4
(/
(/ (* t_3 (* t_2 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_4 t_4)
(*
(/ (/ (+ (pow (* t_2 b) 2.0) (pow (* t_3 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_3 b) 2.0) (pow (* t_2 a) 2.0)) x-scale) x-scale)
4.0)))
2e+14)
(* -4.0 (pow (* (/ (/ b x-scale) y-scale) a) 2.0))
(* (* t_0 t_0) -4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
t_1 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := \frac{\frac{t\_3 \cdot \left(t\_2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_4 \cdot t\_4 - \frac{\frac{{\left(t\_2 \cdot b\right)}^{2} + {\left(t\_3 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_3 \cdot b\right)}^{2} + {\left(t\_2 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 2 \cdot 10^{+14}:\\
\;\;\;\;-4 \cdot {\left(\frac{\frac{b}{x-scale}}{y-scale} \cdot a\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 2e14Initial program 66.2%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
Applied rewrites78.6%
Applied rewrites99.7%
if 2e14 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) Initial program 0.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.3
Applied rewrites42.3%
Applied rewrites79.5%
Applied rewrites94.5%
Final simplification96.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (* a b) (* y-scale x-scale)))
(t_1 (* (PI) (/ angle 180.0)))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4
(/
(/ (* t_3 (* t_2 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_4 t_4)
(*
(/ (/ (+ (pow (* t_2 b) 2.0) (pow (* t_3 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_3 b) 2.0) (pow (* t_2 a) 2.0)) x-scale) x-scale)
4.0)))
2e-104)
(*
(* (* (* -4.0 (/ b x-scale)) (/ a y-scale)) (/ b x-scale))
(/ a y-scale))
(* (* t_0 t_0) -4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
t_1 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := \frac{\frac{t\_3 \cdot \left(t\_2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_4 \cdot t\_4 - \frac{\frac{{\left(t\_2 \cdot b\right)}^{2} + {\left(t\_3 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_3 \cdot b\right)}^{2} + {\left(t\_2 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 2 \cdot 10^{-104}:\\
\;\;\;\;\left(\left(\left(-4 \cdot \frac{b}{x-scale}\right) \cdot \frac{a}{y-scale}\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{a}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 1.99999999999999985e-104Initial program 68.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.8
Applied rewrites72.8%
Applied rewrites86.6%
Applied rewrites99.7%
if 1.99999999999999985e-104 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) Initial program 0.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.8
Applied rewrites42.8%
Applied rewrites79.3%
Applied rewrites94.6%
Final simplification96.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (* a b) (* y-scale x-scale)))
(t_1 (* (PI) (/ angle 180.0)))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4
(/
(/ (* t_3 (* t_2 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_4 t_4)
(*
(/ (/ (+ (pow (* t_2 b) 2.0) (pow (* t_3 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_3 b) 2.0) (pow (* t_2 a) 2.0)) x-scale) x-scale)
4.0)))
1e-155)
(*
(* (/ b y-scale) (/ a x-scale))
(* (* -4.0 (/ b x-scale)) (/ a y-scale)))
(* (* t_0 t_0) -4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
t_1 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := \frac{\frac{t\_3 \cdot \left(t\_2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_4 \cdot t\_4 - \frac{\frac{{\left(t\_2 \cdot b\right)}^{2} + {\left(t\_3 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_3 \cdot b\right)}^{2} + {\left(t\_2 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 10^{-155}:\\
\;\;\;\;\left(\frac{b}{y-scale} \cdot \frac{a}{x-scale}\right) \cdot \left(\left(-4 \cdot \frac{b}{x-scale}\right) \cdot \frac{a}{y-scale}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 1.00000000000000001e-155Initial program 70.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6473.9
Applied rewrites73.9%
Applied rewrites89.0%
Applied rewrites98.8%
if 1.00000000000000001e-155 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) Initial program 0.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.6
Applied rewrites42.6%
Applied rewrites78.1%
Applied rewrites94.7%
Final simplification96.3%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ b y-scale) (/ a x-scale)))
(t_1 (/ (* a b) (* y-scale x-scale)))
(t_2 (* (PI) (/ angle 180.0)))
(t_3 (sin t_2))
(t_4 (cos t_2))
(t_5
(/
(/ (* t_4 (* t_3 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_5 t_5)
(*
(/ (/ (+ (pow (* t_3 b) 2.0) (pow (* t_4 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_4 b) 2.0) (pow (* t_3 a) 2.0)) x-scale) x-scale)
4.0)))
1e-155)
(* (* t_0 t_0) -4.0)
(* (* t_1 t_1) -4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale} \cdot \frac{a}{x-scale}\\
t_1 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
t_2 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_3 := \sin t\_2\\
t_4 := \cos t\_2\\
t_5 := \frac{\frac{t\_4 \cdot \left(t\_3 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_5 \cdot t\_5 - \frac{\frac{{\left(t\_3 \cdot b\right)}^{2} + {\left(t\_4 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_4 \cdot b\right)}^{2} + {\left(t\_3 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 10^{-155}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 1.00000000000000001e-155Initial program 70.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6473.9
Applied rewrites73.9%
Applied rewrites80.9%
Applied rewrites94.1%
Applied rewrites98.8%
if 1.00000000000000001e-155 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) Initial program 0.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.6
Applied rewrites42.6%
Applied rewrites78.1%
Applied rewrites94.7%
Final simplification96.3%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale)))
(t_1 (* (PI) (/ angle 180.0)))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4
(/
(/ (* t_3 (* t_2 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_4 t_4)
(*
(/ (/ (+ (pow (* t_2 b) 2.0) (pow (* t_3 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_3 b) 2.0) (pow (* t_2 a) 2.0)) x-scale) x-scale)
4.0)))
2e+186)
(* (* t_0 t_0) (* (* a a) -4.0))
(*
(/ (* (* a b) (* a b)) (* (* y-scale x-scale) (* y-scale x-scale)))
-4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
t_1 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := \frac{\frac{t\_3 \cdot \left(t\_2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_4 \cdot t\_4 - \frac{\frac{{\left(t\_2 \cdot b\right)}^{2} + {\left(t\_3 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_3 \cdot b\right)}^{2} + {\left(t\_2 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 2 \cdot 10^{+186}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot \left(\left(a \cdot a\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(a \cdot b\right) \cdot \left(a \cdot b\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 1.99999999999999996e186Initial program 65.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
Applied rewrites89.8%
if 1.99999999999999996e186 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) Initial program 0.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.2
Applied rewrites42.2%
Applied rewrites80.5%
Applied rewrites94.5%
Applied rewrites80.5%
Final simplification84.4%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (PI) (/ angle 180.0)))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* t_2 (* t_1 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_3 t_3)
(*
(/ (/ (+ (pow (* t_1 b) 2.0) (pow (* t_2 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_2 b) 2.0) (pow (* t_1 a) 2.0)) x-scale) x-scale)
4.0)))
2e+186)
(*
(* (/ b (* (* y-scale x-scale) y-scale)) (/ b x-scale))
(* (* a a) -4.0))
(*
(/ (* (* a b) (* a b)) (* (* y-scale x-scale) (* y-scale x-scale)))
-4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{t\_2 \cdot \left(t\_1 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_3 \cdot t\_3 - \frac{\frac{{\left(t\_1 \cdot b\right)}^{2} + {\left(t\_2 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_2 \cdot b\right)}^{2} + {\left(t\_1 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 2 \cdot 10^{+186}:\\
\;\;\;\;\left(\frac{b}{\left(y-scale \cdot x-scale\right) \cdot y-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\left(a \cdot a\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(a \cdot b\right) \cdot \left(a \cdot b\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 1.99999999999999996e186Initial program 65.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
Taylor expanded in b around 0
Applied rewrites77.0%
Applied rewrites82.8%
if 1.99999999999999996e186 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) Initial program 0.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.2
Applied rewrites42.2%
Applied rewrites80.5%
Applied rewrites94.5%
Applied rewrites80.5%
Final simplification81.5%
(FPCore (a b angle x-scale y-scale) :precision binary64 (let* ((t_0 (/ (* a b) (* y-scale x-scale)))) (* (* t_0 t_0) -4.0)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a * b) / (y_45_scale * x_45_scale);
return (t_0 * t_0) * -4.0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
t_0 = (a * b) / (y_45scale * x_45scale)
code = (t_0 * t_0) * (-4.0d0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a * b) / (y_45_scale * x_45_scale);
return (t_0 * t_0) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (a * b) / (y_45_scale * x_45_scale) return (t_0 * t_0) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(a * b) / Float64(y_45_scale * x_45_scale)) return Float64(Float64(t_0 * t_0) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (a * b) / (y_45_scale * x_45_scale); tmp = (t_0 * t_0) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(a * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
\left(t\_0 \cdot t\_0\right) \cdot -4
\end{array}
\end{array}
Initial program 27.2%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
Applied rewrites79.2%
Applied rewrites94.5%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* (* (/ a (* y-scale x-scale)) b) (/ (* a b) (* y-scale x-scale))) -4.0))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a / (y_45_scale * x_45_scale)) * b) * ((a * b) / (y_45_scale * x_45_scale))) * -4.0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (((a / (y_45scale * x_45scale)) * b) * ((a * b) / (y_45scale * x_45scale))) * (-4.0d0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a / (y_45_scale * x_45_scale)) * b) * ((a * b) / (y_45_scale * x_45_scale))) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((a / (y_45_scale * x_45_scale)) * b) * ((a * b) / (y_45_scale * x_45_scale))) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a / Float64(y_45_scale * x_45_scale)) * b) * Float64(Float64(a * b) / Float64(y_45_scale * x_45_scale))) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a / (y_45_scale * x_45_scale)) * b) * ((a * b) / (y_45_scale * x_45_scale))) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * N[(N[(a * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{a}{y-scale \cdot x-scale} \cdot b\right) \cdot \frac{a \cdot b}{y-scale \cdot x-scale}\right) \cdot -4
\end{array}
Initial program 27.2%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
Applied rewrites79.2%
Applied rewrites94.5%
Applied rewrites93.5%
Final simplification93.5%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (/ (* (* a b) (* a b)) (* (* y-scale x-scale) (* y-scale x-scale))) -4.0))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * b) * (a * b)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * -4.0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (((a * b) * (a * b)) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (-4.0d0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * b) * (a * b)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((a * b) * (a * b)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a * b) * Float64(a * b)) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a * b) * (a * b)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a * b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(a \cdot b\right) \cdot \left(a \cdot b\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot -4
\end{array}
Initial program 27.2%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
Applied rewrites79.2%
Applied rewrites94.5%
Applied rewrites79.2%
Final simplification79.2%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (/ (* b b) (* (* y-scale x-scale) (* y-scale x-scale))) (* (* a a) -4.0)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a * a) * -4.0);
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = ((b * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * ((a * a) * (-4.0d0))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a * a) * -4.0);
}
def code(a, b, angle, x_45_scale, y_45_scale): return ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a * a) * -4.0)
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(b * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(Float64(a * a) * -4.0)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a * a) * -4.0); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(b * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\left(a \cdot a\right) \cdot -4\right)
\end{array}
Initial program 27.2%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
Taylor expanded in b around 0
Applied rewrites62.7%
Final simplification62.7%
herbie shell --seed 2024263
(FPCore (a b angle x-scale y-scale)
:name "Simplification of discriminant from scale-rotated-ellipse"
:precision binary64
(- (* (/ (/ (* (* (* 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 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale)) (* (* 4.0 (/ (/ (+ (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))))