
(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 12 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
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.1)
(* (/ (atan t_0) PI) 180.0)
(if (<= t_0 0.0)
(* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
(* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0)))))
double code(double A, double B, double C) {
double t_0 = ((C - A) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))) * (1.0 / B);
double tmp;
if (t_0 <= -0.1) {
tmp = (atan(t_0) / ((double) M_PI)) * 180.0;
} else if (t_0 <= 0.0) {
tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
} else {
tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = ((C - A) - Math.sqrt((Math.pow(B, 2.0) + Math.pow((A - C), 2.0)))) * (1.0 / B);
double tmp;
if (t_0 <= -0.1) {
tmp = (Math.atan(t_0) / Math.PI) * 180.0;
} else if (t_0 <= 0.0) {
tmp = Math.atan((-0.5 * (B / (C - A)))) * (180.0 / Math.PI);
} else {
tmp = (Math.atan((((C - A) / B) + 1.0)) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): t_0 = ((C - A) - math.sqrt((math.pow(B, 2.0) + math.pow((A - C), 2.0)))) * (1.0 / B) tmp = 0 if t_0 <= -0.1: tmp = (math.atan(t_0) / math.pi) * 180.0 elif t_0 <= 0.0: tmp = math.atan((-0.5 * (B / (C - A)))) * (180.0 / math.pi) else: tmp = (math.atan((((C - A) / B) + 1.0)) / math.pi) * 180.0 return tmp
function code(A, B, C) t_0 = Float64(Float64(Float64(C - A) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))) * Float64(1.0 / B)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(Float64(atan(t_0) / pi) * 180.0); elseif (t_0 <= 0.0) tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi)); else tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) t_0 = ((C - A) - sqrt(((B ^ 2.0) + ((A - C) ^ 2.0)))) * (1.0 / B); tmp = 0.0; if (t_0 <= -0.1) tmp = (atan(t_0) / pi) * 180.0; elseif (t_0 <= 0.0) tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / pi); else tmp = (atan((((C - A) / B) + 1.0)) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(N[ArcTan[t$95$0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;\frac{\tan^{-1} t\_0}{\pi} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
\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.10000000000000001Initial program 63.2%
if -0.10000000000000001 < (*.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 14.4%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6414.4
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6414.4
Applied rewrites14.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6456.9
Applied rewrites56.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6499.6
Applied rewrites99.6%
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 60.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.3
Applied rewrites80.3%
Final simplification74.3%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0))
(t_1
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_1 -40000000000000.0)
t_0
(if (<= t_1 -0.5)
(* (/ (atan -1.0) PI) 180.0)
(if (<= t_1 0.0) (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI)) t_0)))))
double code(double A, double B, double C) {
double t_0 = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
double t_1 = ((C - A) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))) * (1.0 / B);
double tmp;
if (t_1 <= -40000000000000.0) {
tmp = t_0;
} else if (t_1 <= -0.5) {
tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
} else if (t_1 <= 0.0) {
tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = (Math.atan((((C - A) / B) + 1.0)) / Math.PI) * 180.0;
double t_1 = ((C - A) - Math.sqrt((Math.pow(B, 2.0) + Math.pow((A - C), 2.0)))) * (1.0 / B);
double tmp;
if (t_1 <= -40000000000000.0) {
tmp = t_0;
} else if (t_1 <= -0.5) {
tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
} else if (t_1 <= 0.0) {
tmp = Math.atan((-0.5 * (B / (C - A)))) * (180.0 / Math.PI);
} else {
tmp = t_0;
}
return tmp;
}
def code(A, B, C): t_0 = (math.atan((((C - A) / B) + 1.0)) / math.pi) * 180.0 t_1 = ((C - A) - math.sqrt((math.pow(B, 2.0) + math.pow((A - C), 2.0)))) * (1.0 / B) tmp = 0 if t_1 <= -40000000000000.0: tmp = t_0 elif t_1 <= -0.5: tmp = (math.atan(-1.0) / math.pi) * 180.0 elif t_1 <= 0.0: tmp = math.atan((-0.5 * (B / (C - A)))) * (180.0 / math.pi) else: tmp = t_0 return tmp
function code(A, B, C) t_0 = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0) t_1 = Float64(Float64(Float64(C - A) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))) * Float64(1.0 / B)) tmp = 0.0 if (t_1 <= -40000000000000.0) tmp = t_0; elseif (t_1 <= -0.5) tmp = Float64(Float64(atan(-1.0) / pi) * 180.0); elseif (t_1 <= 0.0) tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi)); else tmp = t_0; end return tmp end
function tmp_2 = code(A, B, C) t_0 = (atan((((C - A) / B) + 1.0)) / pi) * 180.0; t_1 = ((C - A) - sqrt(((B ^ 2.0) + ((A - C) ^ 2.0)))) * (1.0 / B); tmp = 0.0; if (t_1 <= -40000000000000.0) tmp = t_0; elseif (t_1 <= -0.5) tmp = (atan(-1.0) / pi) * 180.0; elseif (t_1 <= 0.0) tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / pi); else tmp = t_0; end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000000000.0], t$95$0, If[LessEqual[t$95$1, -0.5], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
t_1 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_1 \leq -40000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\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)))))) < -4e13 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 59.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6466.4
Applied rewrites66.4%
if -4e13 < (*.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 100.0%
Taylor expanded in B around inf
Applied rewrites100.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 17.1%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6417.1
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6417.1
Applied rewrites17.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.0
Applied rewrites55.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6455.0
Applied rewrites55.0%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6497.1
Applied rewrites97.1%
Final simplification72.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.1)
(*
(*
(atan (/ (- (- C A) (sqrt (fma (- C A) (- C A) (* B B)))) B))
(/ 1.0 PI))
180.0)
(if (<= t_0 0.0)
(* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
(* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0)))))
double code(double A, double B, double C) {
double t_0 = ((C - A) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))) * (1.0 / B);
double tmp;
if (t_0 <= -0.1) {
tmp = (atan((((C - A) - sqrt(fma((C - A), (C - A), (B * B)))) / B)) * (1.0 / ((double) M_PI))) * 180.0;
} else if (t_0 <= 0.0) {
tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
} else {
tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
}
return tmp;
}
function code(A, B, C) t_0 = Float64(Float64(Float64(C - A) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))) * Float64(1.0 / B)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) - sqrt(fma(Float64(C - A), Float64(C - A), Float64(B * B)))) / B)) * Float64(1.0 / pi)) * 180.0); elseif (t_0 <= 0.0) tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi)); else tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0); end return tmp end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[(C - A), $MachinePrecision] * N[(C - A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;\left(\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\mathsf{fma}\left(C - A, C - A, B \cdot B\right)}}{B}\right) \cdot \frac{1}{\pi}\right) \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
\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.10000000000000001Initial program 63.2%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6463.2
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6463.2
Applied rewrites63.2%
if -0.10000000000000001 < (*.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 14.4%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6414.4
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6414.4
Applied rewrites14.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6456.9
Applied rewrites56.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6499.6
Applied rewrites99.6%
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 60.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.3
Applied rewrites80.3%
Final simplification74.3%
(FPCore (A B C)
:precision binary64
(if (<= A -1.85e-7)
(* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
(if (<= A 9.6e-150)
(* (atan (/ (- C (sqrt (fma B B (* C C)))) B)) (/ 180.0 PI))
(* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0))))
double code(double A, double B, double C) {
double tmp;
if (A <= -1.85e-7) {
tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
} else if (A <= 9.6e-150) {
tmp = atan(((C - sqrt(fma(B, B, (C * C)))) / B)) * (180.0 / ((double) M_PI));
} else {
tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
}
return tmp;
}
function code(A, B, C) tmp = 0.0 if (A <= -1.85e-7) tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi)); elseif (A <= 9.6e-150) tmp = Float64(atan(Float64(Float64(C - sqrt(fma(B, B, Float64(C * C)))) / B)) * Float64(180.0 / pi)); else tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0); end return tmp end
code[A_, B_, C_] := If[LessEqual[A, -1.85e-7], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 9.6e-150], N[(N[ArcTan[N[(N[(C - N[Sqrt[N[(B * B + N[(C * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
\mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\
\;\;\;\;\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right) \cdot \frac{180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if A < -1.85000000000000002e-7Initial program 22.8%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6422.8
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6422.8
Applied rewrites22.8%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.4
Applied rewrites68.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6468.4
Applied rewrites68.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6474.7
Applied rewrites74.7%
if -1.85000000000000002e-7 < A < 9.6e-150Initial program 63.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6461.9
Applied rewrites61.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites61.9%
if 9.6e-150 < A Initial program 70.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6479.1
Applied rewrites79.1%
Final simplification71.8%
(FPCore (A B C)
:precision binary64
(if (<= A -1.85e-7)
(* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
(if (<= A 9.6e-150)
(* (/ (atan (/ (- C (sqrt (fma B B (* C C)))) B)) PI) 180.0)
(* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0))))
double code(double A, double B, double C) {
double tmp;
if (A <= -1.85e-7) {
tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
} else if (A <= 9.6e-150) {
tmp = (atan(((C - sqrt(fma(B, B, (C * C)))) / B)) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
}
return tmp;
}
function code(A, B, C) tmp = 0.0 if (A <= -1.85e-7) tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi)); elseif (A <= 9.6e-150) tmp = Float64(Float64(atan(Float64(Float64(C - sqrt(fma(B, B, Float64(C * C)))) / B)) / pi) * 180.0); else tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0); end return tmp end
code[A_, B_, C_] := If[LessEqual[A, -1.85e-7], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 9.6e-150], N[(N[(N[ArcTan[N[(N[(C - N[Sqrt[N[(B * B + N[(C * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
\mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if A < -1.85000000000000002e-7Initial program 22.8%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6422.8
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6422.8
Applied rewrites22.8%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.4
Applied rewrites68.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6468.4
Applied rewrites68.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6474.7
Applied rewrites74.7%
if -1.85000000000000002e-7 < A < 9.6e-150Initial program 63.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6461.9
Applied rewrites61.9%
if 9.6e-150 < A Initial program 70.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6479.1
Applied rewrites79.1%
Final simplification71.8%
(FPCore (A B C)
:precision binary64
(if (<= A -8.5e-92)
(* (atan (* (/ B A) 0.5)) (/ 180.0 PI))
(if (<= A 2.1e+69)
(* (/ (atan (+ (/ C B) 1.0)) PI) 180.0)
(* (/ (atan (* -2.0 (/ A B))) PI) 180.0))))
double code(double A, double B, double C) {
double tmp;
if (A <= -8.5e-92) {
tmp = atan(((B / A) * 0.5)) * (180.0 / ((double) M_PI));
} else if (A <= 2.1e+69) {
tmp = (atan(((C / B) + 1.0)) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan((-2.0 * (A / B))) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (A <= -8.5e-92) {
tmp = Math.atan(((B / A) * 0.5)) * (180.0 / Math.PI);
} else if (A <= 2.1e+69) {
tmp = (Math.atan(((C / B) + 1.0)) / Math.PI) * 180.0;
} else {
tmp = (Math.atan((-2.0 * (A / B))) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): tmp = 0 if A <= -8.5e-92: tmp = math.atan(((B / A) * 0.5)) * (180.0 / math.pi) elif A <= 2.1e+69: tmp = (math.atan(((C / B) + 1.0)) / math.pi) * 180.0 else: tmp = (math.atan((-2.0 * (A / B))) / math.pi) * 180.0 return tmp
function code(A, B, C) tmp = 0.0 if (A <= -8.5e-92) tmp = Float64(atan(Float64(Float64(B / A) * 0.5)) * Float64(180.0 / pi)); elseif (A <= 2.1e+69) tmp = Float64(Float64(atan(Float64(Float64(C / B) + 1.0)) / pi) * 180.0); else tmp = Float64(Float64(atan(Float64(-2.0 * Float64(A / B))) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (A <= -8.5e-92) tmp = atan(((B / A) * 0.5)) * (180.0 / pi); elseif (A <= 2.1e+69) tmp = (atan(((C / B) + 1.0)) / pi) * 180.0; else tmp = (atan((-2.0 * (A / B))) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[A, -8.5e-92], N[(N[ArcTan[N[(N[(B / A), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 2.1e+69], N[(N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(-2.0 * N[(A / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\
\mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if A < -8.50000000000000067e-92Initial program 27.5%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6427.5
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6427.5
Applied rewrites27.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6460.1
Applied rewrites60.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6460.1
Applied rewrites60.1%
if -8.50000000000000067e-92 < A < 2.10000000000000015e69Initial program 60.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6459.4
Applied rewrites59.4%
Taylor expanded in C around inf
Applied rewrites54.1%
if 2.10000000000000015e69 < A Initial program 86.9%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.1
Applied rewrites85.1%
Final simplification62.8%
(FPCore (A B C)
:precision binary64
(if (<= A -8.5e-92)
(* (/ (atan (* (/ B A) 0.5)) PI) 180.0)
(if (<= A 2.1e+69)
(* (/ (atan (+ (/ C B) 1.0)) PI) 180.0)
(* (/ (atan (* -2.0 (/ A B))) PI) 180.0))))
double code(double A, double B, double C) {
double tmp;
if (A <= -8.5e-92) {
tmp = (atan(((B / A) * 0.5)) / ((double) M_PI)) * 180.0;
} else if (A <= 2.1e+69) {
tmp = (atan(((C / B) + 1.0)) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan((-2.0 * (A / B))) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (A <= -8.5e-92) {
tmp = (Math.atan(((B / A) * 0.5)) / Math.PI) * 180.0;
} else if (A <= 2.1e+69) {
tmp = (Math.atan(((C / B) + 1.0)) / Math.PI) * 180.0;
} else {
tmp = (Math.atan((-2.0 * (A / B))) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): tmp = 0 if A <= -8.5e-92: tmp = (math.atan(((B / A) * 0.5)) / math.pi) * 180.0 elif A <= 2.1e+69: tmp = (math.atan(((C / B) + 1.0)) / math.pi) * 180.0 else: tmp = (math.atan((-2.0 * (A / B))) / math.pi) * 180.0 return tmp
function code(A, B, C) tmp = 0.0 if (A <= -8.5e-92) tmp = Float64(Float64(atan(Float64(Float64(B / A) * 0.5)) / pi) * 180.0); elseif (A <= 2.1e+69) tmp = Float64(Float64(atan(Float64(Float64(C / B) + 1.0)) / pi) * 180.0); else tmp = Float64(Float64(atan(Float64(-2.0 * Float64(A / B))) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (A <= -8.5e-92) tmp = (atan(((B / A) * 0.5)) / pi) * 180.0; elseif (A <= 2.1e+69) tmp = (atan(((C / B) + 1.0)) / pi) * 180.0; else tmp = (atan((-2.0 * (A / B))) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[A, -8.5e-92], N[(N[(N[ArcTan[N[(N[(B / A), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[A, 2.1e+69], N[(N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(-2.0 * N[(A / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\pi} \cdot 180\\
\mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if A < -8.50000000000000067e-92Initial program 27.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6460.0
Applied rewrites60.0%
if -8.50000000000000067e-92 < A < 2.10000000000000015e69Initial program 60.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6459.4
Applied rewrites59.4%
Taylor expanded in C around inf
Applied rewrites54.1%
if 2.10000000000000015e69 < A Initial program 86.9%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.1
Applied rewrites85.1%
Final simplification62.7%
(FPCore (A B C) :precision binary64 (if (<= A -8.5e-92) (* (atan (* (/ B A) 0.5)) (/ 180.0 PI)) (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0)))
double code(double A, double B, double C) {
double tmp;
if (A <= -8.5e-92) {
tmp = atan(((B / A) * 0.5)) * (180.0 / ((double) M_PI));
} else {
tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (A <= -8.5e-92) {
tmp = Math.atan(((B / A) * 0.5)) * (180.0 / Math.PI);
} else {
tmp = (Math.atan((((C - A) / B) + 1.0)) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): tmp = 0 if A <= -8.5e-92: tmp = math.atan(((B / A) * 0.5)) * (180.0 / math.pi) else: tmp = (math.atan((((C - A) / B) + 1.0)) / math.pi) * 180.0 return tmp
function code(A, B, C) tmp = 0.0 if (A <= -8.5e-92) tmp = Float64(atan(Float64(Float64(B / A) * 0.5)) * Float64(180.0 / pi)); else tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (A <= -8.5e-92) tmp = atan(((B / A) * 0.5)) * (180.0 / pi); else tmp = (atan((((C - A) / B) + 1.0)) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[A, -8.5e-92], N[(N[ArcTan[N[(N[(B / A), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if A < -8.50000000000000067e-92Initial program 27.5%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6427.5
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6427.5
Applied rewrites27.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6460.1
Applied rewrites60.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
lower-*.f6460.1
Applied rewrites60.1%
if -8.50000000000000067e-92 < A Initial program 68.7%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6468.9
Applied rewrites68.9%
Final simplification66.3%
(FPCore (A B C) :precision binary64 (if (<= B 7e-9) (* (/ (atan (+ (/ C B) 1.0)) PI) 180.0) (* (/ (atan -1.0) PI) 180.0)))
double code(double A, double B, double C) {
double tmp;
if (B <= 7e-9) {
tmp = (atan(((C / B) + 1.0)) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= 7e-9) {
tmp = (Math.atan(((C / B) + 1.0)) / Math.PI) * 180.0;
} else {
tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= 7e-9: tmp = (math.atan(((C / B) + 1.0)) / math.pi) * 180.0 else: tmp = (math.atan(-1.0) / math.pi) * 180.0 return tmp
function code(A, B, C) tmp = 0.0 if (B <= 7e-9) tmp = Float64(Float64(atan(Float64(Float64(C / B) + 1.0)) / pi) * 180.0); else tmp = Float64(Float64(atan(-1.0) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= 7e-9) tmp = (atan(((C / B) + 1.0)) / pi) * 180.0; else tmp = (atan(-1.0) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, 7e-9], N[(N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 7 \cdot 10^{-9}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
\end{array}
\end{array}
if B < 6.9999999999999998e-9Initial program 61.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6468.7
Applied rewrites68.7%
Taylor expanded in C around inf
Applied rewrites51.9%
if 6.9999999999999998e-9 < B Initial program 43.6%
Taylor expanded in B around inf
Applied rewrites58.8%
Final simplification53.8%
(FPCore (A B C)
:precision binary64
(if (<= B -2.8e-70)
(* (/ (atan 1.0) PI) 180.0)
(if (<= B 1.28e-146)
(* (/ (atan 0.0) PI) 180.0)
(* (/ (atan -1.0) PI) 180.0))))
double code(double A, double B, double C) {
double tmp;
if (B <= -2.8e-70) {
tmp = (atan(1.0) / ((double) M_PI)) * 180.0;
} else if (B <= 1.28e-146) {
tmp = (atan(0.0) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= -2.8e-70) {
tmp = (Math.atan(1.0) / Math.PI) * 180.0;
} else if (B <= 1.28e-146) {
tmp = (Math.atan(0.0) / Math.PI) * 180.0;
} else {
tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= -2.8e-70: tmp = (math.atan(1.0) / math.pi) * 180.0 elif B <= 1.28e-146: tmp = (math.atan(0.0) / math.pi) * 180.0 else: tmp = (math.atan(-1.0) / math.pi) * 180.0 return tmp
function code(A, B, C) tmp = 0.0 if (B <= -2.8e-70) tmp = Float64(Float64(atan(1.0) / pi) * 180.0); elseif (B <= 1.28e-146) tmp = Float64(Float64(atan(0.0) / pi) * 180.0); else tmp = Float64(Float64(atan(-1.0) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= -2.8e-70) tmp = (atan(1.0) / pi) * 180.0; elseif (B <= 1.28e-146) tmp = (atan(0.0) / pi) * 180.0; else tmp = (atan(-1.0) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, -2.8e-70], N[(N[(N[ArcTan[1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[B, 1.28e-146], N[(N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.8 \cdot 10^{-70}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\pi} \cdot 180\\
\mathbf{elif}\;B \leq 1.28 \cdot 10^{-146}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
\end{array}
\end{array}
if B < -2.7999999999999999e-70Initial program 50.7%
Taylor expanded in B around -inf
Applied rewrites56.9%
if -2.7999999999999999e-70 < B < 1.27999999999999992e-146Initial program 62.7%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval28.6
Applied rewrites28.6%
if 1.27999999999999992e-146 < B Initial program 55.7%
Taylor expanded in B around inf
Applied rewrites50.2%
Final simplification44.9%
(FPCore (A B C) :precision binary64 (if (<= B 1.28e-146) (* (/ (atan 0.0) PI) 180.0) (* (/ (atan -1.0) PI) 180.0)))
double code(double A, double B, double C) {
double tmp;
if (B <= 1.28e-146) {
tmp = (atan(0.0) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= 1.28e-146) {
tmp = (Math.atan(0.0) / Math.PI) * 180.0;
} else {
tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= 1.28e-146: tmp = (math.atan(0.0) / math.pi) * 180.0 else: tmp = (math.atan(-1.0) / math.pi) * 180.0 return tmp
function code(A, B, C) tmp = 0.0 if (B <= 1.28e-146) tmp = Float64(Float64(atan(0.0) / pi) * 180.0); else tmp = Float64(Float64(atan(-1.0) / pi) * 180.0); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= 1.28e-146) tmp = (atan(0.0) / pi) * 180.0; else tmp = (atan(-1.0) / pi) * 180.0; end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, 1.28e-146], N[(N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.28 \cdot 10^{-146}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
\end{array}
\end{array}
if B < 1.27999999999999992e-146Initial program 57.2%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval17.1
Applied rewrites17.1%
if 1.27999999999999992e-146 < B Initial program 55.7%
Taylor expanded in B around inf
Applied rewrites50.2%
Final simplification29.9%
(FPCore (A B C) :precision binary64 (* (/ (atan -1.0) PI) 180.0))
double code(double A, double B, double C) {
return (atan(-1.0) / ((double) M_PI)) * 180.0;
}
public static double code(double A, double B, double C) {
return (Math.atan(-1.0) / Math.PI) * 180.0;
}
def code(A, B, C): return (math.atan(-1.0) / math.pi) * 180.0
function code(A, B, C) return Float64(Float64(atan(-1.0) / pi) * 180.0) end
function tmp = code(A, B, C) tmp = (atan(-1.0) / pi) * 180.0; end
code[A_, B_, C_] := N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\tan^{-1} -1}{\pi} \cdot 180
\end{array}
Initial program 56.6%
Taylor expanded in B around inf
Applied rewrites22.1%
Final simplification22.1%
herbie shell --seed 2024235
(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)))