bugGNU Octave - Bugs: bug #37830, Incorrect results from factor

 
 

bug #37830: Incorrect results from factor

Submitted by:  tmac
Submitted on:  Thu 29 Nov 2012 05:00:09 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 29 Nov 2012 07:41:36 PM UTC, comment #3:

No, qq > 2^52, so it requires more precision than can fit in a double's mantissa. factor works correctly if you use uint64 with the right value in it:

This agrees with Maxima:

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Thu 29 Nov 2012 06:47:48 PM UTC, comment #2:

I think there is still a bug in factor.

octave:8> format long
octave:9> qq=(100000000000000001)
qq = 100000000000000000

% qq is a number that octave can store.

octave:11> factor(qq)
ans =

Columns 1 through 6:

2 3 5 7 13 17

Columns 7 through 12:

19 31 47 59 61 71

Columns 13 through 18:

103 179 251 661 1499 2297

Columns 19 through 24:

2309 4013 12713 20051 65701 252829

Columns 25 through 30:

281081 322249 2071723 3572939 3743297 9920467

Columns 31 and 32:

17985581 216273151

octave:12> prod(ans)
ans = 1.31390166944906e+109
octave:13>

Octave returns an answer that is much much bigger than can be stored.

Doug Stewart

Doug Stewart <dastew>
Thu 29 Nov 2012 05:55:02 PM UTC, comment #1:

Not a bug:

http://wiki.octave.org/FAQ#How_do_I_make_Octave_use_more_precision.3F

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

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Thu 29 Nov 2012 05:00:09 PM UTC, original submission:

The following, from Octave 3.6.2-5 on Debian Sid, is incorrect:

Obviously, 2 should not be a prime factor.

Also, this seems strange to me, using the same number:

For some reason, the last 1 turnes into a 0. Isn't this number well within the range of uint64?

tmac

 

(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 dastew (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by tmac (Submitted the item)
  •  

    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
    Thu 29 Nov 2012 05:55:02 PM UTCjordighStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1