V
V
Vyacheslav2016-04-12 17:24:32
Programming
Vyacheslav, 2016-04-12 17:24:32

Why do we get zero with a minus sign when we multiply a negative double or float number by zero?

double x = -1;
x *= 0;
System.out.print(x);
Answer: -0.0
float x = -1f;
x *= 0;
System.out.print(x);
Answer: -0.0

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question