bugGNU Octave - Bugs: bug #50330, factorial(250) returns InF

 
 

bug #50330: factorial(250) returns InF

Submitted by:  None
Submitted on:  Thu 16 Feb 2017 08:07:48 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Inaccurate Result
Status: InvalidAssigned to: None
Originator Name: Phil ShowersOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.2.0
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 16 Feb 2017 08:37:27 PM UTC, comment #2:

From https://www.mathworks.com/help/matlab/ref/factorial.html

> For single and double, all values larger than the maximum value are returned as Inf


So Octave is behaving correctly. Any factorial(n) where n >= 171 should return Inf.

The OP may be interested in the symbolic package for Octave. Compare:

Mike Miller <mtmiller>
Project Administrator
Thu 16 Feb 2017 08:18:05 PM UTC, comment #1:

Octave is a numerical computing tool. It doesn't do arbitrary precision arithmetic.

The maximum floating point value is somewhere around 10^308, so this value can't be represented exactly.

Are you saying it should be an error instead?

What does Matlab do?

John W. Eaton <jwe>
Project Administrator
Thu 16 Feb 2017 08:07:48 PM UTC, original submission:

rather than 3.23285626 E+492

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 mtmiller (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by None (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 16 Feb 2017 08:37:27 PM UTCmtmillerStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1