[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #48897] Same value but not equal? (1.235*10^5
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #48897] Same value but not equal? (1.235*10^5 == 123500 -> ans = 0) |
Date: |
Thu, 25 Aug 2016 10:26:36 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7 |
URL:
<http://savannah.gnu.org/bugs/?48897>
Summary: Same value but not equal? (1.235*10^5 == 123500 ->
ans = 0)
Project: GNU Octave
Submitted by: None
Submitted on: Thu Aug 25 10:26:34 2016
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.0.3
Operating System: Mac OS
_______________________________________________________
Details:
Same value but not equal?
I found that octave works wrong with following specific value as follows:
>> x = 1.235*10^5
x = 1.2350e+05
>> y = 123500
y = 123500
>> x == y
ans = 0
Both x and y are double.
I found the difference between x and y after several trials:
>> typecast(x,"int8")
ans =
1 0 0 0 -64 38 -2 64
>> typecast(y, "int8")
ans =
0 0 0 0 -64 38 -2 64
The most significant bit of x is wrong here.
When I converted x to string and then reconverted to number, it turns OK.
>> str2num( num2str( x) ) == y
ans = 1
This is very weird. I hope this problem will be solved.
Thank you.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48897>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #48897] Same value but not equal? (1.235*10^5 == 123500 -> ans = 0),
anonymous <=