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

View: New views
3 Messages — Rating Filter:   Alert me  

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

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

Reply to Author | View Threaded | Show Only this Message

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.14, 2.5.13, 2.5.12, 2.5.15
         Environment: Windows jdk5
            Reporter: mark zeldis
            Assignee: Arno Unkrig


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



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

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

Reply to Author | View Threaded | Show Only this Message


     [ 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



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

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

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JANINO-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=179477#action_179477 ]

Matt Fowles commented on JANINO-126:
------------------------------------

You can find a fixed version of this at http://code.google.com/p/janino-streambase/

> 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