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