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

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

[Octave-bug-tracker] [bug #44917] is_real_scalar returns false for integ


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #44917] is_real_scalar returns false for integers
Date: Fri, 24 Apr 2015 11:43:03 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.6.0

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

                 Summary: is_real_scalar returns false for integers
                 Project: GNU Octave
            Submitted by: carandraug
            Submitted on: Fri 24 Apr 2015 11:43:01 AM GMT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I found this bug while working on bug #44882 . Basically, the is_real_scalar
method returns false for integer scalars although both is_scalar_type and
is_real_type return true.

Code to test:


#include <octave/oct.h>

DEFUN_DLD (test_real_scalar, args, , "")
{
  octave_value val = args(0);

  std::cout << "numel is " << val.numel () << "\n";
  if (val.is_scalar_type ())
    std::cout << "scalar type" << "\n";
  if (val.is_real_type ())
    std::cout << "real type" << "\n";
  if (val.is_real_scalar ())
    std::cout << "real scalar" << "\n";
  if (val.is_integer_type ())
    std::cout << "integer type" << "\n";

  return octave_value_list ();
}



Octave session showing the issue:


octave> test_real_scalar (5)
numel is 1
scalar type
real type
real scalar
octave> test_real_scalar (single (5))
numel is 1
scalar type
real type
real scalar
octave> test_real_scalar (uint8 (5))
numel is 1
scalar type
real type
integer type
octave> test_real_scalar (uint32 (5))
numel is 1
scalar type
real type
integer type






    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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