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
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by ellerh (Submitted the item)
  •  

    Votes

    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.

     

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16.
    Corresponding source code