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

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

[Octave-bug-tracker] [bug #60497] Unable to pass int64 values to oct int


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #60497] Unable to pass int64 values to oct interface reliably
Date: Sun, 2 May 2021 09:41:59 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

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

                 Summary: Unable to pass int64 values to oct interface
reliably
                 Project: GNU Octave
            Submitted by: pantxo
            Submitted on: dim. 02 mai 2021 13:41:57 UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Consider the following oct file that just tries to parse an int64 argument and
show it value:


DEFUN_DLD(show_int64, args, nargout,
          "-*- texinfo -*-\n\
@deftypefn {} {@var{out} =} ping_int64 (@var{in})\n\
@seealso{}\n\
@end deftypefn")
{
  int nargin = args.length ();

  if (nargin != 1)
    print_usage ();

  int64_t out = args(0).xint64_value ("IN should be a scalar int64 val");

  octave_stdout << out << std::endl;
  
  return ovl ();
}


Here is what I obtain when using this function:

octave:1> a = intmax ("int64")
a = 9223372036854775807
octave:2> show_int64 (a)
-9223372036854775808


See related discussion on the discourse forum:

https://octave.discourse.group/t/how-to-safely-use-int64-type/1096



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: dim. 02 mai 2021 13:41:57 UTC  Name: show_int64.cc  Size: 1kio   By:
pantxo

<http://savannah.gnu.org/bugs/download.php?file_id=51356>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/




reply via email to

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