taskGNU Astronomy Utilities - Tasks: task #16114, Print warning where integer...


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

task #16114: Print warning where integer overflow happens

Submitter:  Pedram Ashofteh-Ardakani <pedram>
Submitted:  Tue 01 Feb 2022 10:31:18 AM UTC
Should Start On:  Tue 01 Feb 2022 12:00:00 AM UTC Should be Finished on:  Tue 01 Feb 2022 12:00:00 AM UTC
Category:  Arithmetic Priority:  5 - Normal
Item Group:  Enhancement Status:  None
Privacy:  Public Percent Complete:  0%
Assigned to:  None Open/Closed:  Open
Effort:  0.00

Sun 29 Jan 2023 12:44:22 PM UTC, comment #4: 

This task is open for anyone who is interested.

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Sun 22 May 2022 01:07:55 PM UTC, comment #3: 

Have you made any progress on this Tushar?

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Fri 11 Mar 2022 10:20:37 AM UTC, comment #2: 

This is a good bug you chose Tashar! Its all yours ;-).

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Fri 11 Mar 2022 08:05:32 AM UTC, comment #1: 

I went to this error and want to fix it . Could you please assign this task to me.
Thank you

Tushar Gupta <tushar_gupta>
Project Member
Tue 01 Feb 2022 10:31:18 AM UTC, original submission:  

As explained in bug #61969 , arithmetic reads inputs and uses the smallest numerical data type possible to compute more efficiently with the least amount of memory. However, the user might not be aware of the integer overflow that might happen when calculations result in values that need larger storage types. For example:

$ astarithmetic 254 2 +

This happens because 254 and 2 are both of type uint8 that can store a maximum value of 255, so instead of getting the expected result 256, we'd get 0 as the result of an integer overflow. One way to work around this for now is to use floating points in the inputs, for instance:

$ astarithmetic 254.0 2 +

Since this is happening silently, we need to at least print a warning to notify the user of the circumstances. So this task is defined here as Mohammad pointed out in bug #61969:

> C library's 'errno.h' has a special error code for such range overflows: 'ERANGE'. We should add a check for this error code within arithmetic and if it happens, a warning should be printed that an overflow has happened (to standard-error; so its even printed with '--quiet'!).

Pedram Ashofteh-Ardakani <pedram>
Project 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 tushar_gupta (Posted a comment)
  • -email is unavailable- added by pedram (Submitted the item)
  • -email is unavailable- added by pedram

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-29 makhlaghi Assigned totushar_gupta None
    2022-03-11 makhlaghi Assigned toNone tushar_gupta
    2022-02-01 pedram Carbon-Copy- Added makhlaghi

    Back to the top

    Powered by Savane 3.10