I'm trying to write a conversion function that takes a float and returns an int, which basically does a saturated conversion. If the it's greater than int.MaxValue then int.MaxValue should be returned, likewise for int.MinValue.
I'd rather not catch exceptions as part of my normal flow control and instead just explicitly check the bounds except I'm not sure what the upper bound is as the largest float that can be stored in a int is smaller than int.MaxValue as a float has less precision than an int for values that size.
Basically I'm looking for the ... in:
float largestFloatThatCanBeStoredInAnInt = ...