bugGNU Octave - Bugs: bug #41999, Modulo with big integers result...

 
 

bug #41999: Modulo with big integers result negative values

Submitter:  None
Submitted:  Sat 29 Mar 2014 10:06:22 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Travenin Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.4
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 29 Mar 2014 11:53:06 PM UTC, comment #3: 

What you probably meant to do is:

aa=int64(110008777836610192)
mod(aa,10)

which gives

ans = 2

This is not the case in Matlab.

Michael Godfrey <godfrey>
Group Member
Sat 29 Mar 2014 10:58:32 PM UTC, comment #2: 

See also bug #35680.

Mike Miller <mtmiller>
Group Member
Sat 29 Mar 2014 10:33:00 PM UTC, comment #1: 

Thanks for your bug report. Octave does not perform arbitrary precision calculations. Please understand that numerical values in Octave are double-precision floating point values by default, which limits the range of significant digits that can be represented and computed.

See the Octave FAQ:
http://wiki.octave.org/FAQ#Why_is_this_floating_point_computation_wrong.3F

Mike Miller <mtmiller>
Group Member
Sat 29 Mar 2014 10:06:22 PM UTC, original submission:  

I was doing calculations with big integers when I got

octave:1> mod(110008777836610192, 10)
ans = -16

which is wrong because ans = 2 would be correct.

Then I found out that mod gives wrong answers (0 or negative) with many big integers.

I am just a user and do not have much idea what is the problem.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-29 mtmiller StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code