\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\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} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}}\begin{array}{l}
\mathbf{if}\;y-scale \leq -44847.953253698484:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{\left(a \cdot a\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + \left({\left(\sqrt[3]{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \left(\sqrt[3]{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \sqrt[3]{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)\right)}^{2} \cdot \left(b \cdot b\right) + \sqrt{{a}^{4} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4} + \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4} \cdot {b}^{4} + 2 \cdot \left(\left(a \cdot a\right) \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot \left({\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot \left(b \cdot b\right)\right)\right)\right)\right)}\right)}\right)\\
\mathbf{elif}\;y-scale \leq -1.0781800889803831 \cdot 10^{-77}:\\
\;\;\;\;0.25 \cdot \left(\left(a \cdot \left(\sqrt{8} \cdot \left(y-scale \cdot x-scale\right)\right)\right) \cdot \sqrt{\frac{{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{y-scale \cdot y-scale} + \left(\frac{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{x-scale \cdot x-scale} + \sqrt{\frac{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}{{x-scale}^{4}} + \left(2 \cdot \frac{{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{\left(y-scale \cdot x-scale\right)}^{2}} + \frac{{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}{{y-scale}^{4}}\right)}\right)}\right)\\
\mathbf{elif}\;y-scale \leq 1.701727849224599 \cdot 10^{-78}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{\left(a \cdot a\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + \left({\left(\sqrt[3]{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \left(\sqrt[3]{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \sqrt[3]{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)\right)}^{2} \cdot \left(b \cdot b\right) + \sqrt{{a}^{4} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4} + \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4} \cdot {b}^{4} + 2 \cdot \left(\left(a \cdot a\right) \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot \left({\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot \left(b \cdot b\right)\right)\right)\right)\right)}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(y-scale \cdot \sqrt{8}\right) \cdot \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot {a}^{2} + \left({\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot {b}^{2} + \sqrt{{a}^{4} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4} + \left(2 \cdot \left({a}^{2} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot \left({\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot {b}^{2}\right)\right)\right) + {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4} \cdot {b}^{4}\right)}\right)}\right)\\
\end{array}(FPCore (a b angle x-scale y-scale)
:precision binary64
(/
(-
(sqrt
(*
(*
(* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0)))
(* (* b a) (* b (- a))))
(+
(+
(/
(/
(+
(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))
(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)))))))
(/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (<= y-scale -44847.953253698484)
(*
0.25
(*
(* x-scale (sqrt 8.0))
(sqrt
(+
(* (* a a) (pow (cos (* 0.005555555555555556 (* angle PI))) 2.0))
(+
(*
(pow
(*
(cbrt (sin (* 0.005555555555555556 (* angle PI))))
(*
(cbrt (sin (* 0.005555555555555556 (* angle PI))))
(cbrt (sin (* 0.005555555555555556 (* angle PI))))))
2.0)
(* b b))
(sqrt
(+
(* (pow a 4.0) (pow (cos (* 0.005555555555555556 (* angle PI))) 4.0))
(+
(*
(pow (sin (* 0.005555555555555556 (* angle PI))) 4.0)
(pow b 4.0))
(*
2.0
(*
(* a a)
(*
(pow (sin (* 0.005555555555555556 (* angle PI))) 2.0)
(*
(pow (cos (* 0.005555555555555556 (* angle PI))) 2.0)
(* b b)))))))))))))
(if (<= y-scale -1.0781800889803831e-77)
(*
0.25
(*
(* a (* (sqrt 8.0) (* y-scale x-scale)))
(sqrt
(+
(/
(pow (cos (* 0.005555555555555556 (* angle PI))) 2.0)
(* y-scale y-scale))
(+
(/
(pow (sin (* 0.005555555555555556 (* angle PI))) 2.0)
(* x-scale x-scale))
(sqrt
(+
(/
(pow (sin (* 0.005555555555555556 (* angle PI))) 4.0)
(pow x-scale 4.0))
(+
(*
2.0
(/
(*
(pow (cos (* 0.005555555555555556 (* angle PI))) 2.0)
(pow (sin (* 0.005555555555555556 (* angle PI))) 2.0))
(pow (* y-scale x-scale) 2.0)))
(/
(pow (cos (* 0.005555555555555556 (* angle PI))) 4.0)
(pow y-scale 4.0))))))))))
(if (<= y-scale 1.701727849224599e-78)
(*
0.25
(*
(* x-scale (sqrt 8.0))
(sqrt
(+
(* (* a a) (pow (cos (* 0.005555555555555556 (* angle PI))) 2.0))
(+
(*
(pow
(*
(cbrt (sin (* 0.005555555555555556 (* angle PI))))
(*
(cbrt (sin (* 0.005555555555555556 (* angle PI))))
(cbrt (sin (* 0.005555555555555556 (* angle PI))))))
2.0)
(* b b))
(sqrt
(+
(*
(pow a 4.0)
(pow (cos (* 0.005555555555555556 (* angle PI))) 4.0))
(+
(*
(pow (sin (* 0.005555555555555556 (* angle PI))) 4.0)
(pow b 4.0))
(*
2.0
(*
(* a a)
(*
(pow (sin (* 0.005555555555555556 (* angle PI))) 2.0)
(*
(pow (cos (* 0.005555555555555556 (* angle PI))) 2.0)
(* b b)))))))))))))
(*
0.25
(*
(* y-scale (sqrt 8.0))
(sqrt
(+
(*
(pow (sin (* 0.005555555555555556 (* angle PI))) 2.0)
(pow a 2.0))
(+
(*
(pow (cos (* 0.005555555555555556 (* angle PI))) 2.0)
(pow b 2.0))
(sqrt
(+
(*
(pow a 4.0)
(pow (sin (* 0.005555555555555556 (* angle PI))) 4.0))
(+
(*
2.0
(*
(pow a 2.0)
(*
(pow (sin (* 0.005555555555555556 (* angle PI))) 2.0)
(*
(pow (cos (* 0.005555555555555556 (* angle PI))) 2.0)
(pow b 2.0)))))
(*
(pow (cos (* 0.005555555555555556 (* angle PI))) 4.0)
(pow b 4.0))))))))))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -sqrt(((2.0 * ((4.0 * ((b * a) * (b * -a))) / pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((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)) + sqrt(pow(((((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)), 2.0) + pow((((((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)))) / ((4.0 * ((b * a) * (b * -a))) / pow((x_45_scale * y_45_scale), 2.0));
}
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (y_45_scale <= -44847.953253698484) {
tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * sqrt(((a * a) * pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0)) + ((pow((cbrt(sin(0.005555555555555556 * (angle * ((double) M_PI)))) * (cbrt(sin(0.005555555555555556 * (angle * ((double) M_PI)))) * cbrt(sin(0.005555555555555556 * (angle * ((double) M_PI)))))), 2.0) * (b * b)) + sqrt((pow(a, 4.0) * pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 4.0)) + ((pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 4.0) * pow(b, 4.0)) + (2.0 * ((a * a) * (pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * (pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * (b * b))))))))));
} else if (y_45_scale <= -1.0781800889803831e-77) {
tmp = 0.25 * ((a * (sqrt(8.0) * (y_45_scale * x_45_scale))) * sqrt((pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) / (y_45_scale * y_45_scale)) + ((pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) / (x_45_scale * x_45_scale)) + sqrt((pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 4.0) / pow(x_45_scale, 4.0)) + ((2.0 * ((pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 2.0)) / pow((y_45_scale * x_45_scale), 2.0))) + (pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 4.0) / pow(y_45_scale, 4.0)))))));
} else if (y_45_scale <= 1.701727849224599e-78) {
tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * sqrt(((a * a) * pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0)) + ((pow((cbrt(sin(0.005555555555555556 * (angle * ((double) M_PI)))) * (cbrt(sin(0.005555555555555556 * (angle * ((double) M_PI)))) * cbrt(sin(0.005555555555555556 * (angle * ((double) M_PI)))))), 2.0) * (b * b)) + sqrt((pow(a, 4.0) * pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 4.0)) + ((pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 4.0) * pow(b, 4.0)) + (2.0 * ((a * a) * (pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * (pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * (b * b))))))))));
} else {
tmp = 0.25 * ((y_45_scale * sqrt(8.0)) * sqrt((pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * pow(a, 2.0)) + ((pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * pow(b, 2.0)) + sqrt((pow(a, 4.0) * pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 4.0)) + ((2.0 * (pow(a, 2.0) * (pow(sin(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * (pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 2.0) * pow(b, 2.0))))) + (pow(cos(0.005555555555555556 * (angle * ((double) M_PI))), 4.0) * pow(b, 4.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 y-scale < -44847.9532536984843 or -1.0781800889803831e-77 < y-scale < 1.70172784922459888e-78Initial program 63.6
Taylor expanded around 0 58.1
Simplified58.1
rmApplied add-cube-cbrt_binary6458.1
if -44847.9532536984843 < y-scale < -1.0781800889803831e-77Initial program 63.1
Taylor expanded around inf 56.4
Simplified56.4
if 1.70172784922459888e-78 < y-scale Initial program 63.4
Taylor expanded around 0 52.9
Final simplification56.5
herbie shell --seed 2021113
(FPCore (a b angle x-scale y-scale)
:name "a from scale-rotated-ellipse"
:precision binary64
(/ (- (sqrt (* (* (* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))) (* (* b a) (* b (- a)))) (+ (+ (/ (/ (+ (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)) (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))))))) (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))