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

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

[Octave-bug-tracker] [bug #64949] jsonencode() not supporting single flo


From: Rik
Subject: [Octave-bug-tracker] [bug #64949] jsonencode() not supporting single floats
Date: Fri, 1 Dec 2023 19:41:11 -0500 (EST)

Update of bug #64949 (project octave):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                 
           Fixed Release:                    None => 10.1.0 (current default)
         Planned Release:                    None => 10.1.0 (current default)

    _______________________________________________________

Follow-up Comment #1:

Thank you for not just reporting a bug, but finding a solution as well.

I made a small change in coding style to use isfloat() as a way to check for
either a double or single input.


+++ b/libinterp/corefcn/jsonencode.cc
@@ -75,7 +75,7 @@ encode_numeric (T& writer, const octave_
   // Possibly write NULL for non-finite values (-Inf, Inf, NaN, NA)
   else if (ConvertInfAndNaN && ! octave::math::isfinite (value))
     writer.Null ();
-  else if (obj.is_double_type ())
+  else if (obj.isfloat ())
     writer.Double (value);
   else
     error ("jsonencode: unsupported type");



I checked this change in on the development branch of Octave here:
http://hg.savannah.gnu.org/hgweb/octave/rev/dc06bb3bf1ed

I filed a separate bug report about the artifacts when encoding values of
class single.  See bug #64960.

Marking this report as Fixed and closing.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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