
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) PI)))
double code(double A, double B, double C) {
return 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / ((double) M_PI));
}
public static double code(double A, double B, double C) {
return 180.0 * (Math.atan(((1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / Math.PI);
}
def code(A, B, C): return 180.0 * (math.atan(((1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / math.pi)
function code(A, B, C) return Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))) / pi)) end
function tmp = code(A, B, C) tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi); end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) PI)))
double code(double A, double B, double C) {
return 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / ((double) M_PI));
}
public static double code(double A, double B, double C) {
return 180.0 * (Math.atan(((1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / Math.PI);
}
def code(A, B, C): return 180.0 * (math.atan(((1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / math.pi)
function code(A, B, C) return Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))) / pi)) end
function tmp = code(A, B, C) tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi); end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi}
\end{array}
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ (* 180.0 (atan (/ (- (- C A) (hypot (- C A) B)) B))) PI))
(t_1
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(if (<= t_1 -0.5)
t_0
(if (<= t_1 0.0) (* 180.0 (/ (atan (* B (/ 0.5 (- A C)))) PI)) t_0))))
double code(double A, double B, double C) {
double t_0 = (180.0 * atan((((C - A) - hypot((C - A), B)) / B))) / ((double) M_PI);
double t_1 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
double tmp;
if (t_1 <= -0.5) {
tmp = t_0;
} else if (t_1 <= 0.0) {
tmp = 180.0 * (atan((B * (0.5 / (A - C)))) / ((double) M_PI));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = (180.0 * Math.atan((((C - A) - Math.hypot((C - A), B)) / B))) / Math.PI;
double t_1 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
double tmp;
if (t_1 <= -0.5) {
tmp = t_0;
} else if (t_1 <= 0.0) {
tmp = 180.0 * (Math.atan((B * (0.5 / (A - C)))) / Math.PI);
} else {
tmp = t_0;
}
return tmp;
}
def code(A, B, C): t_0 = (180.0 * math.atan((((C - A) - math.hypot((C - A), B)) / B))) / math.pi t_1 = (1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))) tmp = 0 if t_1 <= -0.5: tmp = t_0 elif t_1 <= 0.0: tmp = 180.0 * (math.atan((B * (0.5 / (A - C)))) / math.pi) else: tmp = t_0 return tmp
function code(A, B, C) t_0 = Float64(Float64(180.0 * atan(Float64(Float64(Float64(C - A) - hypot(Float64(C - A), B)) / B))) / pi) t_1 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))) tmp = 0.0 if (t_1 <= -0.5) tmp = t_0; elseif (t_1 <= 0.0) tmp = Float64(180.0 * Float64(atan(Float64(B * Float64(0.5 / Float64(A - C)))) / pi)); else tmp = t_0; end return tmp end
function tmp_2 = code(A, B, C) t_0 = (180.0 * atan((((C - A) - hypot((C - A), B)) / B))) / pi; t_1 = (1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))); tmp = 0.0; if (t_1 <= -0.5) tmp = t_0; elseif (t_1 <= 0.0) tmp = 180.0 * (atan((B * (0.5 / (A - C)))) / pi); else tmp = t_0; end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(180.0 * N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(C - A), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.5], t$95$0, If[LessEqual[t$95$1, 0.0], N[(180.0 * N[(N[ArcTan[N[(B * N[(0.5 / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(C - A, B\right)}{B}\right)}{\pi}\\
t_1 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{0.5}{A - C}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5 or 0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 57.6%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites88.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites57.6%
lift-sqrt.f64N/A
lift-fma.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lower-hypot.f6488.0
Applied rewrites88.0%
if -0.5 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 0.0Initial program 18.9%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites18.9%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.2
Applied rewrites99.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ (/ (- C A) B) -1.0))) PI)
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* B (/ 0.5 (- A C)))) PI))
(*
180.0
(/
(atan (- 1.0 (/ (fma -0.5 (* (- A C) (/ (- A C) B)) (- A C)) B)))
PI))))))
double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
double tmp;
if (t_0 <= -0.5) {
tmp = (180.0 * atan((((C - A) / B) + -1.0))) / ((double) M_PI);
} else if (t_0 <= 0.0) {
tmp = 180.0 * (atan((B * (0.5 / (A - C)))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((1.0 - (fma(-0.5, ((A - C) * ((A - C) / B)), (A - C)) / B))) / ((double) M_PI));
}
return tmp;
}
function code(A, B, C) t_0 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))) tmp = 0.0 if (t_0 <= -0.5) tmp = Float64(Float64(180.0 * atan(Float64(Float64(Float64(C - A) / B) + -1.0))) / pi); elseif (t_0 <= 0.0) tmp = Float64(180.0 * Float64(atan(Float64(B * Float64(0.5 / Float64(A - C)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(1.0 - Float64(fma(-0.5, Float64(Float64(A - C) * Float64(Float64(A - C) / B)), Float64(A - C)) / B))) / pi)); end return tmp end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.5], N[(N[(180.0 * N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(180.0 * N[(N[ArcTan[N[(B * N[(0.5 / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(1.0 - N[(N[(-0.5 * N[(N[(A - C), $MachinePrecision] * N[(N[(A - C), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(A - C), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - A}{B} + -1\right)}{\pi}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{0.5}{A - C}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 - \frac{\mathsf{fma}\left(-0.5, \left(A - C\right) \cdot \frac{A - C}{B}, A - C\right)}{B}\right)}{\pi}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 55.9%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites86.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites55.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.7
Applied rewrites78.7%
if -0.5 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 0.0Initial program 18.9%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites18.9%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.2
Applied rewrites99.2%
if 0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 59.1%
Taylor expanded in B around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites78.4%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ t_1 -1.0))) PI)
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* B (/ 0.5 (- A C)))) PI))
(* 180.0 (/ (atan (+ 1.0 t_1)) PI))))))
double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
double t_1 = (C - A) / B;
double tmp;
if (t_0 <= -0.5) {
tmp = (180.0 * atan((t_1 + -1.0))) / ((double) M_PI);
} else if (t_0 <= 0.0) {
tmp = 180.0 * (atan((B * (0.5 / (A - C)))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((1.0 + t_1)) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
double t_1 = (C - A) / B;
double tmp;
if (t_0 <= -0.5) {
tmp = (180.0 * Math.atan((t_1 + -1.0))) / Math.PI;
} else if (t_0 <= 0.0) {
tmp = 180.0 * (Math.atan((B * (0.5 / (A - C)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((1.0 + t_1)) / Math.PI);
}
return tmp;
}
def code(A, B, C): t_0 = (1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))) t_1 = (C - A) / B tmp = 0 if t_0 <= -0.5: tmp = (180.0 * math.atan((t_1 + -1.0))) / math.pi elif t_0 <= 0.0: tmp = 180.0 * (math.atan((B * (0.5 / (A - C)))) / math.pi) else: tmp = 180.0 * (math.atan((1.0 + t_1)) / math.pi) return tmp
function code(A, B, C) t_0 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))) t_1 = Float64(Float64(C - A) / B) tmp = 0.0 if (t_0 <= -0.5) tmp = Float64(Float64(180.0 * atan(Float64(t_1 + -1.0))) / pi); elseif (t_0 <= 0.0) tmp = Float64(180.0 * Float64(atan(Float64(B * Float64(0.5 / Float64(A - C)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(1.0 + t_1)) / pi)); end return tmp end
function tmp_2 = code(A, B, C) t_0 = (1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))); t_1 = (C - A) / B; tmp = 0.0; if (t_0 <= -0.5) tmp = (180.0 * atan((t_1 + -1.0))) / pi; elseif (t_0 <= 0.0) tmp = 180.0 * (atan((B * (0.5 / (A - C)))) / pi); else tmp = 180.0 * (atan((1.0 + t_1)) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[t$95$0, -0.5], N[(N[(180.0 * N[ArcTan[N[(t$95$1 + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(180.0 * N[(N[ArcTan[N[(B * N[(0.5 / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(1.0 + t$95$1), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(t\_1 + -1\right)}{\pi}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{0.5}{A - C}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\pi}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 55.9%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites86.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites55.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.7
Applied rewrites78.7%
if -0.5 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 0.0Initial program 18.9%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites18.9%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.2
Applied rewrites99.2%
if 0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 59.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.4
Applied rewrites77.4%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ t_1 -1.0))) PI)
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* B (/ -0.5 C))) PI))
(* 180.0 (/ (atan (+ 1.0 t_1)) PI))))))
double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
double t_1 = (C - A) / B;
double tmp;
if (t_0 <= -0.5) {
tmp = (180.0 * atan((t_1 + -1.0))) / ((double) M_PI);
} else if (t_0 <= 0.0) {
tmp = 180.0 * (atan((B * (-0.5 / C))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((1.0 + t_1)) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
double t_1 = (C - A) / B;
double tmp;
if (t_0 <= -0.5) {
tmp = (180.0 * Math.atan((t_1 + -1.0))) / Math.PI;
} else if (t_0 <= 0.0) {
tmp = 180.0 * (Math.atan((B * (-0.5 / C))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((1.0 + t_1)) / Math.PI);
}
return tmp;
}
def code(A, B, C): t_0 = (1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))) t_1 = (C - A) / B tmp = 0 if t_0 <= -0.5: tmp = (180.0 * math.atan((t_1 + -1.0))) / math.pi elif t_0 <= 0.0: tmp = 180.0 * (math.atan((B * (-0.5 / C))) / math.pi) else: tmp = 180.0 * (math.atan((1.0 + t_1)) / math.pi) return tmp
function code(A, B, C) t_0 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))) t_1 = Float64(Float64(C - A) / B) tmp = 0.0 if (t_0 <= -0.5) tmp = Float64(Float64(180.0 * atan(Float64(t_1 + -1.0))) / pi); elseif (t_0 <= 0.0) tmp = Float64(180.0 * Float64(atan(Float64(B * Float64(-0.5 / C))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(1.0 + t_1)) / pi)); end return tmp end
function tmp_2 = code(A, B, C) t_0 = (1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))); t_1 = (C - A) / B; tmp = 0.0; if (t_0 <= -0.5) tmp = (180.0 * atan((t_1 + -1.0))) / pi; elseif (t_0 <= 0.0) tmp = 180.0 * (atan((B * (-0.5 / C))) / pi); else tmp = 180.0 * (atan((1.0 + t_1)) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[t$95$0, -0.5], N[(N[(180.0 * N[ArcTan[N[(t$95$1 + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(180.0 * N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(1.0 + t$95$1), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(t\_1 + -1\right)}{\pi}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\pi}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 55.9%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites86.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites55.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.7
Applied rewrites78.7%
if -0.5 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 0.0Initial program 18.9%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
Applied rewrites58.0%
if 0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 59.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.4
Applied rewrites77.4%
Final simplification75.6%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* 180.0 (/ (atan (+ t_1 -1.0)) PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* B (/ -0.5 C))) PI))
(* 180.0 (/ (atan (+ 1.0 t_1)) PI))))))
double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
double t_1 = (C - A) / B;
double tmp;
if (t_0 <= -0.5) {
tmp = 180.0 * (atan((t_1 + -1.0)) / ((double) M_PI));
} else if (t_0 <= 0.0) {
tmp = 180.0 * (atan((B * (-0.5 / C))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((1.0 + t_1)) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
double t_1 = (C - A) / B;
double tmp;
if (t_0 <= -0.5) {
tmp = 180.0 * (Math.atan((t_1 + -1.0)) / Math.PI);
} else if (t_0 <= 0.0) {
tmp = 180.0 * (Math.atan((B * (-0.5 / C))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((1.0 + t_1)) / Math.PI);
}
return tmp;
}
def code(A, B, C): t_0 = (1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))) t_1 = (C - A) / B tmp = 0 if t_0 <= -0.5: tmp = 180.0 * (math.atan((t_1 + -1.0)) / math.pi) elif t_0 <= 0.0: tmp = 180.0 * (math.atan((B * (-0.5 / C))) / math.pi) else: tmp = 180.0 * (math.atan((1.0 + t_1)) / math.pi) return tmp
function code(A, B, C) t_0 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))) t_1 = Float64(Float64(C - A) / B) tmp = 0.0 if (t_0 <= -0.5) tmp = Float64(180.0 * Float64(atan(Float64(t_1 + -1.0)) / pi)); elseif (t_0 <= 0.0) tmp = Float64(180.0 * Float64(atan(Float64(B * Float64(-0.5 / C))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(1.0 + t_1)) / pi)); end return tmp end
function tmp_2 = code(A, B, C) t_0 = (1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))); t_1 = (C - A) / B; tmp = 0.0; if (t_0 <= -0.5) tmp = 180.0 * (atan((t_1 + -1.0)) / pi); elseif (t_0 <= 0.0) tmp = 180.0 * (atan((B * (-0.5 / C))) / pi); else tmp = 180.0 * (atan((1.0 + t_1)) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[t$95$0, -0.5], N[(180.0 * N[(N[ArcTan[N[(t$95$1 + -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(180.0 * N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(1.0 + t$95$1), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + -1\right)}{\pi}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\pi}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 55.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.7
Applied rewrites78.7%
if -0.5 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 0.0Initial program 18.9%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
Applied rewrites58.0%
if 0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 59.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.4
Applied rewrites77.4%
Final simplification75.6%
(FPCore (A B C)
:precision binary64
(if (<= B 1e-301)
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) PI))
(if (<= B 6e-17)
(* 180.0 (/ (atan (/ (* B 0.5) A)) PI))
(* 180.0 (/ (atan -1.0) PI)))))
double code(double A, double B, double C) {
double tmp;
if (B <= 1e-301) {
tmp = 180.0 * (atan((1.0 + ((C - A) / B))) / ((double) M_PI));
} else if (B <= 6e-17) {
tmp = 180.0 * (atan(((B * 0.5) / A)) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= 1e-301) {
tmp = 180.0 * (Math.atan((1.0 + ((C - A) / B))) / Math.PI);
} else if (B <= 6e-17) {
tmp = 180.0 * (Math.atan(((B * 0.5) / A)) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= 1e-301: tmp = 180.0 * (math.atan((1.0 + ((C - A) / B))) / math.pi) elif B <= 6e-17: tmp = 180.0 * (math.atan(((B * 0.5) / A)) / math.pi) else: tmp = 180.0 * (math.atan(-1.0) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (B <= 1e-301) tmp = Float64(180.0 * Float64(atan(Float64(1.0 + Float64(Float64(C - A) / B))) / pi)); elseif (B <= 6e-17) tmp = Float64(180.0 * Float64(atan(Float64(Float64(B * 0.5) / A)) / pi)); else tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= 1e-301) tmp = 180.0 * (atan((1.0 + ((C - A) / B))) / pi); elseif (B <= 6e-17) tmp = 180.0 * (atan(((B * 0.5) / A)) / pi); else tmp = 180.0 * (atan(-1.0) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, 1e-301], N[(180.0 * N[(N[ArcTan[N[(1.0 + N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6e-17], N[(180.0 * N[(N[ArcTan[N[(N[(B * 0.5), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 10^{-301}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq 6 \cdot 10^{-17}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B \cdot 0.5}{A}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\end{array}
\end{array}
if B < 1.00000000000000007e-301Initial program 57.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6471.9
Applied rewrites71.9%
if 1.00000000000000007e-301 < B < 6.00000000000000012e-17Initial program 32.8%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6450.7
Applied rewrites50.7%
if 6.00000000000000012e-17 < B Initial program 55.3%
Taylor expanded in B around inf
Applied rewrites69.9%
(FPCore (A B C)
:precision binary64
(if (<= C -6.5e-89)
(/ (* 180.0 (atan (/ (* C 2.0) B))) PI)
(if (<= C 3.4e-141)
(* 180.0 (/ (atan -1.0) PI))
(* (/ 180.0 PI) (atan (/ B (* C -2.0)))))))
double code(double A, double B, double C) {
double tmp;
if (C <= -6.5e-89) {
tmp = (180.0 * atan(((C * 2.0) / B))) / ((double) M_PI);
} else if (C <= 3.4e-141) {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
} else {
tmp = (180.0 / ((double) M_PI)) * atan((B / (C * -2.0)));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= -6.5e-89) {
tmp = (180.0 * Math.atan(((C * 2.0) / B))) / Math.PI;
} else if (C <= 3.4e-141) {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
} else {
tmp = (180.0 / Math.PI) * Math.atan((B / (C * -2.0)));
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= -6.5e-89: tmp = (180.0 * math.atan(((C * 2.0) / B))) / math.pi elif C <= 3.4e-141: tmp = 180.0 * (math.atan(-1.0) / math.pi) else: tmp = (180.0 / math.pi) * math.atan((B / (C * -2.0))) return tmp
function code(A, B, C) tmp = 0.0 if (C <= -6.5e-89) tmp = Float64(Float64(180.0 * atan(Float64(Float64(C * 2.0) / B))) / pi); elseif (C <= 3.4e-141) tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); else tmp = Float64(Float64(180.0 / pi) * atan(Float64(B / Float64(C * -2.0)))); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= -6.5e-89) tmp = (180.0 * atan(((C * 2.0) / B))) / pi; elseif (C <= 3.4e-141) tmp = 180.0 * (atan(-1.0) / pi); else tmp = (180.0 / pi) * atan((B / (C * -2.0))); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, -6.5e-89], N[(N[(180.0 * N[ArcTan[N[(N[(C * 2.0), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], If[LessEqual[C, 3.4e-141], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 / Pi), $MachinePrecision] * N[ArcTan[N[(B / N[(C * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -6.5 \cdot 10^{-89}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C \cdot 2}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 3.4 \cdot 10^{-141}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\pi} \cdot \tan^{-1} \left(\frac{B}{C \cdot -2}\right)\\
\end{array}
\end{array}
if C < -6.50000000000000034e-89Initial program 73.8%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites94.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in C around -inf
*-commutativeN/A
lower-*.f6462.6
Applied rewrites62.6%
if -6.50000000000000034e-89 < C < 3.3999999999999998e-141Initial program 60.5%
Taylor expanded in B around inf
Applied rewrites45.5%
if 3.3999999999999998e-141 < C Initial program 28.2%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6460.1
Applied rewrites60.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6460.4
Applied rewrites60.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6460.2
Applied rewrites60.2%
(FPCore (A B C)
:precision binary64
(if (<= C -6.5e-89)
(* 180.0 (/ (atan (* 2.0 (/ C B))) PI))
(if (<= C 3.4e-141)
(* 180.0 (/ (atan -1.0) PI))
(* (/ 180.0 PI) (atan (/ B (* C -2.0)))))))
double code(double A, double B, double C) {
double tmp;
if (C <= -6.5e-89) {
tmp = 180.0 * (atan((2.0 * (C / B))) / ((double) M_PI));
} else if (C <= 3.4e-141) {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
} else {
tmp = (180.0 / ((double) M_PI)) * atan((B / (C * -2.0)));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= -6.5e-89) {
tmp = 180.0 * (Math.atan((2.0 * (C / B))) / Math.PI);
} else if (C <= 3.4e-141) {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
} else {
tmp = (180.0 / Math.PI) * Math.atan((B / (C * -2.0)));
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= -6.5e-89: tmp = 180.0 * (math.atan((2.0 * (C / B))) / math.pi) elif C <= 3.4e-141: tmp = 180.0 * (math.atan(-1.0) / math.pi) else: tmp = (180.0 / math.pi) * math.atan((B / (C * -2.0))) return tmp
function code(A, B, C) tmp = 0.0 if (C <= -6.5e-89) tmp = Float64(180.0 * Float64(atan(Float64(2.0 * Float64(C / B))) / pi)); elseif (C <= 3.4e-141) tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); else tmp = Float64(Float64(180.0 / pi) * atan(Float64(B / Float64(C * -2.0)))); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= -6.5e-89) tmp = 180.0 * (atan((2.0 * (C / B))) / pi); elseif (C <= 3.4e-141) tmp = 180.0 * (atan(-1.0) / pi); else tmp = (180.0 / pi) * atan((B / (C * -2.0))); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, -6.5e-89], N[(180.0 * N[(N[ArcTan[N[(2.0 * N[(C / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 3.4e-141], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 / Pi), $MachinePrecision] * N[ArcTan[N[(B / N[(C * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -6.5 \cdot 10^{-89}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(2 \cdot \frac{C}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 3.4 \cdot 10^{-141}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\pi} \cdot \tan^{-1} \left(\frac{B}{C \cdot -2}\right)\\
\end{array}
\end{array}
if C < -6.50000000000000034e-89Initial program 73.8%
Taylor expanded in C around -inf
lower-*.f64N/A
lower-/.f6462.6
Applied rewrites62.6%
if -6.50000000000000034e-89 < C < 3.3999999999999998e-141Initial program 60.5%
Taylor expanded in B around inf
Applied rewrites45.5%
if 3.3999999999999998e-141 < C Initial program 28.2%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6460.1
Applied rewrites60.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6460.4
Applied rewrites60.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6460.2
Applied rewrites60.2%
(FPCore (A B C)
:precision binary64
(if (<= C -6.5e-89)
(* 180.0 (/ (atan (* 2.0 (/ C B))) PI))
(if (<= C 3.4e-141)
(* 180.0 (/ (atan -1.0) PI))
(* 180.0 (/ (atan (* B (/ -0.5 C))) PI)))))
double code(double A, double B, double C) {
double tmp;
if (C <= -6.5e-89) {
tmp = 180.0 * (atan((2.0 * (C / B))) / ((double) M_PI));
} else if (C <= 3.4e-141) {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((B * (-0.5 / C))) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= -6.5e-89) {
tmp = 180.0 * (Math.atan((2.0 * (C / B))) / Math.PI);
} else if (C <= 3.4e-141) {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((B * (-0.5 / C))) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= -6.5e-89: tmp = 180.0 * (math.atan((2.0 * (C / B))) / math.pi) elif C <= 3.4e-141: tmp = 180.0 * (math.atan(-1.0) / math.pi) else: tmp = 180.0 * (math.atan((B * (-0.5 / C))) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= -6.5e-89) tmp = Float64(180.0 * Float64(atan(Float64(2.0 * Float64(C / B))) / pi)); elseif (C <= 3.4e-141) tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(B * Float64(-0.5 / C))) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= -6.5e-89) tmp = 180.0 * (atan((2.0 * (C / B))) / pi); elseif (C <= 3.4e-141) tmp = 180.0 * (atan(-1.0) / pi); else tmp = 180.0 * (atan((B * (-0.5 / C))) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, -6.5e-89], N[(180.0 * N[(N[ArcTan[N[(2.0 * N[(C / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 3.4e-141], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -6.5 \cdot 10^{-89}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(2 \cdot \frac{C}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 3.4 \cdot 10^{-141}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\pi}\\
\end{array}
\end{array}
if C < -6.50000000000000034e-89Initial program 73.8%
Taylor expanded in C around -inf
lower-*.f64N/A
lower-/.f6462.6
Applied rewrites62.6%
if -6.50000000000000034e-89 < C < 3.3999999999999998e-141Initial program 60.5%
Taylor expanded in B around inf
Applied rewrites45.5%
if 3.3999999999999998e-141 < C Initial program 28.2%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6460.1
Applied rewrites60.1%
Applied rewrites60.1%
Final simplification56.5%
(FPCore (A B C)
:precision binary64
(if (<= B -1.06e+109)
(* 180.0 (/ (atan 1.0) PI))
(if (<= B -3.3e-153)
(* 180.0 (/ (atan (* 2.0 (/ C B))) PI))
(if (<= B 9.5e-82)
(* 180.0 (/ (atan 0.0) PI))
(* 180.0 (/ (atan -1.0) PI))))))
double code(double A, double B, double C) {
double tmp;
if (B <= -1.06e+109) {
tmp = 180.0 * (atan(1.0) / ((double) M_PI));
} else if (B <= -3.3e-153) {
tmp = 180.0 * (atan((2.0 * (C / B))) / ((double) M_PI));
} else if (B <= 9.5e-82) {
tmp = 180.0 * (atan(0.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= -1.06e+109) {
tmp = 180.0 * (Math.atan(1.0) / Math.PI);
} else if (B <= -3.3e-153) {
tmp = 180.0 * (Math.atan((2.0 * (C / B))) / Math.PI);
} else if (B <= 9.5e-82) {
tmp = 180.0 * (Math.atan(0.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= -1.06e+109: tmp = 180.0 * (math.atan(1.0) / math.pi) elif B <= -3.3e-153: tmp = 180.0 * (math.atan((2.0 * (C / B))) / math.pi) elif B <= 9.5e-82: tmp = 180.0 * (math.atan(0.0) / math.pi) else: tmp = 180.0 * (math.atan(-1.0) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (B <= -1.06e+109) tmp = Float64(180.0 * Float64(atan(1.0) / pi)); elseif (B <= -3.3e-153) tmp = Float64(180.0 * Float64(atan(Float64(2.0 * Float64(C / B))) / pi)); elseif (B <= 9.5e-82) tmp = Float64(180.0 * Float64(atan(0.0) / pi)); else tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= -1.06e+109) tmp = 180.0 * (atan(1.0) / pi); elseif (B <= -3.3e-153) tmp = 180.0 * (atan((2.0 * (C / B))) / pi); elseif (B <= 9.5e-82) tmp = 180.0 * (atan(0.0) / pi); else tmp = 180.0 * (atan(-1.0) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, -1.06e+109], N[(180.0 * N[(N[ArcTan[1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -3.3e-153], N[(180.0 * N[(N[ArcTan[N[(2.0 * N[(C / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 9.5e-82], N[(180.0 * N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.06 \cdot 10^{+109}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\
\mathbf{elif}\;B \leq -3.3 \cdot 10^{-153}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(2 \cdot \frac{C}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq 9.5 \cdot 10^{-82}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\end{array}
\end{array}
if B < -1.0600000000000001e109Initial program 34.3%
Taylor expanded in B around -inf
Applied rewrites71.4%
if -1.0600000000000001e109 < B < -3.29999999999999988e-153Initial program 75.0%
Taylor expanded in C around -inf
lower-*.f64N/A
lower-/.f6442.9
Applied rewrites42.9%
if -3.29999999999999988e-153 < B < 9.4999999999999996e-82Initial program 45.1%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval38.4
Applied rewrites38.4%
if 9.4999999999999996e-82 < B Initial program 54.5%
Taylor expanded in B around inf
Applied rewrites64.0%
(FPCore (A B C)
:precision binary64
(if (<= B -5.4e-154)
(* 180.0 (/ (atan 1.0) PI))
(if (<= B 9.5e-82)
(* 180.0 (/ (atan 0.0) PI))
(* 180.0 (/ (atan -1.0) PI)))))
double code(double A, double B, double C) {
double tmp;
if (B <= -5.4e-154) {
tmp = 180.0 * (atan(1.0) / ((double) M_PI));
} else if (B <= 9.5e-82) {
tmp = 180.0 * (atan(0.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= -5.4e-154) {
tmp = 180.0 * (Math.atan(1.0) / Math.PI);
} else if (B <= 9.5e-82) {
tmp = 180.0 * (Math.atan(0.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= -5.4e-154: tmp = 180.0 * (math.atan(1.0) / math.pi) elif B <= 9.5e-82: tmp = 180.0 * (math.atan(0.0) / math.pi) else: tmp = 180.0 * (math.atan(-1.0) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (B <= -5.4e-154) tmp = Float64(180.0 * Float64(atan(1.0) / pi)); elseif (B <= 9.5e-82) tmp = Float64(180.0 * Float64(atan(0.0) / pi)); else tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= -5.4e-154) tmp = 180.0 * (atan(1.0) / pi); elseif (B <= 9.5e-82) tmp = 180.0 * (atan(0.0) / pi); else tmp = 180.0 * (atan(-1.0) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, -5.4e-154], N[(180.0 * N[(N[ArcTan[1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 9.5e-82], N[(180.0 * N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5.4 \cdot 10^{-154}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\
\mathbf{elif}\;B \leq 9.5 \cdot 10^{-82}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\end{array}
\end{array}
if B < -5.39999999999999979e-154Initial program 56.5%
Taylor expanded in B around -inf
Applied rewrites49.3%
if -5.39999999999999979e-154 < B < 9.4999999999999996e-82Initial program 44.1%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval39.0
Applied rewrites39.0%
if 9.4999999999999996e-82 < B Initial program 54.5%
Taylor expanded in B around inf
Applied rewrites64.0%
(FPCore (A B C) :precision binary64 (if (<= B 9.5e-82) (* 180.0 (/ (atan 0.0) PI)) (* 180.0 (/ (atan -1.0) PI))))
double code(double A, double B, double C) {
double tmp;
if (B <= 9.5e-82) {
tmp = 180.0 * (atan(0.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= 9.5e-82) {
tmp = 180.0 * (Math.atan(0.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= 9.5e-82: tmp = 180.0 * (math.atan(0.0) / math.pi) else: tmp = 180.0 * (math.atan(-1.0) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (B <= 9.5e-82) tmp = Float64(180.0 * Float64(atan(0.0) / pi)); else tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= 9.5e-82) tmp = 180.0 * (atan(0.0) / pi); else tmp = 180.0 * (atan(-1.0) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, 9.5e-82], N[(180.0 * N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 9.5 \cdot 10^{-82}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\end{array}
\end{array}
if B < 9.4999999999999996e-82Initial program 51.9%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval18.1
Applied rewrites18.1%
if 9.4999999999999996e-82 < B Initial program 54.5%
Taylor expanded in B around inf
Applied rewrites64.0%
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan -1.0) PI)))
double code(double A, double B, double C) {
return 180.0 * (atan(-1.0) / ((double) M_PI));
}
public static double code(double A, double B, double C) {
return 180.0 * (Math.atan(-1.0) / Math.PI);
}
def code(A, B, C): return 180.0 * (math.atan(-1.0) / math.pi)
function code(A, B, C) return Float64(180.0 * Float64(atan(-1.0) / pi)) end
function tmp = code(A, B, C) tmp = 180.0 * (atan(-1.0) / pi); end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} -1}{\pi}
\end{array}
Initial program 52.9%
Taylor expanded in B around inf
Applied rewrites25.6%
herbie shell --seed 2024232
(FPCore (A B C)
:name "ABCF->ab-angle angle"
:precision binary64
(* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) PI)))