[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #62096] Bad result in basic addition of two numbers
From: |
Raul Infante-Sainz |
Subject: |
[bug #62096] Bad result in basic addition of two numbers |
Date: |
Tue, 22 Feb 2022 10:13:35 -0500 (EST) |
URL:
<https://savannah.gnu.org/bugs/?62096>
Summary: Bad result in basic addition of two numbers
Project: GNU Astronomy Utilities
Submitted by: infantesainz
Submitted on: Tue 22 Feb 2022 03:13:33 PM UTC
Category: Arithmetic
Severity: 3 - Normal
Item Group: Output not reasonable
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I am using Arithmetic (Gnuastro 0.16.165-b4b2). With a very simple command I
obtain nonsense result.
The command:
astarithmetic 250 1 +
The result:
astarithmetic: the two integer operands given to '+' have the same width, but
a different sign: the first popped operand has type 'int8' and the second has
type 'uint8'. This may create unexpected results if the signed input contains
negative values. To address this problem there are two options: 1) if you know
that the signed input can only have positive values, use Arithmetic's type
conversion operators to convert it to an un-signed type of the same width
(e.g., 'uint8', 'uint16', 'uint32' or 'uint64'). 2) Convert the unsigned input
to a signed one of the next largest width with the type conversion operators
(e.g., 'int16', 'int32' or 'int64')
-5
Arithmetic finished in 0.000339 seconds
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62096>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #62096] Bad result in basic addition of two numbers,
Raul Infante-Sainz <=