在iOS 4.3 Simulator上,以下代码返回一个非常小的数字:GCC 4.2上的1e-700
,但在LLVM-GCC 4.2上按预期工作。有任何想法吗?- [NSDate timeIntervalSinceDate:]在GCC 4.2上返回非常小的数字,但在iOS4.3上的LLVM-GCC 4.2上按预期工作。模拟器
NSDate *selectedDate = self.datepicker.date; // guaranteed to be before now
NSTimeInterval interval = [nowDate timeIntervalSinceDate:selectedDate];
这些值与每个运行的变化,但在这里是设定输出的一个例子
selectedDate:1981-06-02 16:27:34 +0000
nowDate:2011-08-03 05:18:36 +0000
间隔:5.489011535689859e-277
运行[nowDate timeIntervalSinceDate:selectedDate]
在GDB:952001462.97236204
(这是我的预期值)
你是如何确定'interval'在GCC 4.2上包含1e-700的? –
我使用以下命令在GDB中打印它: p(NSTimeInterval)间隔 –
当您正在进行此测试时,您可以显示selectedDate和nowDate的值吗? –