bugKawa - Bugs: bug #38081, Integer truncation

 
 

bug #38081: Integer truncation

Submitter:  Helmut Eller <ellerh>
Submitted:  Mon 14 Jan 2013 11:33:27 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Sep 2013 10:25:52 PM UTC, comment #1: 

For what it's worth, Java does this as well.


        public static void main(String[] args) {
                byte b = (byte) 128;
                System.out.println(b);
        }
-verbatim+
prints
+verbatim+
-128


I suspect a range check when using set! would result in an appreciable performance hit.

Anonymous
Mon 14 Jan 2013 11:33:27 AM UTC, original submission:  

Kawa truncates integers when storing into byte arrays:

(scheme-implementation-version) => "1.13.1 (revision 7422)"
(define v (byte[] length: 1))
(set! (v 0) 128)
(v 0) => -128


The same happens for s8vectors.
It would be nice if the value would be checked and signal an error
if it is not in the [-128, 127] range.

Helmut Eller <ellerh>

 

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

Attach Files:
   
   
Comment:
   

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 ellerh (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.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code