flathub / org.octave.Octave

https://flathub.org/apps/details/org.octave.Octave
17 stars 12 forks source link

NaN mismatch #264

Open dasergatskov opened 1 year ago

dasergatskov commented 1 year ago

There are multiple failures in data.cc-tst due to NaN/Inf mismatch.


>>>>> processing /app/share/octave/7.2.0/etc/tests/libinterp/corefcn/data.cc-tst
***** assert (log2 (complex (0,Inf)), Inf + log2 (i))
!!!!! test failed
ASSERT errors for:  assert (log2 (complex (0, Inf)),Inf + log2 (i))

  Location  |  Observed  |  Expected  |  Reason
     ()         NaN+2i       Inf+2i      'NaN' mismatch
shared variables     xs =

Compressed Column Sparse (rows = 1, cols = 4, nnz = 3 [75%])

  (1, 2) -> 1
  (1, 3) -> 2
  (1, 4) -> 3

***** test
 [f, e] = log2 (complex (zeros (3, 2), [0,-1; 2,-4; Inf,-Inf]));
 assert (f, complex (zeros (3, 2), [0,-0.5; 0.5,-0.5; Inf,-Inf]));
 assert (e(1:2,:), [0,1; 2,3]);
!!!!! test failed
ASSERT errors for:  assert (f,complex (zeros (3, 2), [0, -0.5; 0.5, -0.5; Inf, -Inf]))

  Location  |  Observed  |  Expected  |  Reason
   (3,1)       NaN+NaNi      0+Infi      'NaN' mismatch
   (3,2)       NaN+NaNi      0-Infi      'NaN' mismatch
shared variables     xs =

Compressed Column Sparse (rows = 1, cols = 4, nnz = 3 [75%])

  (1, 2) -> 1
  (1, 3) -> 2
  (1, 4) -> 3

etc... Full log is attached. data_fntests.log.gz

dasergatskov commented 1 year ago

I would guess this is a libc problem. Test code:

cat mylog.cc 
#include <iostream>
#include <cmath>
#include <complex>
#include <limits>

int main ()
{
    double z = std::numeric_limits<double>::infinity();
    std::complex<double> x (0, z);
    std::complex<double> y (0, 0);

    y = std::log(x);
    std::cout << "x = " << x << " log(x) = " << y << std::endl;

    return 0;
}

On native (CentOS 9 gcc version 11.3.1 20221121 (Red Hat 11.3.1-4))

$ g++ mylog.cc 
$ ./a.out 
x = (0,inf) log(x) = (inf,1.5708)
$ ldd ./a.out 
    linux-vdso.so.1 (0x00007ffcb63cf000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007faadb400000)
    libm.so.6 => /lib64/libm.so.6 (0x00007faadb325000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007faadb63b000)
    libc.so.6 => /lib64/libc.so.6 (0x00007faadb000000)
    /lib64/ld-linux-x86-64.so.2 (0x00007faadb677000)

In flatpak:

sh-5.1$ g++ mylog.cc
sh-5.1$ ./a.out
x = (0,inf) log(x) = (-nan,1.5708)
sh-5.1$ ldd ./a.out
        linux-vdso.so.1 (0x00007fff5b389000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff368a00000)
        libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007ff3688b7000)
        libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff368d21000)
        libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007ff3686d7000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff368d58000)
dasergatskov commented 1 year ago

Octave would not build on qt6. Are there updates for 5.15?

I see that 5.15-22.08 is available

dasergatskov commented 1 year ago

I see the same. I guess you can push it as an update anyway, at least it will be using the latest runtime.

dasergatskov commented 1 year ago

I did on KDE
https://invent.kde.org/packaging/flatpak-kde-runtime/-/issues/40#note_634527 and they kick me to freedesktop: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1558 Perhaps you could add comments about reproducibility and such.