[Top][All Lists]

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

[task #16114] Print warning where integer overflow happens

From: Mohammad Akhlaghi
Subject: [task #16114] Print warning where integer overflow happens
Date: Tue, 21 Feb 2023 11:57:25 -0500 (EST)

Follow-up Comment #6, task #16114 (project gnuastro):

Thanks for looking into this problem. In this case, it does indeed seem
necessary to do manual checks on each operator! But having it active all the
time will force a significant overhead; we should add a flag for this so it is
only activated when the user wants.

Flags are passed to the Arithmetic library through bits in the 'flags'
argument. You can see their definition macros in the macros starting with
'GAL_ARITHMETIC_FLAG_' of 'lib/gnuastro/arithmetic.h' (searching for their
names in the Arithmetic library's source files will hopefully give you some
demos of how to use them).

For the time being, you can just add this flag manually in the top-level
'gal_arithmetic' function (and not take too much time for bringing it from the
command-line). Later, I can connect it to a command-line option easily ;-).

About the final problem with '-128'. The reason is that "blank" values for
signed integers are defined to be the minimum value of that type. In floating
points, "blank" values are "NaN" or "Not a Number". Similar to NaNs in a
floating point type, in Gnuastro any operation on an integer blank value will
return false or the blank value itself.


Reply to this item at:


Message sent via Savannah

reply via email to

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