bugGNU Octave - Bugs: bug #31772, gamma for negative integers values

 
 

bug #31772: gamma for negative integers values

Submitted by:  marco atzeri <matzeri>
Submitted on:  Fri 03 Dec 2010 08:39:10 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating 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 09 Dec 2010 06:21:15 AM UTC, comment #1:

I checked in your changeset with a few additional changes:

http://hg.savannah.gnu.org/hgweb/octave/rev/ef0e995f8c0f

John W. Eaton <jwe>
Project Administrator
Fri 03 Dec 2010 08:39:10 PM UTC, original submission:

gamma(-1) should be Inf as gamma(0).
Matlab provides gamma(-1)=Inf
The same for the other integer negative values.

The test is expecting NaN as on same systems
tgamma(-n)=NaN
as the NaN value is allowed on
http://www.opengroup.org/onlinepubs/009695399/functions/tgamma.html

The test fails on system were tgamma(-1)=Inf

---------------------------------------------

>>>>> processing /pub/hg/octave/src/mappers.cc

***** test
x = [-1, 0, 1, Inf];
v = [NaN, Inf, 1, Inf];
assert (gamma(x), v);
assert (gamma(single (x)), single (v));
!!!!! test failed
assert (gamma (x),v) expected
NaN Inf 1 Inf
but got
Inf Inf 1 Inf
NaNs don't match
-----------------------------------------------

The attached patch provides
gamma(-n)=Inf
for all systems and amends test expectation

Reference
http://en.wikipedia.org/wiki/Gamma_function

discussed:
https://www-old.cae.wisc.edu/pipermail/octave-maintainers/2010-October/017501.html

https://www-old.cae.wisc.edu/pipermail/octave-maintainers/2010-November/017796.html

marco atzeri <matzeri>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #22120:  changeset_gamma.patch added by matzeri (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by matzeri (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 09 Dec 2010 06:21:15 AM UTCjweStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 03 Dec 2010 08:39:10 PM UTCmatzeriAttached File-=>Added changeset_gamma.patch, #22120

    Back to the top


    Powered by Savane 3.1-cleanup1