[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-kawa] [bug #40077] Boolean logical `not` on float number can result
From: |
Matthieu Vachon |
Subject: |
[Bug-kawa] [bug #40077] Boolean logical `not` on float number can result in ClassCastException |
Date: |
Sat, 21 Sep 2013 05:55:27 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?40077>
Summary: Boolean logical `not` on float number can result in
ClassCastException
Project: Kawa
Submitted by: maoueh
Submitted on: Sat 21 Sep 2013 05:55:26 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Consider the following snippet of code:
(let ((a 0) (b 0.01))
(format #t "~a~%" (and (eqv? a 0) (not b))))
This will correctly print "#f" as we would expect. However, when this code is
used within a function an return a result, the code results in a
ClassCastException cannot convert DFloNum to Boolean.
(define (repeat? a b)
(and (eqv? a 0) (not b)))
(format "~a~%" (repeat? 0 0.01))
The snippet above will fail with this exception:
java.lang.ClassCastException: gnu.math.DFloNum cannot be cast to
java.lang.Boolean
at atInteractiveLevel$2.isRepeat(boolean-double-cast-exception.scm:5)
at atInteractiveLevel$2.apply2(boolean-double-cast-exception.scm:4)
at gnu.expr.ModuleMethod.apply2(ModuleMethod.java:198)
at atInteractiveLevel$3.run(boolean-double-cast-exception.scm:7)
...
I attached a patch that adds a failing testcase to Kawa about this bug.
Regards,
Matt
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sat 21 Sep 2013 05:55:26 AM GMT Name: feature-sva39949-testcase.patch
Size: 2kB By: maoueh
<http://savannah.gnu.org/bugs/download.php?file_id=29189>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?40077>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Bug-kawa] [bug #40077] Boolean logical `not` on float number can result in ClassCastException,
Matthieu Vachon <=