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

 
 

bug #41999: Modulo with big integers result negative values

Submitted by:  None
Submitted on:  Sat 29 Mar 2014 10:06:22 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: TraveninOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.2.4
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project Member
Sat 29 Mar 2014 10:58:32 PM UTC, comment #2:

See also bug #35680.

Mike Miller <mtmiller>
Project Administrator
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>
Project Administrator
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 29 Mar 2014 10:33:00 PM UTCmtmillerStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1