(FPCore (a b c)
:precision binary64
(if (>= b 0.0)
(/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))
↓
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (* 2.0 c) (- (- b) b)))
(t_1 (if (>= b 0.0) t_0 (/ (* b -2.0) (* 2.0 a))))
(t_2 (sqrt (- (* b b) (* c (* 4.0 a)))))
(t_3 (/ (- t_2 b) (* 2.0 a)))
(t_4 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_2)) t_3)))
(if (<= t_4 (- INFINITY))
t_1
(if (<= t_4 -1e-192)
t_4
(if (<= t_4 0.0)
(if (>= b 0.0) t_0 t_3)
(if (<= t_4 5e+222) t_4 t_1))))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c))));
} else {
tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
return tmp;
}
def code(a, b, c):
tmp = 0
if b >= 0.0:
tmp = (2.0 * c) / (-b - math.sqrt(((b * b) - ((4.0 * a) * c))))
else:
tmp = (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
return tmp
↓
def code(a, b, c):
t_0 = (2.0 * c) / (-b - b)
tmp = 0
if b >= 0.0:
tmp = t_0
else:
tmp = (b * -2.0) / (2.0 * a)
t_1 = tmp
t_2 = math.sqrt(((b * b) - (c * (4.0 * a))))
t_3 = (t_2 - b) / (2.0 * a)
tmp_1 = 0
if b >= 0.0:
tmp_1 = (2.0 * c) / (-b - t_2)
else:
tmp_1 = t_3
t_4 = tmp_1
tmp_2 = 0
if t_4 <= -math.inf:
tmp_2 = t_1
elif t_4 <= -1e-192:
tmp_2 = t_4
elif t_4 <= 0.0:
tmp_3 = 0
if b >= 0.0:
tmp_3 = t_0
else:
tmp_3 = t_3
tmp_2 = tmp_3
elif t_4 <= 5e+222:
tmp_2 = t_4
else:
tmp_2 = t_1
return tmp_2
function code(a, b, c)
tmp = 0.0
if (b >= 0.0)
tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))));
else
tmp = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a));
end
return tmp
end
↓
function code(a, b, c)
t_0 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b))
tmp = 0.0
if (b >= 0.0)
tmp = t_0;
else
tmp = Float64(Float64(b * -2.0) / Float64(2.0 * a));
end
t_1 = tmp
t_2 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(4.0 * a))))
t_3 = Float64(Float64(t_2 - b) / Float64(2.0 * a))
tmp_1 = 0.0
if (b >= 0.0)
tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_2));
else
tmp_1 = t_3;
end
t_4 = tmp_1
tmp_2 = 0.0
if (t_4 <= Float64(-Inf))
tmp_2 = t_1;
elseif (t_4 <= -1e-192)
tmp_2 = t_4;
elseif (t_4 <= 0.0)
tmp_3 = 0.0
if (b >= 0.0)
tmp_3 = t_0;
else
tmp_3 = t_3;
end
tmp_2 = tmp_3;
elseif (t_4 <= 5e+222)
tmp_2 = t_4;
else
tmp_2 = t_1;
end
return tmp_2
end
function tmp_2 = code(a, b, c)
tmp = 0.0;
if (b >= 0.0)
tmp = (2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c))));
else
tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
tmp_2 = tmp;
end
↓
function tmp_5 = code(a, b, c)
t_0 = (2.0 * c) / (-b - b);
tmp = 0.0;
if (b >= 0.0)
tmp = t_0;
else
tmp = (b * -2.0) / (2.0 * a);
end
t_1 = tmp;
t_2 = sqrt(((b * b) - (c * (4.0 * a))));
t_3 = (t_2 - b) / (2.0 * a);
tmp_2 = 0.0;
if (b >= 0.0)
tmp_2 = (2.0 * c) / (-b - t_2);
else
tmp_2 = t_3;
end
t_4 = tmp_2;
tmp_3 = 0.0;
if (t_4 <= -Inf)
tmp_3 = t_1;
elseif (t_4 <= -1e-192)
tmp_3 = t_4;
elseif (t_4 <= 0.0)
tmp_4 = 0.0;
if (b >= 0.0)
tmp_4 = t_0;
else
tmp_4 = t_3;
end
tmp_3 = tmp_4;
elseif (t_4 <= 5e+222)
tmp_3 = t_4;
else
tmp_3 = t_1;
end
tmp_5 = tmp_3;
end
if (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -inf.0 or 5.00000000000000023e222 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)))
if -inf.0 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -1.0000000000000001e-192 or -0.0 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < 5.00000000000000023e222
if -1.0000000000000001e-192 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -0.0
herbie shell --seed 2023157
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))