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

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

[Octave-bug-tracker] [bug #64726] Current betainc function has a minor (


From: anonymous
Subject: [Octave-bug-tracker] [bug #64726] Current betainc function has a minor (more cosmetic) bug
Date: Thu, 28 Sep 2023 22:29:26 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?64726>

                 Summary: Current betainc function has a minor (more cosmetic)
bug
                   Group: GNU Octave
               Submitter: None
               Submitted: Fri 29 Sep 2023 02:29:24 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 8.3.0
         Discussion Lock: Any
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 29 Sep 2023 02:29:24 AM UTC By: Anonymous
The betainc function betainc(x,a,b, tail) seems to have a minor cosmetic bug
concerning the aimed parameter input conversion when x is an integer.


## Convert to floating point if necessary
  if (isinteger (x))
    I = double (x);
  endif
  if (isinteger (a))
    a = double (a);
  endif
  if (isinteger (b))
    b = double (b);
  endif

  ## Initialize output array
  I = zeros (size (x), class (x));



The statement I = double(x) does not make much sense as I is overwritten in
all cases a few lines below.



Without spending much time on it:

It appears that the numerical result is still ok. Possible allowed integers (0
<=x <= 1) can only be 0 or 1 and therefore the betainc result is still 0 (when
x=0) or 1 (when x=1).

But moving the initialize section BEFORE the possible conversion and setting x
to double(x) seems a more logical solution, though.


  ## Initialize output array
  I = zeros (size (x), class (x));

  ## Convert to floating point if necessary
  if (isinteger (x))
    x = double (x);
  endif
  if (isinteger (a))
    a = double (a);
  endif
  if (isinteger (b))
    b = double (b);
  endif









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64726>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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