0
我有一個關於CGRect範圍的問題iOS Objctive-C浮點範圍
我需要在CGRect中保存大量數據。我有一個浮動聲明:
float xLowerValue = ((self.bounds.size.width - lowerHandleWidth) * (_lowerValue - _minimumValue)/(_maximumValue - _minimumValue))+(lowerHandleWidth/2.0f);
它的值是:
2015-05-21 17:10:01.967 ILG-Scouting Munster[5751:184222] self.bounds.size.width = 300;
2015-05-21 17:10:01.967 ILG-Scouting Munster[5751:184222] lowerHandleWidth = 0;
2015-05-21 17:10:01.968 ILG-Scouting Munster[5751:184222] _lowerValue = 100;
2015-05-21 17:10:01.968 ILG-Scouting Munster[5751:184222] _minimumValue = 4.547124e+08;
2015-05-21 17:10:01.968 ILG-Scouting Munster[5751:184222] _maximumValue = 4.547124e+08;
有了這些價值觀,我得到xLowerValue
值等於-Inf
我怎樣才能避免這種情況?
爲了避免這種情況,不要在0處分割。 –