Consider layout code like this:
CGFloat descriptionHeight = // height of a paragraph of text with zero or more words;
CGFloat imageHeight = // h
There is never any "data loss" incurred when converting a float
into a double
. That conversion is always exact.
Your solutions 1 & 2 are entirely equivalent semantically, though (2) is more stylistically correct.
Your solution 3 is formally not equivalent; it may incur extra conversions between float and double, which may make it slightly less efficient (but the actual result is identical).
Basically, it doesn't matter, but use tgmath
.