octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #40607] mxe-octave: 3.7.7+ test dec2base fails


From: Rik
Subject: [Octave-bug-tracker] [bug #40607] mxe-octave: 3.7.7+ test dec2base fails
Date: Mon, 18 Nov 2013 16:47:01 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0

Follow-up Comment #12, bug #40607 (project octave):

I think I see what is happening, but still no explanation for it.  Using the
test case below:


>> uint64(2)^63-1
ans = 9223372036854775808
>> uint64(2)^63-uint64(1)
ans = 9223372036854775807


In the first case, mixed operations are supposed to coerce the double value
into a uint64 value.  But this must not be happening.  Perhaps there is some
other function signature in the symbol table that is matching the + operator
and getting used instead.

Here is a bit more confirmation:


>> x = uint64(2)^63
ans = 9223372036854775808
>> plus (uint64(1), x)
ans = 9223372036854775809
>> plus (uint64(1), x, 1)
ans = 9223372036854775808
>> plus (uint64(1), x, uint64(1))
ans = 9223372036854775810
>> double (x)
ans =   9.2234e+018
>> format long
>> double (x)
ans =  9223372036854775808
>> ans + 1
ans =  9223372036854775808


Notice that in the three argument call "plus (uint64(1), x, 1)", x is getting
cast to double rather than cast to uint64.  So 1 + double(x) + 1 returns just
x because 1 is well below the machine precision of a double near 2^63.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40607>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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