x10-lang / x10

Core implementation of X10 programming language including compiler, runtime, class libraries, sample programs and test suite
Eclipse Public License 1.0
71 stars 15 forks source link

Double.NaN as Long #25

Open masanorihirano opened 6 years ago

masanorihirano commented 6 years ago

I think the cast from double to long is weird.

import x10.io.Console;

class test {
  public static def main(args:Rail[String]):void {
    Console.OUT.print(Double.NaN as Long);
  }
}

compile the code above and carry it out, it work weirdly.

x10c++ test.x10
./a.out

we can get the result below

-9223372036854775808

On the other hand,

x10c test.x10
x10 test

we can get the result below, which is completely different from above

0

I supposed that I can get "NaN" put into Long as the result.

Is the result above correct?