Z
Z
Zhenya2020-05-21 22:25:45
C++ / C#
Zhenya, 2020-05-21 22:25:45

Provide C++ examples of floating point calculations when the result is +0 and -0?

The teacher at the university gave the task "to present in C ++ examples of floating point calculations when the result is +0 and -0". After a few hours of watching video lectures, I still didn’t understand what was happening. Is there anyone fumbling around here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Zhilin, 2020-05-21
@dddrew

Divide in a cycle a positive number by 10 and a negative number by 10. Sooner or later, you will get +0 and -0.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question