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

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

[Octave-bug-tracker] [bug #42583] log2() returns inaccurate result for m


From: Dmitri A. Sergatskov
Subject: [Octave-bug-tracker] [bug #42583] log2() returns inaccurate result for many integer powers of 2, unlike Matlab
Date: Sat, 25 Feb 2023 12:21:11 -0500 (EST)

Follow-up Comment #19, bug #42583 (project octave):

The test 

test libinterp/corefcn/data.cc-tst
***** assert <*42583> (all (log2 (pow2 (-1074:1023)) == -1074:1023))
!!!!! regression: https://octave.org/testfailure/?42583
assert (all (log2 (pow2 (-1074:1023)) == -1074:1023)) failed


is failing on octave 9 (c80cf1588ed0) compiled with 64-bit pointers:


octave:12> log2 (pow2 (-1026:-1020))
ans =

   -Inf   -Inf   -Inf   -Inf  -1022  -1021  -1020

octave:13> pow2 (-1026:-1020)
ans =

   0   0   0   0  2.2e-308  4.5e-308  8.9e-308

octave:14> format bit; pow2 (-1026:-1020)
ans =

 Columns 1 and 2:

  0000000000000000000000000000000000000000000000000000000000000000 
0000000000000000000000000000000000000000000000000000000000000000

 Columns 3 and 4:

  0000000000000000000000000000000000000000000000000000000000000000 
0000000000000000000000000000000000000000000000000000000000000000

 Columns 5 and 6:

  0000000000010000000000000000000000000000000000000000000000000000 
0000000000100000000000000000000000000000000000000000000000000000

 Column 7:

  0000000000110000000000000000000000000000000000000000000000000000



Default compile (same computer, gcc, and compiler flags) passes.


> __octave_config_info__ ("config_opts")
ans =  '--enable-64' '--with-blas=flexiblas64' '--with-qrupdate=qrupdate64'
'--with-suitesparseconfig=suitesparseconfig64' '--with-amd=amd64'
'--with-camd=camd64' '--with-colamd=colamd64' '--with-ccolamd=ccolamd64'
'--with-cholmod=cholmod64' '--with-spqr=spqr64' '--with-cxsparse=cxsparse64'
'--with-umfpack=umfpack64' '--with-klu=klu64' '--with-arpack=arpack64'
'--without-sundials_nvecserial' '--without-sundials_ida'
'--without-sundials_sunlinsolklu' 'CFLAGS=-ggdb3 -O2 -march=native
-mtune=native -mavx -mavx2 -flto=auto' 'CXXFLAGS=-ggdb3 -O2 -march=native
-mtune=native -mavx -mavx2 -flto=auto' 'FFLAGS=-ggdb3 -O2 -march=native
-mtune=native -mavx -mavx2 -flto=auto'
'PKG_CONFIG_PATH=/opt/rh/gcc-toolset-12/root/usr/lib64/pkgconfig'


Tried with both gcc version 11.3.1 20221121 (Red Hat 11.3.1-4) (GCC), and gcc
version 12.2.1 20221121 (Red Hat 12.2.1-7) (GCC).

Dmitri.
-- 



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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