Skip to content
Browse files

Fixed french currency function.

  • Loading branch information...
1 parent bd7156f commit 6074538f41906fb69b340c067939f4fab4349fbe @wilkie committed May 3, 2010
Showing with 8 additions and 7 deletions.
  1. +6 −6 locales/fr_fr.d
  2. +2 −1 winsamp.d
View
12 locales/fr_fr.d
@@ -102,21 +102,21 @@ class LocaleFrench_FR : LocaleInterface {
// Get integer part of decimal
intPart = whole;
baseScale = 1;
+ int precision;
for (long i; i < scale; i++) {
intPart /= 10;
baseScale *= 10;
+ precision++;
}
- baseScale /= 10;
// Get fraction as an integer
fracPart = whole % baseScale;
- // Round down
- for ( ; round > 0 ; round-- ) {
- baseScale /= 10;
+ // Round down
+ for ( ; precision > round ; precision-- ) {
+ fracPart /= 10;
}
- fracPart /= baseScale;
-
+
return formatNumber(intPart) ~ "," ~ formatNumber(fracPart);
}
View
3 winsamp.d
@@ -104,7 +104,8 @@ class MyConsoleApp : Application {
Console.putln(new Fixed(3.5));
Atomic.exchange(a,6);
Console.putln(a,b,c);
- Console.putln("{c}".format(1500.42) == (new Currency(150042,2)).toString());
+ Console.putln("{c}".format(1500.42));
+ Locale.id = LocaleId.French_FR;
Console.putln("{c}".format(1500.42));
Console.putln(new Currency(150042,2));
t = new Thread(&foo);

0 comments on commit 6074538

Please sign in to comment.
Something went wrong with that request. Please try again.