octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yet another Java oddity


From: CdeMills
Subject: Re: yet another Java oddity
Date: Thu, 7 Feb 2013 00:14:04 -0800 (PST)

Mike Miller-2 wrote
> I have recently discovered that std::pow can behave slightly
> differently when the JVM is loaded into Octave on 32-bit Linux
> (reproduced on RHEL, Fedora, and Debian). I have not yet seen any
> differences on a 64-bit system.
> 
> The result is behavior like this:
> 
> octave:1> 1e-5 == 10^-5
> ans =  1
> octave:2> javaObject ("java.lang.String");
> octave:3> 1e-5 == 10^-5
> ans = 0

This is not the right approach. "1e-5", as represented in IEEE
double-precision arithmetic, is not a finite number, so it get somewhat
truncated. The way this truncation is performed is out of reach. The correct
test is abs(1e-5 - 10^-5) <= eps

Same thing for the other one: 2.72 is of finite length in base 10, but not
in base 2.

Regards

Pascal




--
View this message in context: 
http://octave.1599824.n4.nabble.com/yet-another-Java-oddity-tp4649593p4649600.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]