DEV Community

loading...

Discussion on: Daily Challenge #312 - Describe the Function

Collapse
qm3ster profile image
Mihail Malo

there's only

  • x + 0 == x - 0 (== x)
  • x * 1 == x / 1 (== x)

  • 2 + 2 == 2 * 2

  • 4 - 2 == 4 / 2 (reverse)

Right? What did you mean with

one of these numbers is 0

Collapse
bugb profile image
bugb

You are correct, I mean:

±n / 0 == ±∞
0 * 0 == 0 + 0 == 0 - 0
Enter fullscreen mode Exit fullscreen mode
Thread Thread
qm3ster profile image
Mihail Malo

If we're talking IEEE754-like floats, there's also NaN :v

  • NaN + a == NaN - b == NaN * c == NaN / d == NaN % e == f + NaN == g - NaN == h * NaN == i / NaN == j % NaN (== NaN)
  • inf + a == inf - b == inf * c == inf / d == f + inf == h * inf (== inf)
  • -inf + a == -inf - b == -inf * c == -inf / d == f + -inf == h * -inf (== -inf)
  • inf - inf == inf / inf (== NaN)