Function return -0

Asked

Viewed 28 times

-1

I created a polynomial class, among the member functions present in my class is the root resolution function. If the degree of the polynomial is 2, I use baskhara for resolution. But I realized that if the root is unique and 0 one of them is 0 and the other - 0. I’ve done this function several times and this is the first time I see something like.

  • 2

    You have to put the code in the question, otherwise we can only try to guess what you actually did.

1 answer

0


Ideally you would have put in an example code. But you’re probably using floating point numbers (float or double) and they have two zeros: +0 and -0. Useful for preserving the signal in boundary cases of type -1.0/10e400.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.