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

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

[Octave-bug-tracker] [bug #50808] mod(x, y) function incorrect output


From: anonymous
Subject: [Octave-bug-tracker] [bug #50808] mod(x, y) function incorrect output
Date: Sat, 15 Apr 2017 15:18:17 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?50808>

                 Summary: mod(x,y) function incorrect output
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sat 15 Apr 2017 07:18:15 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Aaron Smith
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.3
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

I created a looping script to calculate moduli of a given number raised to a
power of 2^x, x = 1,2,3 . . . 27.  The script works by squaring the result of
the previous modulus (simple number theory concept for congruences used
extensively in encryption algorithms, which is the purpose of the script).

On the third iteration of the loop, the output is off by exactly -1; the
correct answer should be 28045529.  The full output is pasted below, and the
script is attached as a file.  The one incorrect line throws off all of the
results that follow it.

鳴삶Enter value for a:  75634062
ans =
0:  75634062
1:  29168694
2:  120200318
3:  28045528
4:  92729807
5:  53268345
6:  6307007
7:  9600674
8:  45314227
9:  95406753
10:  37769700
11:  52886129
12:  43762381
13:  55560663
14:  132343522
15:  60348756
16:  104657036
17:  31194620
18:  126806889
19:  154670096
20:  145404120
21:  31329860
22:  154886741
23:  70915184
24:  100595978
25:  64254166
26:  114242786
27:  90586916



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 15 Apr 2017 07:18:15 PM UTC  Name: squaring_script.m  Size: 233B  
By: None

<http://savannah.gnu.org/bugs/download.php?file_id=40413>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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