teavm-javac icon indicating copy to clipboard operation
teavm-javac copied to clipboard

double to string

Open frankbauer opened this issue 6 years ago • 3 comments

Compiling the following code

public class Main {
  public static void main(String[] args){
    System.out.println(1.0);
  }	
}

produces the following error with the latest master

ERROR at Main.java:4 Native method java.lang.Double.doubleToLongBits(D)J has no implementation
    at java.lang.Double.doubleToLongBits
    at org.teavm.classlib.impl.text.DoubleAnalyzer.analyze(DoubleAnalyzer.java:76)
    at java.lang.AbstractStringBuilder.insert(TAbstractStringBuilder.java:351)
    at java.lang.AbstractStringBuilder.append(TAbstractStringBuilder.java:309)
    at java.lang.StringBuilder.append(TStringBuilder.java:61)
    at java.io.PrintStream.println(TPrintStream.java:197)

frankbauer avatar Jan 21 '19 14:01 frankbauer

@konsoletyper For some reason, it's working fine at http://teavm.org/sandbox/index.html. I could copy the library directly from there but I do not have source file to modify it. If only there's a source code version of that sandbox, that would be great.

paiboonpa avatar Apr 25 '19 08:04 paiboonpa

@konsoletyper System.out.println(1f); Also output as NaN on both version.

paiboonpa avatar Apr 27 '19 05:04 paiboonpa

I ran into this issue too. I ended up cloning and installing @frankbauer's fork of TeaVM itself (had to change teavm.version in the teavm-javac root pom.xml to 0.6.0-for-javac-107 to use that local build instead of the remote one).

dmfrancisco avatar Jul 14 '20 16:07 dmfrancisco