
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (- (* (* 4.0 A) C) (pow B_m 2.0)))
(t_2 (* F t_0))
(t_3
(/
(sqrt
(*
(* 2.0 (* F t_1))
(- (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))) (+ A C))))
t_1))
(t_4 (- t_0)))
(if (<= t_3 (- INFINITY))
(*
(sqrt 2.0)
(-
(sqrt
(*
F
(/
(- A (- (hypot B_m (- A C)) C))
(fma -4.0 (* A C) (pow B_m 2.0)))))))
(if (<= t_3 -1e-170)
(/ (sqrt (* t_2 (* 2.0 (- A (hypot B_m A))))) t_4)
(if (<= t_3 INFINITY)
(/
(sqrt (* t_2 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_4)
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = ((4.0 * A) * C) - pow(B_m, 2.0);
double t_2 = F * t_0;
double t_3 = sqrt(((2.0 * (F * t_1)) * (sqrt((pow(B_m, 2.0) + pow((A - C), 2.0))) - (A + C)))) / t_1;
double t_4 = -t_0;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = sqrt(2.0) * -sqrt((F * ((A - (hypot(B_m, (A - C)) - C)) / fma(-4.0, (A * C), pow(B_m, 2.0)))));
} else if (t_3 <= -1e-170) {
tmp = sqrt((t_2 * (2.0 * (A - hypot(B_m, A))))) / t_4;
} else if (t_3 <= ((double) INFINITY)) {
tmp = sqrt((t_2 * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / t_4;
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0)) t_2 = Float64(F * t_0) t_3 = Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))) - Float64(A + C)))) / t_1) t_4 = Float64(-t_0) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(A - Float64(hypot(B_m, Float64(A - C)) - C)) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); elseif (t_3 <= -1e-170) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A - hypot(B_m, A))))) / t_4); elseif (t_3 <= Inf) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_4); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$4 = (-t$95$0)}, If[LessEqual[t$95$3, (-Infinity)], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(A - N[(N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$3, -1e-170], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$4), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C - {B\_m}^{2}\\
t_2 := F \cdot t\_0\\
t_3 := \frac{\sqrt{\left(2 \cdot \left(F \cdot t\_1\right)\right) \cdot \left(\sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}} - \left(A + C\right)\right)}}{t\_1}\\
t_4 := -t\_0\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{A - \left(\mathsf{hypot}\left(B\_m, A - C\right) - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}}\right)\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-170}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{t\_4}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -inf.0Initial program 3.4%
Taylor expanded in F around 0 16.1%
mul-1-neg16.1%
*-commutative16.1%
associate-/l*34.0%
associate--l+34.0%
unpow234.0%
unpow234.0%
hypot-undefine64.0%
cancel-sign-sub-inv64.0%
Simplified64.0%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -9.99999999999999983e-171Initial program 97.6%
Simplified97.7%
Taylor expanded in C around 0 83.3%
mul-1-neg83.3%
+-commutative83.3%
unpow283.3%
unpow283.3%
hypot-define83.3%
Simplified83.3%
if -9.99999999999999983e-171 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 21.3%
Simplified40.0%
Taylor expanded in C around inf 37.6%
mul-1-neg37.6%
Simplified37.6%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) Initial program 0.0%
Taylor expanded in A around 0 2.0%
mul-1-neg2.0%
unpow22.0%
unpow22.0%
hypot-define19.9%
Simplified19.9%
associate-*l/19.9%
pow1/219.9%
pow1/219.9%
pow-prod-down20.0%
Applied egg-rr20.0%
unpow1/220.0%
Simplified20.0%
Final simplification42.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 1e-174)
(/
(sqrt (* -8.0 (* (* A C) (* F (+ A A)))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 5e+140)
(/ (sqrt (* (* F t_0) (* 2.0 (- A (hypot B_m A))))) (- t_0))
(if (<= (pow B_m 2.0) 4e+296)
(-
(sqrt
(*
(/
(- (+ A C) (hypot B_m (- A C)))
(fma -4.0 (* A C) (pow B_m 2.0)))
(* 2.0 F))))
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 1e-174) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+140) {
tmp = sqrt(((F * t_0) * (2.0 * (A - hypot(B_m, A))))) / -t_0;
} else if (pow(B_m, 2.0) <= 4e+296) {
tmp = -sqrt(((((A + C) - hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0))) * (2.0 * F)));
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-174) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); elseif ((B_m ^ 2.0) <= 5e+140) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A - hypot(B_m, A))))) / Float64(-t_0)); elseif ((B_m ^ 2.0) <= 4e+296) tmp = Float64(-sqrt(Float64(Float64(Float64(Float64(A + C) - hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))) * Float64(2.0 * F)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-174], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+140], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+296], (-N[Sqrt[N[(N[(N[(N[(A + C), $MachinePrecision] - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-174}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+140}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+296}:\\
\;\;\;\;-\sqrt{\frac{\left(A + C\right) - \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)} \cdot \left(2 \cdot F\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1e-174Initial program 16.7%
Simplified26.0%
Taylor expanded in C around inf 23.1%
associate-*r*25.0%
*-commutative25.0%
mul-1-neg25.0%
Simplified25.0%
if 1e-174 < (pow.f64 B #s(literal 2 binary64)) < 5.00000000000000008e140Initial program 41.4%
Simplified54.2%
Taylor expanded in C around 0 33.7%
mul-1-neg33.7%
+-commutative33.7%
unpow233.7%
unpow233.7%
hypot-define37.2%
Simplified37.2%
if 5.00000000000000008e140 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999993e296Initial program 30.3%
Taylor expanded in F around 0 42.5%
mul-1-neg42.5%
*-commutative42.5%
associate-/l*64.4%
associate--l+64.4%
unpow264.4%
unpow264.4%
hypot-undefine79.6%
cancel-sign-sub-inv79.6%
Simplified79.6%
*-commutative79.6%
pow1/279.6%
pow1/279.6%
pow-prod-down80.0%
*-commutative80.0%
associate-+r-80.0%
*-commutative80.0%
Applied egg-rr80.0%
unpow1/280.0%
associate-*l*80.0%
Simplified80.0%
if 3.99999999999999993e296 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.0%
Taylor expanded in A around 0 1.7%
mul-1-neg1.7%
unpow21.7%
unpow21.7%
hypot-define32.4%
Simplified32.4%
associate-*l/32.4%
pow1/232.4%
pow1/232.4%
pow-prod-down32.5%
Applied egg-rr32.5%
unpow1/232.5%
Simplified32.5%
Final simplification38.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))) (t_1 (hypot B_m (- A C))))
(if (<= (pow B_m 2.0) 1e-174)
(/
(sqrt (* -8.0 (* (* A C) (* F (+ A A)))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 5e+140)
(/ (sqrt (* (* F t_0) (* 2.0 (- A (- t_1 C))))) (- t_0))
(if (<= (pow B_m 2.0) 4e+296)
(-
(sqrt
(* (/ (- (+ A C) t_1) (fma -4.0 (* A C) (pow B_m 2.0))) (* 2.0 F))))
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = hypot(B_m, (A - C));
double tmp;
if (pow(B_m, 2.0) <= 1e-174) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+140) {
tmp = sqrt(((F * t_0) * (2.0 * (A - (t_1 - C))))) / -t_0;
} else if (pow(B_m, 2.0) <= 4e+296) {
tmp = -sqrt(((((A + C) - t_1) / fma(-4.0, (A * C), pow(B_m, 2.0))) * (2.0 * F)));
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = hypot(B_m, Float64(A - C)) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-174) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); elseif ((B_m ^ 2.0) <= 5e+140) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A - Float64(t_1 - C))))) / Float64(-t_0)); elseif ((B_m ^ 2.0) <= 4e+296) tmp = Float64(-sqrt(Float64(Float64(Float64(Float64(A + C) - t_1) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))) * Float64(2.0 * F)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-174], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+140], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A - N[(t$95$1 - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+296], (-N[Sqrt[N[(N[(N[(N[(A + C), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \mathsf{hypot}\left(B\_m, A - C\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-174}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+140}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A - \left(t\_1 - C\right)\right)\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+296}:\\
\;\;\;\;-\sqrt{\frac{\left(A + C\right) - t\_1}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)} \cdot \left(2 \cdot F\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1e-174Initial program 16.7%
Simplified26.0%
Taylor expanded in C around inf 23.1%
associate-*r*25.0%
*-commutative25.0%
mul-1-neg25.0%
Simplified25.0%
if 1e-174 < (pow.f64 B #s(literal 2 binary64)) < 5.00000000000000008e140Initial program 41.4%
Simplified54.2%
if 5.00000000000000008e140 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999993e296Initial program 30.3%
Taylor expanded in F around 0 42.5%
mul-1-neg42.5%
*-commutative42.5%
associate-/l*64.4%
associate--l+64.4%
unpow264.4%
unpow264.4%
hypot-undefine79.6%
cancel-sign-sub-inv79.6%
Simplified79.6%
*-commutative79.6%
pow1/279.6%
pow1/279.6%
pow-prod-down80.0%
*-commutative80.0%
associate-+r-80.0%
*-commutative80.0%
Applied egg-rr80.0%
unpow1/280.0%
associate-*l*80.0%
Simplified80.0%
if 3.99999999999999993e296 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.0%
Taylor expanded in A around 0 1.7%
mul-1-neg1.7%
unpow21.7%
unpow21.7%
hypot-define32.4%
Simplified32.4%
associate-*l/32.4%
pow1/232.4%
pow1/232.4%
pow-prod-down32.5%
Applied egg-rr32.5%
unpow1/232.5%
Simplified32.5%
Final simplification41.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= (pow B_m 2.0) 5e-20)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 4e+296)
(-
(sqrt
(*
(/ (- (+ A C) (hypot B_m (- A C))) (fma -4.0 (* A C) (pow B_m 2.0)))
(* 2.0 F))))
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (pow(B_m, 2.0) <= 5e-20) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 4e+296) {
tmp = -sqrt(((((A + C) - hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0))) * (2.0 * F)));
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-20) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 4e+296) tmp = Float64(-sqrt(Float64(Float64(Float64(Float64(A + C) - hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))) * Float64(2.0 * F)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-20], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+296], (-N[Sqrt[N[(N[(N[(N[(A + C), $MachinePrecision] - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+296}:\\
\;\;\;\;-\sqrt{\frac{\left(A + C\right) - \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)} \cdot \left(2 \cdot F\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999999e-20Initial program 20.6%
Taylor expanded in A around -inf 23.2%
if 4.9999999999999999e-20 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999993e296Initial program 39.5%
Taylor expanded in F around 0 44.1%
mul-1-neg44.1%
*-commutative44.1%
associate-/l*57.6%
associate--l+57.6%
unpow257.6%
unpow257.6%
hypot-undefine68.9%
cancel-sign-sub-inv68.9%
Simplified68.9%
*-commutative68.9%
pow1/268.9%
pow1/268.9%
pow-prod-down69.2%
*-commutative69.2%
associate-+r-69.2%
*-commutative69.2%
Applied egg-rr69.2%
unpow1/269.2%
associate-*l*69.2%
Simplified69.2%
if 3.99999999999999993e296 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.0%
Taylor expanded in A around 0 1.7%
mul-1-neg1.7%
unpow21.7%
unpow21.7%
hypot-define32.4%
Simplified32.4%
associate-*l/32.4%
pow1/232.4%
pow1/232.4%
pow-prod-down32.5%
Applied egg-rr32.5%
unpow1/232.5%
Simplified32.5%
Final simplification36.9%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= (pow B_m 2.0) 20000000000.0)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 4e+296)
(* (sqrt (* F (/ (- A (hypot A B_m)) (pow B_m 2.0)))) (- (sqrt 2.0)))
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (pow(B_m, 2.0) <= 20000000000.0) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 4e+296) {
tmp = sqrt((F * ((A - hypot(A, B_m)) / pow(B_m, 2.0)))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (Math.pow(B_m, 2.0) <= 20000000000.0) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 4e+296) {
tmp = Math.sqrt((F * ((A - Math.hypot(A, B_m)) / Math.pow(B_m, 2.0)))) * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt((2.0 * (F * (C - Math.hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C tmp = 0 if math.pow(B_m, 2.0) <= 20000000000.0: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 4e+296: tmp = math.sqrt((F * ((A - math.hypot(A, B_m)) / math.pow(B_m, 2.0)))) * -math.sqrt(2.0) else: tmp = math.sqrt((2.0 * (F * (C - math.hypot(B_m, C))))) / -B_m return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 20000000000.0) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 4e+296) tmp = Float64(sqrt(Float64(F * Float64(Float64(A - hypot(A, B_m)) / (B_m ^ 2.0)))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if ((B_m ^ 2.0) <= 20000000000.0)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 4e+296)
tmp = sqrt((F * ((A - hypot(A, B_m)) / (B_m ^ 2.0)))) * -sqrt(2.0);
else
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 20000000000.0], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+296], N[(N[Sqrt[N[(F * N[(N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 20000000000:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+296}:\\
\;\;\;\;\sqrt{F \cdot \frac{A - \mathsf{hypot}\left(A, B\_m\right)}{{B\_m}^{2}}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2e10Initial program 21.5%
Taylor expanded in A around -inf 22.6%
if 2e10 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999993e296Initial program 38.8%
Taylor expanded in F around 0 43.6%
mul-1-neg43.6%
*-commutative43.6%
associate-/l*58.1%
associate--l+58.1%
unpow258.1%
unpow258.1%
hypot-undefine68.5%
cancel-sign-sub-inv68.5%
Simplified68.5%
Taylor expanded in C around 0 55.6%
unpow255.6%
unpow255.6%
hypot-undefine62.5%
Simplified62.5%
if 3.99999999999999993e296 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.0%
Taylor expanded in A around 0 1.7%
mul-1-neg1.7%
unpow21.7%
unpow21.7%
hypot-define32.4%
Simplified32.4%
associate-*l/32.4%
pow1/232.4%
pow1/232.4%
pow-prod-down32.5%
Applied egg-rr32.5%
unpow1/232.5%
Simplified32.5%
Final simplification34.4%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 5e-17)
(/
(sqrt (* -8.0 (* (* A C) (* F (+ A A)))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 5e+149)
(* (sqrt 2.0) (/ (sqrt (* F (- A (hypot A B_m)))) (- B_m)))
(if (<= (pow B_m 2.0) 5e+284)
(* (sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m))) (- (sqrt 2.0)))
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e-17) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+149) {
tmp = sqrt(2.0) * (sqrt((F * (A - hypot(A, B_m)))) / -B_m);
} else if (pow(B_m, 2.0) <= 5e+284) {
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-17) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); elseif ((B_m ^ 2.0) <= 5e+149) tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(F * Float64(A - hypot(A, B_m)))) / Float64(-B_m))); elseif ((B_m ^ 2.0) <= 5e+284) tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-17], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+149], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+284], N[(N[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+149}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}}{-B\_m}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+284}:\\
\;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999999e-17Initial program 20.4%
Simplified31.5%
Taylor expanded in C around inf 21.9%
associate-*r*24.1%
*-commutative24.1%
mul-1-neg24.1%
Simplified24.1%
if 4.9999999999999999e-17 < (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999999e149Initial program 58.2%
Taylor expanded in F around 0 54.4%
mul-1-neg54.4%
*-commutative54.4%
associate-/l*54.4%
associate--l+54.4%
unpow254.4%
unpow254.4%
hypot-undefine58.9%
cancel-sign-sub-inv58.9%
Simplified58.9%
Taylor expanded in C around 0 28.3%
associate-*l/28.3%
unpow228.3%
unpow228.3%
hypot-undefine28.8%
*-lft-identity28.8%
Simplified28.8%
if 4.9999999999999999e149 < (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999999e284Initial program 28.6%
Taylor expanded in F around 0 39.8%
mul-1-neg39.8%
*-commutative39.8%
associate-/l*62.2%
associate--l+62.2%
unpow262.2%
unpow262.2%
hypot-undefine79.6%
cancel-sign-sub-inv79.6%
Simplified79.6%
Taylor expanded in B around inf 27.3%
if 4.9999999999999999e284 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.1%
Taylor expanded in A around 0 1.7%
mul-1-neg1.7%
unpow21.7%
unpow21.7%
hypot-define31.6%
Simplified31.6%
associate-*l/31.6%
pow1/231.6%
pow1/231.6%
pow-prod-down31.7%
Applied egg-rr31.7%
unpow1/231.7%
Simplified31.7%
Final simplification27.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= (pow B_m 2.0) 20000000000.0)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(* (sqrt 2.0) (/ (sqrt (* F (- A (hypot A B_m)))) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (pow(B_m, 2.0) <= 20000000000.0) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = sqrt(2.0) * (sqrt((F * (A - hypot(A, B_m)))) / -B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (Math.pow(B_m, 2.0) <= 20000000000.0) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt((F * (A - Math.hypot(A, B_m)))) / -B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C tmp = 0 if math.pow(B_m, 2.0) <= 20000000000.0: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = math.sqrt(2.0) * (math.sqrt((F * (A - math.hypot(A, B_m)))) / -B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 20000000000.0) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(F * Float64(A - hypot(A, B_m)))) / Float64(-B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if ((B_m ^ 2.0) <= 20000000000.0)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
else
tmp = sqrt(2.0) * (sqrt((F * (A - hypot(A, B_m)))) / -B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 20000000000.0], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 20000000000:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2e10Initial program 21.5%
Taylor expanded in A around -inf 22.6%
if 2e10 < (pow.f64 B #s(literal 2 binary64)) Initial program 18.3%
Taylor expanded in F around 0 20.6%
mul-1-neg20.6%
*-commutative20.6%
associate-/l*27.4%
associate--l+27.4%
unpow227.4%
unpow227.4%
hypot-undefine34.9%
cancel-sign-sub-inv34.9%
Simplified34.9%
Taylor expanded in C around 0 12.7%
associate-*l/12.7%
unpow212.7%
unpow212.7%
hypot-undefine32.2%
*-lft-identity32.2%
Simplified32.2%
Final simplification27.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= B_m 3.3e-16)
(* (sqrt (* F (/ -0.5 C))) t_0)
(if (<= B_m 3.2e+76)
(* (sqrt 2.0) (/ (sqrt (* F (- A (hypot A B_m)))) (- B_m)))
(if (<= B_m 1.02e+159)
(* (sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m))) t_0)
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (B_m <= 3.3e-16) {
tmp = sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 3.2e+76) {
tmp = sqrt(2.0) * (sqrt((F * (A - hypot(A, B_m)))) / -B_m);
} else if (B_m <= 1.02e+159) {
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (B_m <= 3.3e-16) {
tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 3.2e+76) {
tmp = Math.sqrt(2.0) * (Math.sqrt((F * (A - Math.hypot(A, B_m)))) / -B_m);
} else if (B_m <= 1.02e+159) {
tmp = Math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
} else {
tmp = Math.sqrt((2.0 * (F * (C - Math.hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if B_m <= 3.3e-16: tmp = math.sqrt((F * (-0.5 / C))) * t_0 elif B_m <= 3.2e+76: tmp = math.sqrt(2.0) * (math.sqrt((F * (A - math.hypot(A, B_m)))) / -B_m) elif B_m <= 1.02e+159: tmp = math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0 else: tmp = math.sqrt((2.0 * (F * (C - math.hypot(B_m, C))))) / -B_m return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (B_m <= 3.3e-16) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0); elseif (B_m <= 3.2e+76) tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(F * Float64(A - hypot(A, B_m)))) / Float64(-B_m))); elseif (B_m <= 1.02e+159) tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
tmp = 0.0;
if (B_m <= 3.3e-16)
tmp = sqrt((F * (-0.5 / C))) * t_0;
elseif (B_m <= 3.2e+76)
tmp = sqrt(2.0) * (sqrt((F * (A - hypot(A, B_m)))) / -B_m);
elseif (B_m <= 1.02e+159)
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
else
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[B$95$m, 3.3e-16], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 3.2e+76], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.02e+159], N[(N[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 3.3 \cdot 10^{-16}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
\mathbf{elif}\;B\_m \leq 3.2 \cdot 10^{+76}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}}{-B\_m}\\
\mathbf{elif}\;B\_m \leq 1.02 \cdot 10^{+159}:\\
\;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 3.29999999999999988e-16Initial program 19.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
associate-/l*21.8%
associate--l+22.1%
unpow222.1%
unpow222.1%
hypot-undefine31.0%
cancel-sign-sub-inv31.0%
Simplified31.0%
Taylor expanded in A around -inf 15.3%
if 3.29999999999999988e-16 < B < 3.19999999999999976e76Initial program 59.3%
Taylor expanded in F around 0 48.0%
mul-1-neg48.0%
*-commutative48.0%
associate-/l*48.0%
associate--l+48.0%
unpow248.0%
unpow248.0%
hypot-undefine49.1%
cancel-sign-sub-inv49.1%
Simplified49.1%
Taylor expanded in C around 0 48.3%
associate-*l/48.4%
unpow248.4%
unpow248.4%
hypot-undefine49.1%
*-lft-identity49.1%
Simplified49.1%
if 3.19999999999999976e76 < B < 1.01999999999999997e159Initial program 28.5%
Taylor expanded in F around 0 47.9%
mul-1-neg47.9%
*-commutative47.9%
associate-/l*54.1%
associate--l+54.1%
unpow254.1%
unpow254.1%
hypot-undefine73.9%
cancel-sign-sub-inv73.9%
Simplified73.9%
Taylor expanded in B around inf 62.9%
if 1.01999999999999997e159 < B Initial program 0.0%
Taylor expanded in A around 0 2.3%
mul-1-neg2.3%
unpow22.3%
unpow22.3%
hypot-define60.5%
Simplified60.5%
associate-*l/60.6%
pow1/260.6%
pow1/260.6%
pow-prod-down60.8%
Applied egg-rr60.8%
unpow1/260.8%
Simplified60.8%
Final simplification26.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= B_m 3.5e-15)
(* (sqrt (* F (/ -0.5 C))) t_0)
(if (<= B_m 1.52e+159)
(* (sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m))) t_0)
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (B_m <= 3.5e-15) {
tmp = sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 1.52e+159) {
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (B_m <= 3.5e-15) {
tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 1.52e+159) {
tmp = Math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
} else {
tmp = Math.sqrt((2.0 * (F * (C - Math.hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if B_m <= 3.5e-15: tmp = math.sqrt((F * (-0.5 / C))) * t_0 elif B_m <= 1.52e+159: tmp = math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0 else: tmp = math.sqrt((2.0 * (F * (C - math.hypot(B_m, C))))) / -B_m return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (B_m <= 3.5e-15) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0); elseif (B_m <= 1.52e+159) tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
tmp = 0.0;
if (B_m <= 3.5e-15)
tmp = sqrt((F * (-0.5 / C))) * t_0;
elseif (B_m <= 1.52e+159)
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
else
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[B$95$m, 3.5e-15], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 1.52e+159], N[(N[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 3.5 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
\mathbf{elif}\;B\_m \leq 1.52 \cdot 10^{+159}:\\
\;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 3.5000000000000001e-15Initial program 19.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
associate-/l*21.8%
associate--l+22.1%
unpow222.1%
unpow222.1%
hypot-undefine31.0%
cancel-sign-sub-inv31.0%
Simplified31.0%
Taylor expanded in A around -inf 15.3%
if 3.5000000000000001e-15 < B < 1.5199999999999999e159Initial program 44.9%
Taylor expanded in F around 0 48.0%
mul-1-neg48.0%
*-commutative48.0%
associate-/l*50.9%
associate--l+50.9%
unpow250.9%
unpow250.9%
hypot-undefine60.7%
cancel-sign-sub-inv60.7%
Simplified60.7%
Taylor expanded in B around inf 47.3%
if 1.5199999999999999e159 < B Initial program 0.0%
Taylor expanded in A around 0 2.3%
mul-1-neg2.3%
unpow22.3%
unpow22.3%
hypot-define60.5%
Simplified60.5%
associate-*l/60.6%
pow1/260.6%
pow1/260.6%
pow-prod-down60.8%
Applied egg-rr60.8%
unpow1/260.8%
Simplified60.8%
Final simplification25.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= B_m 3e-16)
(* (sqrt (* F (/ -0.5 C))) t_0)
(if (<= B_m 8.1e+158)
(* (sqrt (* F (/ -1.0 B_m))) t_0)
(/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (B_m <= 3e-16) {
tmp = sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 8.1e+158) {
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (B_m <= 3e-16) {
tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 8.1e+158) {
tmp = Math.sqrt((F * (-1.0 / B_m))) * t_0;
} else {
tmp = Math.sqrt((2.0 * (F * (C - Math.hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if B_m <= 3e-16: tmp = math.sqrt((F * (-0.5 / C))) * t_0 elif B_m <= 8.1e+158: tmp = math.sqrt((F * (-1.0 / B_m))) * t_0 else: tmp = math.sqrt((2.0 * (F * (C - math.hypot(B_m, C))))) / -B_m return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (B_m <= 3e-16) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0); elseif (B_m <= 8.1e+158) tmp = Float64(sqrt(Float64(F * Float64(-1.0 / B_m))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / Float64(-B_m)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
tmp = 0.0;
if (B_m <= 3e-16)
tmp = sqrt((F * (-0.5 / C))) * t_0;
elseif (B_m <= 8.1e+158)
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
else
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[B$95$m, 3e-16], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 8.1e+158], N[(N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 3 \cdot 10^{-16}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
\mathbf{elif}\;B\_m \leq 8.1 \cdot 10^{+158}:\\
\;\;\;\;\sqrt{F \cdot \frac{-1}{B\_m}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 2.99999999999999994e-16Initial program 19.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
associate-/l*21.8%
associate--l+22.1%
unpow222.1%
unpow222.1%
hypot-undefine31.0%
cancel-sign-sub-inv31.0%
Simplified31.0%
Taylor expanded in A around -inf 15.3%
if 2.99999999999999994e-16 < B < 8.0999999999999998e158Initial program 44.9%
Taylor expanded in F around 0 48.0%
mul-1-neg48.0%
*-commutative48.0%
associate-/l*50.9%
associate--l+50.9%
unpow250.9%
unpow250.9%
hypot-undefine60.7%
cancel-sign-sub-inv60.7%
Simplified60.7%
Taylor expanded in B around inf 45.5%
if 8.0999999999999998e158 < B Initial program 0.0%
Taylor expanded in A around 0 2.3%
mul-1-neg2.3%
unpow22.3%
unpow22.3%
hypot-define60.5%
Simplified60.5%
associate-*l/60.6%
pow1/260.6%
pow1/260.6%
pow-prod-down60.8%
Applied egg-rr60.8%
unpow1/260.8%
Simplified60.8%
Final simplification24.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= B_m 1.2e-15)
(* (sqrt (* F (/ -0.5 C))) t_0)
(if (<= B_m 3.5e+156)
(* (sqrt (* F (/ -1.0 B_m))) t_0)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (B_m <= 1.2e-15) {
tmp = sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 3.5e+156) {
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = -sqrt(2.0d0)
if (b_m <= 1.2d-15) then
tmp = sqrt((f * ((-0.5d0) / c))) * t_0
else if (b_m <= 3.5d+156) then
tmp = sqrt((f * ((-1.0d0) / b_m))) * t_0
else
tmp = (sqrt(2.0d0) / b_m) * -sqrt((f * (a - b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (B_m <= 1.2e-15) {
tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 3.5e+156) {
tmp = Math.sqrt((F * (-1.0 / B_m))) * t_0;
} else {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if B_m <= 1.2e-15: tmp = math.sqrt((F * (-0.5 / C))) * t_0 elif B_m <= 3.5e+156: tmp = math.sqrt((F * (-1.0 / B_m))) * t_0 else: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (B_m <= 1.2e-15) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0); elseif (B_m <= 3.5e+156) tmp = Float64(sqrt(Float64(F * Float64(-1.0 / B_m))) * t_0); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - B_m))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
tmp = 0.0;
if (B_m <= 1.2e-15)
tmp = sqrt((F * (-0.5 / C))) * t_0;
elseif (B_m <= 3.5e+156)
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
else
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[B$95$m, 1.2e-15], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 3.5e+156], N[(N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 1.2 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
\mathbf{elif}\;B\_m \leq 3.5 \cdot 10^{+156}:\\
\;\;\;\;\sqrt{F \cdot \frac{-1}{B\_m}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - B\_m\right)}\right)\\
\end{array}
\end{array}
if B < 1.19999999999999997e-15Initial program 19.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
associate-/l*21.8%
associate--l+22.1%
unpow222.1%
unpow222.1%
hypot-undefine31.0%
cancel-sign-sub-inv31.0%
Simplified31.0%
Taylor expanded in A around -inf 15.3%
if 1.19999999999999997e-15 < B < 3.5000000000000003e156Initial program 44.9%
Taylor expanded in F around 0 48.0%
mul-1-neg48.0%
*-commutative48.0%
associate-/l*50.9%
associate--l+50.9%
unpow250.9%
unpow250.9%
hypot-undefine60.7%
cancel-sign-sub-inv60.7%
Simplified60.7%
Taylor expanded in B around inf 45.5%
if 3.5000000000000003e156 < B Initial program 0.0%
Taylor expanded in C around 0 2.3%
mul-1-neg2.3%
+-commutative2.3%
Simplified2.3%
Taylor expanded in A around 0 62.1%
Final simplification24.9%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= B_m 1.75e-15)
(* (sqrt (* F (/ -0.5 C))) t_0)
(if (<= B_m 3e+159)
(* (sqrt (* F (/ -1.0 B_m))) t_0)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m (- F)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (B_m <= 1.75e-15) {
tmp = sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 3e+159) {
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * -F));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = -sqrt(2.0d0)
if (b_m <= 1.75d-15) then
tmp = sqrt((f * ((-0.5d0) / c))) * t_0
else if (b_m <= 3d+159) then
tmp = sqrt((f * ((-1.0d0) / b_m))) * t_0
else
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * -f))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (B_m <= 1.75e-15) {
tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
} else if (B_m <= 3e+159) {
tmp = Math.sqrt((F * (-1.0 / B_m))) * t_0;
} else {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * -F));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if B_m <= 1.75e-15: tmp = math.sqrt((F * (-0.5 / C))) * t_0 elif B_m <= 3e+159: tmp = math.sqrt((F * (-1.0 / B_m))) * t_0 else: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * -F)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (B_m <= 1.75e-15) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0); elseif (B_m <= 3e+159) tmp = Float64(sqrt(Float64(F * Float64(-1.0 / B_m))) * t_0); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * Float64(-F))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
tmp = 0.0;
if (B_m <= 1.75e-15)
tmp = sqrt((F * (-0.5 / C))) * t_0;
elseif (B_m <= 3e+159)
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
else
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * -F));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[B$95$m, 1.75e-15], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 3e+159], N[(N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * (-F)), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 1.75 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
\mathbf{elif}\;B\_m \leq 3 \cdot 10^{+159}:\\
\;\;\;\;\sqrt{F \cdot \frac{-1}{B\_m}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{B\_m \cdot \left(-F\right)}\right)\\
\end{array}
\end{array}
if B < 1.75e-15Initial program 19.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
associate-/l*21.8%
associate--l+22.1%
unpow222.1%
unpow222.1%
hypot-undefine31.0%
cancel-sign-sub-inv31.0%
Simplified31.0%
Taylor expanded in A around -inf 15.3%
if 1.75e-15 < B < 3.0000000000000002e159Initial program 44.9%
Taylor expanded in F around 0 48.0%
mul-1-neg48.0%
*-commutative48.0%
associate-/l*50.9%
associate--l+50.9%
unpow250.9%
unpow250.9%
hypot-undefine60.7%
cancel-sign-sub-inv60.7%
Simplified60.7%
Taylor expanded in B around inf 45.5%
if 3.0000000000000002e159 < B Initial program 0.0%
Taylor expanded in A around 0 2.3%
mul-1-neg2.3%
unpow22.3%
unpow22.3%
hypot-define60.5%
Simplified60.5%
Taylor expanded in C around 0 60.8%
associate-*r*60.8%
mul-1-neg60.8%
Simplified60.8%
Final simplification24.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= B_m 1.65e-15)
(* (sqrt (* F (/ -0.5 C))) t_0)
(* (sqrt (* F (/ -1.0 B_m))) t_0))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (B_m <= 1.65e-15) {
tmp = sqrt((F * (-0.5 / C))) * t_0;
} else {
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = -sqrt(2.0d0)
if (b_m <= 1.65d-15) then
tmp = sqrt((f * ((-0.5d0) / c))) * t_0
else
tmp = sqrt((f * ((-1.0d0) / b_m))) * t_0
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (B_m <= 1.65e-15) {
tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
} else {
tmp = Math.sqrt((F * (-1.0 / B_m))) * t_0;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if B_m <= 1.65e-15: tmp = math.sqrt((F * (-0.5 / C))) * t_0 else: tmp = math.sqrt((F * (-1.0 / B_m))) * t_0 return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (B_m <= 1.65e-15) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0); else tmp = Float64(sqrt(Float64(F * Float64(-1.0 / B_m))) * t_0); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
tmp = 0.0;
if (B_m <= 1.65e-15)
tmp = sqrt((F * (-0.5 / C))) * t_0;
else
tmp = sqrt((F * (-1.0 / B_m))) * t_0;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[B$95$m, 1.65e-15], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 1.65 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \frac{-1}{B\_m}} \cdot t\_0\\
\end{array}
\end{array}
if B < 1.65e-15Initial program 19.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
associate-/l*21.8%
associate--l+22.1%
unpow222.1%
unpow222.1%
hypot-undefine31.0%
cancel-sign-sub-inv31.0%
Simplified31.0%
Taylor expanded in A around -inf 15.3%
if 1.65e-15 < B Initial program 22.4%
Taylor expanded in F around 0 24.0%
mul-1-neg24.0%
*-commutative24.0%
associate-/l*25.4%
associate--l+25.4%
unpow225.4%
unpow225.4%
hypot-undefine32.8%
cancel-sign-sub-inv32.8%
Simplified32.8%
Taylor expanded in B around inf 44.4%
Final simplification22.6%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (* (sqrt (* F (/ -1.0 B_m))) (- (sqrt 2.0))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((F * (-1.0 / B_m))) * -sqrt(2.0);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((f * ((-1.0d0) / b_m))) * -sqrt(2.0d0)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F * (-1.0 / B_m))) * -Math.sqrt(2.0);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((F * (-1.0 / B_m))) * -math.sqrt(2.0)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(F * Float64(-1.0 / B_m))) * Float64(-sqrt(2.0))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((F * (-1.0 / B_m))) * -sqrt(2.0);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{F \cdot \frac{-1}{B\_m}} \cdot \left(-\sqrt{2}\right)
\end{array}
Initial program 20.0%
Taylor expanded in F around 0 18.7%
mul-1-neg18.7%
*-commutative18.7%
associate-/l*22.7%
associate--l+22.9%
unpow222.9%
unpow222.9%
hypot-undefine31.4%
cancel-sign-sub-inv31.4%
Simplified31.4%
Taylor expanded in B around inf 12.8%
Final simplification12.8%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (* (sqrt (/ F B_m)) (- (sqrt -2.0))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((F / B_m)) * -sqrt(-2.0);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((f / b_m)) * -sqrt((-2.0d0))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F / B_m)) * -Math.sqrt(-2.0);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((F / B_m)) * -math.sqrt(-2.0)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(-2.0))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((F / B_m)) * -sqrt(-2.0);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[-2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{-2}\right)
\end{array}
Initial program 20.0%
Simplified22.9%
Taylor expanded in B around inf 4.6%
Taylor expanded in B around inf 0.0%
mul-1-neg0.0%
Simplified0.0%
Final simplification0.0%
herbie shell --seed 2024071
(FPCore (A B C F)
:name "ABCF->ab-angle b"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))