« Return to Thread: [janino-dev] [jira] Created: (JANINO-126) ExpressionEvaluator isn't handling NaN correctly

[janino-dev] [jira] Updated: (JANINO-126) ExpressionEvaluator isn't handling NaN correctly

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View in Thread


     [ http://jira.codehaus.org/browse/JANINO-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Fowles updated JANINO-126:
-------------------------------

    Attachment: NaN.diff

The attached patch fixes this.  The compiler has to emit DCMPG and DCMPL based on what sort of comparison is being performed.

> ExpressionEvaluator isn't handling NaN correctly
> ------------------------------------------------
>
>                 Key: JANINO-126
>                 URL: http://jira.codehaus.org/browse/JANINO-126
>             Project: Janino
>          Issue Type: Bug
>    Affects Versions: 2.5.12, 2.5.13, 2.5.14, 2.5.15
>         Environment: Windows jdk5
>            Reporter: mark zeldis
>            Assignee: Arno Unkrig
>         Attachments: NaN.diff
>
>
> NaN is not working within the ExpressionEvaluator.  All evaluations involving NaN should be false.  Here is an example:
> import org.codehaus.janino.*;
> public class TestTest {
>     public static void main(String args[]){
>         try {
>             ExpressionEvaluator advancedFilter= new ExpressionEvaluator(
>                     "x>5",                        // expression
>                     Boolean.class,                // expressionType
>                     new String[]{"x"},            // parameterNames
>                     new Class[]{Double.class}     // parameterTypes
>             );
>             System.err.println(advancedFilter.evaluate(new Double[]{Double.NaN}));
>             System.err.println(Double.NaN>5);
>         }
>         catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: [janino-dev] [jira] Created: (JANINO-126) ExpressionEvaluator isn't handling NaN correctly