bugGNU Astronomy Utilities - Bugs: bug #62069, Wrong Arithmetic result for same...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62069: Wrong Arithmetic result for same width, but different signs integers

Submitter:  Pedram Ashofteh-Ardakani <pedram>
Submitted:  Thu 17 Feb 2022 12:14:02 AM UTC
   
 
Category:  Arithmetic Severity:  3 - Normal
Item Group:  Output not reasonable Status:  Fixed
Privacy:  Public Assigned to:  makhlaghi
Open/Closed:  Closed

Thu 17 Feb 2022 12:56:50 AM UTC, comment #3: 

Thanks for the wonderful bug report Pedram (and to Zohreh for finding it).

This bug has been fixed in Commit 213a1976c. See the commit message for a full description of the cause and how it has been addressed.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Thu 17 Feb 2022 12:14:02 AM UTC, comment #2: 

This item has been reassigned from the project GNU Astronomy Utilities task tracker to your tracker.

The original report is still available at task #16123

Following are the information included in the original report:

[field #0]                  Item ID: 16123

[field #1]                 Group ID: 11425

[field #2]              Open/Closed: Open

[field #3]                 Severity: 3 - Normal

[field #4]                  Privacy: Public

[field #8]                         : Unknown task Field Display Type

[field #9]                 Category: Arithmetic

[field #10]             Submitted by: pedram

[field #11]              Assigned to: None

[field #12]             Submitted on: Wed 16 Feb 2022 08:11:06 AM UTC

[field #13]                  Summary: masking negative pixels incorrectly for huge values (larger than int16)

[field #14]      Original Submission: # steps to reproduce


$ astarithmetic 200 200 2 makenew 5 mknoise-sigma int16 -o test.fits -q
$ aststatistics test.fits --minimum
-21
$ astarithmetic test.fits set-i i i 65535 gt nan where -q -oout.fits
$ aststatistics out.fits --minimum
0


# workaround


$ astarithmetic 200 200 2 makenew 5 mknoise-sigma int16 -o test.fits -q
$ aststatistics test.fits --minimum
-21
$ astarithmetic test.fits set-i i i 65535 int32 gt nan where -q -oout.fits
$ aststatistics out.fits --minimum
-21


# proposed solution

We should check the minimum of the input image. If it contains negative values, then we should let 'arithmetic' know that '65535' --which it looks like is considered to be an unsigned integer-- should be taken as a 'signed integer'.

# acknowledgement

This problem was first reported by Zohreh Ghaffari.

[field #16]               Item Group: Output not reasonable

[field #17]                   Status: None

[field #18]        Component Version: None

[field #19]         Operating System: None

[field #20]          Reproducibility: None

[field #21]               Size (loc): None

[field #22]            Fixed Release: None

[field #23]          Planned Release: None

[field #24]                   Effort: 0.00

[field #28]                 Priority: 5 - Normal

[field #29]          Should Start On: Wed 16 Feb 2022 12:00:00 AM UTC

[field #30]    Should be Finished on: Wed 16 Feb 2022 12:00:00 AM UTC

[field #31]         Percent Complete: 0%

[field #33]                  Release: None

[field #58]     Custom Select Box #1: None

[field #59]     Custom Select Box #2: None

[field #60]     Custom Select Box #3: None

[field #61]     Custom Select Box #4: None

[field #62]     Custom Select Box #5: None

[field #63]     Custom Select Box #6: None

[field #64]     Custom Select Box #7: None

[field #65]     Custom Select Box #8: None

[field #66]     Custom Select Box #9: None

[field #67]    Custom Select Box #10: None


Mohammad Akhlaghi <makhlaghi>
Group administrator
Wed 16 Feb 2022 09:06:50 AM UTC, comment #1: 
  • Version

0.16.150-8837

Pedram Ashofteh-Ardakani <pedram>
Group Member
Thu 17 Feb 2022 12:14:02 AM UTC, original submission:  

# steps to reproduce


$ astarithmetic 200 200 2 makenew 5 mknoise-sigma int16 -o test.fits -q
$ aststatistics test.fits --minimum
-21
$ astarithmetic test.fits set-i i i 65535 gt nan where -q -oout.fits
$ aststatistics out.fits --minimum
0


# workaround


$ astarithmetic 200 200 2 makenew 5 mknoise-sigma int16 -o test.fits -q
$ aststatistics test.fits --minimum
-21
$ astarithmetic test.fits set-i i i 65535 int32 gt nan where -q -oout.fits
$ aststatistics out.fits --minimum
-21


# proposed solution

We should check the minimum of the input image. If it contains negative values, then we should let 'arithmetic' know that '65535' --which it looks like is considered to be an unsigned integer-- should be taken as a 'signed integer'.

# acknowledgement

This problem was first reported by Zohreh Ghaffari.

Pedram Ashofteh-Ardakani <pedram>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Posted a comment)
  • -email is unavailable- added by pedram (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-17 makhlaghi CategoryNone Arithmetic
        Item GroupNone Output not reasonable
        StatusNone Fixed
        Assigned toNone makhlaghi
        Open/ClosedOpen Closed
        Summarymasking negative pixels incorrectly for huge values (larger than int16) Wrong Arithmetic result for same width, but different signs integers
    2022-02-17 makhlaghi Reassign itemGNU Astronomy Utilities, task #16123 GNU Astronomy Utilities, bug #62069

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code