What is a formula that checks if a number is negative?

63 Views Asked by At

I am working on a project involving different number systems. Right now I am trying to come up with a non-recursive formula about converting a decimal number into the binary equivalent. Right now I have the following problem:

How can I construct a formula that gives 1 if the input number is non-negative (including 0), and 0 if it is negative?

I have come up with a way to do this but it fails when the number I'm checking is exactly 0...

Any help will be appreciated :)