
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -4e+82)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 4e-24)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e+82) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 4e-24) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4d+82)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 4d-24) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4e+82) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 4e-24) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e+82: tmp = ((b * 2.0) / a) / -3.0 elif b <= 4e-24: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e+82) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 4e-24) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4e+82) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 4e-24) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e+82], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 4e-24], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+82}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-24}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (/ (+ b (sqrt (* a (* -3.0 c)))) a))))
(if (<= b -5.4e-50)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 3.2e-67)
t_0
(if (<= b 2.9e-31)
(* -0.5 (/ c b))
(if (<= b 1.15e-24) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * ((b + sqrt((a * (-3.0 * c)))) / a);
double tmp;
if (b <= -5.4e-50) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 3.2e-67) {
tmp = t_0;
} else if (b <= 2.9e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 1.15e-24) {
tmp = t_0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = 0.3333333333333333d0 * ((b + sqrt((a * ((-3.0d0) * c)))) / a)
if (b <= (-5.4d-50)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 3.2d-67) then
tmp = t_0
else if (b <= 2.9d-31) then
tmp = (-0.5d0) * (c / b)
else if (b <= 1.15d-24) then
tmp = t_0
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * ((b + Math.sqrt((a * (-3.0 * c)))) / a);
double tmp;
if (b <= -5.4e-50) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 3.2e-67) {
tmp = t_0;
} else if (b <= 2.9e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 1.15e-24) {
tmp = t_0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): t_0 = 0.3333333333333333 * ((b + math.sqrt((a * (-3.0 * c)))) / a) tmp = 0 if b <= -5.4e-50: tmp = ((b * 2.0) / a) / -3.0 elif b <= 3.2e-67: tmp = t_0 elif b <= 2.9e-31: tmp = -0.5 * (c / b) elif b <= 1.15e-24: tmp = t_0 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) t_0 = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(a * Float64(-3.0 * c)))) / a)) tmp = 0.0 if (b <= -5.4e-50) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 3.2e-67) tmp = t_0; elseif (b <= 2.9e-31) tmp = Float64(-0.5 * Float64(c / b)); elseif (b <= 1.15e-24) tmp = t_0; else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = 0.3333333333333333 * ((b + sqrt((a * (-3.0 * c)))) / a); tmp = 0.0; if (b <= -5.4e-50) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 3.2e-67) tmp = t_0; elseif (b <= 2.9e-31) tmp = -0.5 * (c / b); elseif (b <= 1.15e-24) tmp = t_0; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.4e-50], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 3.2e-67], t$95$0, If[LessEqual[b, 2.9e-31], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.15e-24], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(-3 \cdot c\right)}}{a}\\
\mathbf{if}\;b \leq -5.4 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-31}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-24}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-49)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 2.85e-67)
(* 0.3333333333333333 (/ (+ b (sqrt (* a (* -3.0 c)))) a))
(if (<= b 2.6e-31)
(* -0.5 (/ c b))
(if (<= b 3.6e-25)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-49) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 2.85e-67) {
tmp = 0.3333333333333333 * ((b + sqrt((a * (-3.0 * c)))) / a);
} else if (b <= 2.6e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 3.6e-25) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.8d-49)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 2.85d-67) then
tmp = 0.3333333333333333d0 * ((b + sqrt((a * ((-3.0d0) * c)))) / a)
else if (b <= 2.6d-31) then
tmp = (-0.5d0) * (c / b)
else if (b <= 3.6d-25) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-49) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 2.85e-67) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((a * (-3.0 * c)))) / a);
} else if (b <= 2.6e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 3.6e-25) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.8e-49: tmp = ((b * 2.0) / a) / -3.0 elif b <= 2.85e-67: tmp = 0.3333333333333333 * ((b + math.sqrt((a * (-3.0 * c)))) / a) elif b <= 2.6e-31: tmp = -0.5 * (c / b) elif b <= 3.6e-25: tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.8e-49) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 2.85e-67) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(a * Float64(-3.0 * c)))) / a)); elseif (b <= 2.6e-31) tmp = Float64(-0.5 * Float64(c / b)); elseif (b <= 3.6e-25) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.8e-49) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 2.85e-67) tmp = 0.3333333333333333 * ((b + sqrt((a * (-3.0 * c)))) / a); elseif (b <= 2.6e-31) tmp = -0.5 * (c / b); elseif (b <= 3.6e-25) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-49], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 2.85e-67], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.6e-31], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.6e-25], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-49}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 2.85 \cdot 10^{-67}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(-3 \cdot c\right)}}{a}\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{-31}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-25}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -5e-43)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 3.2e-67)
(/ (+ b (sqrt (* a (* -3.0 c)))) (* a 3.0))
(if (<= b 2.2e-31)
(* -0.5 (/ c b))
(if (<= b 6.2e-24)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-43) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 3.2e-67) {
tmp = (b + sqrt((a * (-3.0 * c)))) / (a * 3.0);
} else if (b <= 2.2e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 6.2e-24) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-43)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 3.2d-67) then
tmp = (b + sqrt((a * ((-3.0d0) * c)))) / (a * 3.0d0)
else if (b <= 2.2d-31) then
tmp = (-0.5d0) * (c / b)
else if (b <= 6.2d-24) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-43) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 3.2e-67) {
tmp = (b + Math.sqrt((a * (-3.0 * c)))) / (a * 3.0);
} else if (b <= 2.2e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 6.2e-24) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-43: tmp = ((b * 2.0) / a) / -3.0 elif b <= 3.2e-67: tmp = (b + math.sqrt((a * (-3.0 * c)))) / (a * 3.0) elif b <= 2.2e-31: tmp = -0.5 * (c / b) elif b <= 6.2e-24: tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-43) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 3.2e-67) tmp = Float64(Float64(b + sqrt(Float64(a * Float64(-3.0 * c)))) / Float64(a * 3.0)); elseif (b <= 2.2e-31) tmp = Float64(-0.5 * Float64(c / b)); elseif (b <= 6.2e-24) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-43) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 3.2e-67) tmp = (b + sqrt((a * (-3.0 * c)))) / (a * 3.0); elseif (b <= 2.2e-31) tmp = -0.5 * (c / b); elseif (b <= 6.2e-24) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-43], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 3.2e-67], N[(N[(b + N[Sqrt[N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.2e-31], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-24], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-67}:\\
\;\;\;\;\frac{b + \sqrt{a \cdot \left(-3 \cdot c\right)}}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-31}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-24}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -8e-50)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 2.7e-67)
(/ (- (sqrt (* a (* -3.0 c))) b) (* a 3.0))
(if (<= b 3.1e-31)
(* -0.5 (/ c b))
(if (<= b 3.6e-25)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8e-50) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 2.7e-67) {
tmp = (sqrt((a * (-3.0 * c))) - b) / (a * 3.0);
} else if (b <= 3.1e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 3.6e-25) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-8d-50)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 2.7d-67) then
tmp = (sqrt((a * ((-3.0d0) * c))) - b) / (a * 3.0d0)
else if (b <= 3.1d-31) then
tmp = (-0.5d0) * (c / b)
else if (b <= 3.6d-25) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8e-50) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 2.7e-67) {
tmp = (Math.sqrt((a * (-3.0 * c))) - b) / (a * 3.0);
} else if (b <= 3.1e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 3.6e-25) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8e-50: tmp = ((b * 2.0) / a) / -3.0 elif b <= 2.7e-67: tmp = (math.sqrt((a * (-3.0 * c))) - b) / (a * 3.0) elif b <= 3.1e-31: tmp = -0.5 * (c / b) elif b <= 3.6e-25: tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8e-50) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 2.7e-67) tmp = Float64(Float64(sqrt(Float64(a * Float64(-3.0 * c))) - b) / Float64(a * 3.0)); elseif (b <= 3.1e-31) tmp = Float64(-0.5 * Float64(c / b)); elseif (b <= 3.6e-25) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8e-50) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 2.7e-67) tmp = (sqrt((a * (-3.0 * c))) - b) / (a * 3.0); elseif (b <= 3.1e-31) tmp = -0.5 * (c / b); elseif (b <= 3.6e-25) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8e-50], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 2.7e-67], N[(N[(N[Sqrt[N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.1e-31], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.6e-25], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-3 \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{-31}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-25}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))))
(if (<= b -3.5e-45)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 2.85e-67)
t_0
(if (<= b 2.3e-31)
(* -0.5 (/ c b))
(if (<= b 3.8e-25) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
double t_0 = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
double tmp;
if (b <= -3.5e-45) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 2.85e-67) {
tmp = t_0;
} else if (b <= 2.3e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 3.8e-25) {
tmp = t_0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
if (b <= (-3.5d-45)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 2.85d-67) then
tmp = t_0
else if (b <= 2.3d-31) then
tmp = (-0.5d0) * (c / b)
else if (b <= 3.8d-25) then
tmp = t_0
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
double tmp;
if (b <= -3.5e-45) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 2.85e-67) {
tmp = t_0;
} else if (b <= 2.3e-31) {
tmp = -0.5 * (c / b);
} else if (b <= 3.8e-25) {
tmp = t_0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): t_0 = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) tmp = 0 if b <= -3.5e-45: tmp = ((b * 2.0) / a) / -3.0 elif b <= 2.85e-67: tmp = t_0 elif b <= 2.3e-31: tmp = -0.5 * (c / b) elif b <= 3.8e-25: tmp = t_0 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)) tmp = 0.0 if (b <= -3.5e-45) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 2.85e-67) tmp = t_0; elseif (b <= 2.3e-31) tmp = Float64(-0.5 * Float64(c / b)); elseif (b <= 3.8e-25) tmp = t_0; else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); tmp = 0.0; if (b <= -3.5e-45) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 2.85e-67) tmp = t_0; elseif (b <= 2.3e-31) tmp = -0.5 * (c / b); elseif (b <= 3.8e-25) tmp = t_0; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.5e-45], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 2.85e-67], t$95$0, If[LessEqual[b, 2.3e-31], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-25], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq -3.5 \cdot 10^{-45}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 2.85 \cdot 10^{-67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-31}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (<= b 2.6e-264) (/ (* b -2.0) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.6d-264) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.6e-264: tmp = (b * -2.0) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.6e-264) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.6e-264) tmp = (b * -2.0) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-264], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-264}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (<= b 2.6e-264) (/ (/ (* b 2.0) a) -3.0) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = ((b * 2.0) / a) / -3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.6d-264) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = ((b * 2.0) / a) / -3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.6e-264: tmp = ((b * 2.0) / a) / -3.0 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.6e-264) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.6e-264) tmp = ((b * 2.0) / a) / -3.0; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-264], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-264}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (<= b 2.6e-264) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.6d-264) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.6e-264: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.6e-264) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.6e-264) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-264], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-264}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (<= b 2.6e-264) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.6d-264) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.6e-264: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.6e-264) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.6e-264) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-264], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-264}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (<= b 2.6e-264) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.6d-264) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-264) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.6e-264: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.6e-264) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.6e-264) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-264], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-264}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (* -0.5 (/ c b)))
double code(double a, double b, double c) {
return -0.5 * (c / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.5d0) * (c / b)
end function
public static double code(double a, double b, double c) {
return -0.5 * (c / b);
}
def code(a, b, c): return -0.5 * (c / b)
function code(a, b, c) return Float64(-0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = -0.5 * (c / b); end
code[a_, b_, c_] := N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b}
\end{array}
herbie shell --seed 2023342
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))