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

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

[Octave-bug-tracker] [bug #63940] `format native-bit` gives wrong result


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #63940] `format native-bit` gives wrong results
Date: Sat, 18 Mar 2023 08:43:27 -0400 (EDT)

Update of bug #63940 (project octave):

                  Status:                    None => Patch Submitted        

    _______________________________________________________

Follow-up Comment #1:

The fix turns out to be very simple:

diff -r 48eaf9df5a5b libinterp/corefcn/pr-output.cc
--- a/libinterp/corefcn/pr-output.cc    Mon Mar 13 14:10:11 2023 -0400
+++ b/libinterp/corefcn/pr-output.cc    Sat Mar 18 08:41:33 2023 -0400
@@ -1452,7 +1452,7 @@ pr_any_float (std::ostream& os, const fl
           if (bit_format > 1)
             {
               for (std::size_t i = 0; i < sizeof (T); i++)
-                PRINT_CHAR_BITS_SWAPPED (os, tmp.i[i]);
+                PRINT_CHAR_BITS (os, tmp.i[i]);
             }
           else
             {


Will wait for confirmation against Matlab.

Incidentally, `format hex` and `format native-hex` do the right thing, but
`native-bit` is not consistent with `native-hex` without this patch.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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