Menu

floating point format

2008-06-25
2012-12-07
  • Patrick Dowler

    Patrick Dowler - 2008-06-25

    using: 0.4.3

    I found a few funny issues with floating point literals using exponential notation. My understanding is that in SQL the decimal point and fractional part of the mantissa are optiona, so 1.0e2 and 1.e2 and 1e2 are all legal floating point values. However, I get a parse error at the 'e' in all except the first (1.0e2) case.

    Example: select foo from bar where foo > 1e2

    Encountered "e2" at line 1, column 34.
    Was expecting one of:
        <EOF>
        "GROUP" ...
        "LIMIT" ...
        "ORDER" ...
        "OFFSET" ...
        "HAVING" ...
        ";" ...
        "*" ...
        "/" ...
        "+" ...
        "-" ...
        "AND" ...
        "OR" ...
        "UNION" ...

    Worse yet: "select 1e2 from foo" is parsed as "SELECT 1 AS e2 FROM foo" if I log the PlainSelect during visit(PlainSelect), eg it becomes an alias.

    thanks,

    Patrick

     
    • Leonardo Francalanci

      I will have a look at this this week.

       
    • Leonardo Francalanci

      Could you try 0.4.4?

       
    • Patrick Dowler

      Patrick Dowler - 2008-07-14

      OK, this is working as expected now.

      Thanks for the quick response!

      Patrick

       

Log in to post a comment.