|
From: | David Ayers |
Subject: | Re: RFA/PATCH gtest - NSNumber float != double |
Date: | Tue, 21 Jan 2003 23:04:33 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212 |
Alexander Malmberg wrote:
Hmm, I'll take your word for it. I just recalled back in the dark ages someone told me (or I read it somewhere) that 25.1 would somehow be represented as 2.51 * 10^1 and that a float or double only stored the mantissa and exponent which shouldn't result in any discrepancies here. But maybe that was just some illustration of principle. (I wonder how Apple deals with this... I'll check tomorrow.)David Ayers wrote:Hello everyone, I'm working on a set of GDL2 guile tests and ran into a base issue. +numberWithFloat: 25.1 and +numberWithDouble: 25.1 are not equal. I've attached an patch for gtest on this issue which also updates some other changes in the general configuration.This is expected. 25.1 can not be represented exactly as a floating point number. When you create a float 25.1, you get the float-number closest to 25.1, and when you create a double 25.1, you get the double-number closest to 25.1. These usually aren't the same, so the comparison is correct.
Thanx, Dave
[Prev in Thread] | Current Thread | [Next in Thread] |