(FPCore (a b c)
:precision binary64
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
↓
(FPCore (a b c)
:precision binary64
(if (<= b -8.5e-101)
(/ (- c) b)
(if (<= b 8.8e+78)
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* c a))))) (* a 2.0))
(/ (- b) a))))
double code(double a, double b, double c) {
return (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
↓
double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e-101) {
tmp = -c / b;
} else if (b <= 8.8e+78) {
tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
} else {
tmp = -b / a;
}
return tmp;
}
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) - (4.0d0 * (a * c))))) / (2.0d0 * a)
end function
↓
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 <= (-8.5d-101)) then
tmp = -c / b
else if (b <= 8.8d+78) then
tmp = (-b - sqrt(((b * b) - (4.0d0 * (c * a))))) / (a * 2.0d0)
else
tmp = -b / a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
return (-b - Math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
↓
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e-101) {
tmp = -c / b;
} else if (b <= 8.8e+78) {
tmp = (-b - Math.sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
} else {
tmp = -b / a;
}
return tmp;
}
def code(a, b, c):
return (-b - math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a)
↓
def code(a, b, c):
tmp = 0
if b <= -8.5e-101:
tmp = -c / b
elif b <= 8.8e+78:
tmp = (-b - math.sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0)
else:
tmp = -b / a
return tmp
function code(a, b, c)
return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))) / Float64(2.0 * a))
end
↓
function code(a, b, c)
tmp = 0.0
if (b <= -8.5e-101)
tmp = Float64(Float64(-c) / b);
elseif (b <= 8.8e+78)
tmp = Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(c * a))))) / Float64(a * 2.0));
else
tmp = Float64(Float64(-b) / a);
end
return tmp
end
function tmp = code(a, b, c)
tmp = (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
end
↓
function tmp_2 = code(a, b, c)
tmp = 0.0;
if (b <= -8.5e-101)
tmp = -c / b;
elseif (b <= 8.8e+78)
tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
else
tmp = -b / a;
end
tmp_2 = tmp;
end
(*.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4))))) (/.f64 -1/2 a)): 0 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 4))))))) (/.f64 -1/2 a)): 0 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a c) (neg.f64 4)))))) (/.f64 -1/2 a)): 1 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 a c) 4)))))) (/.f64 -1/2 a)): 0 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 (*.f64 a c))))))) (/.f64 -1/2 a)): 0 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c)))))) (/.f64 -1/2 a)): 0 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))) (/.f64 (Rewrite<= metadata-eval (/.f64 -1 2)) a)): 0 points increase in error, 0 points decrease in error
(*.f64 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))) (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 2 a)))): 0 points increase in error, 0 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))) -1) (*.f64 2 a))): 9 points increase in error, 27 points decrease in error
(/.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))) (*.f64 2 a)): 0 points increase in error, 0 points decrease in error
(/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))) (*.f64 2 a)): 0 points increase in error, 0 points decrease in error
(/.f64 (Rewrite<= distribute-neg-out_binary64 (+.f64 (neg.f64 b) (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))) (*.f64 2 a)): 0 points increase in error, 0 points decrease in error
(/.f64 (Rewrite<= sub-neg_binary64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c)))))) (*.f64 2 a)): 0 points increase in error, 0 points decrease in error
herbie shell --seed 2022291
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-target
(if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))