Comparing double and float values
Matthew Ong
ongbp at yahoo.com
Mon May 16 04:04:21 PDT 2011
On 5/13/2011 3:12 PM, Don wrote:
> std.math.isIdentical().
> I doubt it would ever be appropriate to use this in a financial context,
> it's more for precise testing of math functions.
> Note that, for example, isIdentical(-0.0, +0.0) returns false.
Hi,
Hmm.. That is main reason that I can see that why Java provided that
function. Thanks. I will keep that in mind.
In Java and most C/C++ does not have problem for <,>, for double/float
type comparison. But when it comes to <=,>=,== we need to be very
careful and need to somehow solve that with some sort of raw bits
method. I cannot remember, there is one programming language(old one)
does not have issue when it comes to financial data computation and also
logical comparison. To handle that I have written some API in Java,
looks like I need to port that over also. But let me bounce that off
other to see if there is someone that have solved this before.
--
Matthew Ong
email: ongbp at yahoo.com
More information about the Digitalmars-d
mailing list