Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I discover the lowest negative possible CGFloat?

I know of these values:

  • CGFloat.infinity, which is greater than
  • CGFloat.greatestFiniteMagnitude, which is greater than
  • CGFloat.leastNormalMagnitude, which is greater than
  • CGFloat.leastNonzeroMagnitude, which is greater than
  • 0

but it stops there... as far as I can tell. Where are the negative values? I imagine maybe it's as easy as placing a - before them, but then I worry that there might be strange exceptions.

How do I find the key negative numbers in CGFloat? Critically, the lowest negative non-infinite number.

like image 635
Ky. Avatar asked Nov 01 '25 00:11

Ky.


1 Answers

Floating point numbers have a sign bit and negating them changes this sign bit to the opposite value (there is actually a negative zero).

Just put a minus before them. The negation is well defined.

like image 164
Sulthan Avatar answered Nov 04 '25 19:11

Sulthan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!