ceylon/ceylon.language — pull request #551 by lucaswerkmeister (2014-09-11 14:41:54+00:00)
Title: Fix parseFloat bugs and add tests

Fixes two `parseFloat()` bugs:
- `parseFloat("-0.5")` or any other negative number with a nonzero fractional part
- `parseFloat("-0.0")`

There’s a much simpler fix for #550 alone:
```diff
diff --git a/src/ceylon/language/parseFloat.ceylon b/src/ceylon/language/parseFloat.ceylon
index d7dcdde..43ba313 100644
--- a/src/ceylon/language/parseFloat.ceylon
+++ b/src/ceylon/language/parseFloat.ceylon
@@ -62,8 +62,9 @@ shared Float? parseFloat(String string) {
else {
exponent = -shift;
}
+ value wholeSign = (wholePart startsWith "-") then -1 else 1; // don't use whole.sign: fails for -0.x
Integer numerator
- = whole*10^shift + fractional;
+ = whole*10^shift + wholeSign * fractional;
value em = exponent.magnitude;
if (em==0) {
return numerator.float;
```
but that doesn’t work for `-0.0`.

At the moment, I can’t run the tests due to some unrelated error (some classes are not found); can someone else please do that?