gnuastro-devel
[Top][All Lists]
Advanced

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

[bug #61940] Numbers with many decimals incorrectly been read as float32


From: Mohammad Akhlaghi
Subject: [bug #61940] Numbers with many decimals incorrectly been read as float32
Date: Wed, 26 Jan 2022 18:11:39 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?61940>

                 Summary: Numbers with many decimals incorrectly been read as
float32
                 Project: GNU Astronomy Utilities
            Submitted by: makhlaghi
            Submitted on: Wed 26 Jan 2022 11:11:37 PM UTC
                Category: Libraries
                Severity: 3 - Normal
              Item Group: Output not reasonable
                  Status: In Progress
                 Privacy: Public
             Assigned to: makhlaghi
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

When a many-digit "small" number (like '330624.3918430004') is given to
'gal_type_string_to_number', it is mistakenly read as a 32-bit float number,
not 64-bit. 

This causes problems like the example below (when reading FITS keywords that
have values in a similar format). This 'img.fits' can be any of the images
that is initially downloaded in the general tutorial
<https://www.gnu.org/software/gnuastro/manual/html_node/Setup-and-data-download.html>:


$ astfits img.fits -h0 --keyvalue=TEXPTIME
img.fits 330624        

$ astfits img.fits -h0 | grep TEXPTIME
TEXPTIME=    330624.3918430004


As you see, while the value is '330624.3918430004', the Fits program only
prints the first 6 characters! The root cause of this problem is that
'gal_type_string_to_number' is wrongly identifying this as a 32-bit floating
point number.

This bug was first reported by Zohre Ghaffari and Pedram Ashofteh Ardakani
helped in finding the solution.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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