Opened 10 years ago

Closed 10 years ago

#62 closed defect (fixed)

abs() argument truncated on 64-bit

Reported by: Jim Ursetto Owned by:
Priority: major Milestone:
Component: core libraries Version:
Keywords: Cc:
Estimated difficulty:

Description

Reported by Alejandro:

In Chicken 3.4.0 linux-unix-gnu-x86-64 the expression (abs 2147483648)
evaluates to -2147483648 in both csi and a compiled program (negative?
and positive?, however, seem to work correctly). It evaluated
correctly in a 32-bits build of the same version.

Using labs() instead of abs() should fix the issue

Attachments (1)

abs-64bit.diff.txt (458 bytes) - added by Jim Ursetto 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by Jim Ursetto

Attachment: abs-64bit.diff.txt added

comment:1 Changed 10 years ago by Jim Ursetto

Version: 4.0.x

Clarification, removed ticket version number, it applies to all versions.

comment:2 Changed 10 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

Patch attached in r15291. Thanks.

Note: See TracTickets for help on using tickets.