import numpy
import math
x = numpy.roots([2,-2,(21 - 21**2)])
print x[0], math.floor(x[0])
The output is:
15.0 14.0
and I expect
15.0 15.0
I don’t expect any reason to have the floor equal to 14.0. Please explain!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve used a function called
fAlmostEqualbefore, based on numpy’s allclose function:Creating a fuzzy floor function based on this:
This prints: