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

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

[Octave-bug-tracker] [bug #65447] jsonencode does not accept integer val


From: Rik
Subject: [Octave-bug-tracker] [bug #65447] jsonencode does not accept integer values larger than 999999
Date: Mon, 11 Mar 2024 18:12:25 -0400 (EDT)

Update of bug #65447 (group octave):

                  Status:                    None => In Progress            
         Planned Release:                    None => 9.1.0 (current stable) 

    _______________________________________________________

Follow-up Comment #1:

Confirmed.  This seems to be an unnecessary limitation within Octave's own
codebase.  The code is


  if (obj.isfloat ())
    {
      double value = obj.scalar_value ();

      // Any numeric input from the interpreter will be in double type so in
      // order to detect ints, we will check if the floor of the input and
the
      // input are equal using fabs (A - B) < epsilon method as it is more
      // accurate.  If value > 999999, MATLAB will encode it in scientific
      // notation (double).
      if (fabs (floor (value) - value) < std::numeric_limits<double>::epsilon
()
          && fabs (value) <= 999999)
        writer.Int64 (value);


I think I can work up a fix for this quickly.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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