\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale}
\begin{array}{l}
\mathbf{if}\;a \leq -1.3448978125949803 \cdot 10^{+154}:\\
\;\;\;\;0\\
\mathbf{elif}\;a \leq 1.3390927204115252 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_1 := \cos t_0\\
t_2 := \sin t_0\\
\frac{b \cdot \left(b \cdot \left(\frac{{t_1}^{2} \cdot \left({a}^{2} \cdot {t_2}^{2}\right)}{y-scale \cdot x-scale} \cdot -8 - \left(4 \cdot \frac{{a}^{2} \cdot {t_1}^{4}}{y-scale \cdot x-scale} + 4 \cdot \frac{{a}^{2} \cdot {t_2}^{4}}{y-scale \cdot x-scale}\right)\right)\right)}{y-scale \cdot x-scale}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
(FPCore (a b angle x-scale y-scale)
: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))))(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (<= a -1.3448978125949803e+154)
0.0
(if (<= a 1.3390927204115252e+154)
(let* ((t_0 (* 0.005555555555555556 (* angle PI)))
(t_1 (cos t_0))
(t_2 (sin t_0)))
(/
(*
b
(*
b
(-
(*
(/
(* (pow t_1 2.0) (* (pow a 2.0) (pow t_2 2.0)))
(* y-scale x-scale))
-8.0)
(+
(* 4.0 (/ (* (pow a 2.0) (pow t_1 4.0)) (* y-scale x-scale)))
(* 4.0 (/ (* (pow a 2.0) (pow t_2 4.0)) (* y-scale x-scale)))))))
(* y-scale x-scale)))
0.0)))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin((angle / 180.0) * ((double) M_PI))) * cos((angle / 180.0) * ((double) M_PI))) / x_45_scale) / y_45_scale) * (((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin((angle / 180.0) * ((double) M_PI))) * cos((angle / 180.0) * ((double) M_PI))) / x_45_scale) / y_45_scale)) - ((4.0 * (((pow((a * sin((angle / 180.0) * ((double) M_PI))), 2.0) + pow((b * cos((angle / 180.0) * ((double) M_PI))), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * cos((angle / 180.0) * ((double) M_PI))), 2.0) + pow((b * sin((angle / 180.0) * ((double) M_PI))), 2.0)) / y_45_scale) / y_45_scale));
}
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (a <= -1.3448978125949803e+154) {
tmp = 0.0;
} else if (a <= 1.3390927204115252e+154) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_1 = cos(t_0);
double t_2 = sin(t_0);
tmp = (b * (b * ((((pow(t_1, 2.0) * (pow(a, 2.0) * pow(t_2, 2.0))) / (y_45_scale * x_45_scale)) * -8.0) - ((4.0 * ((pow(a, 2.0) * pow(t_1, 4.0)) / (y_45_scale * x_45_scale))) + (4.0 * ((pow(a, 2.0) * pow(t_2, 4.0)) / (y_45_scale * x_45_scale))))))) / (y_45_scale * x_45_scale);
} else {
tmp = 0.0;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus angle



Bits error versus x-scale



Bits error versus y-scale
Results
if a < -1.34489781259498026e154 or 1.33909272041152523e154 < a Initial program 64.0
Taylor expanded in b around 0 64.0
Simplified45.0
if -1.34489781259498026e154 < a < 1.33909272041152523e154Initial program 36.9
Applied associate-*r/_binary6436.9
Applied associate-*l/_binary6435.9
Applied associate-*l/_binary6436.2
Applied frac-sub_binary6435.7
Taylor expanded in b around 0 21.3
Applied unpow2_binary6421.3
Applied associate-*r*_binary6415.2
Final simplification19.7
herbie shell --seed 2022061
(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))))