Mercurial > babel > old > babel-test
comparison babel/numbers.py @ 369:c2ae38340540 stable-0.9.x
Ported [388:405/trunk] to 0.9.x branch.
author | cmlenz |
---|---|
date | Fri, 27 Jun 2008 15:22:12 +0000 |
parents | e8bfc65444f3 |
children | 369300a7ebd3 |
comparison
equal
deleted
inserted
replaced
368:7647773d3831 | 369:c2ae38340540 |
---|---|
461 def apply(self, value, locale, currency=None): | 461 def apply(self, value, locale, currency=None): |
462 value *= self.scale | 462 value *= self.scale |
463 is_negative = int(value < 0) | 463 is_negative = int(value < 0) |
464 if self.exp_prec: # Scientific notation | 464 if self.exp_prec: # Scientific notation |
465 value = abs(value) | 465 value = abs(value) |
466 exp = int(math.floor(math.log(value, 10))) | 466 if value: |
467 exp = int(math.floor(math.log(value, 10))) | |
468 else: | |
469 exp = 0 | |
467 # Minimum number of integer digits | 470 # Minimum number of integer digits |
468 if self.int_prec[0] == self.int_prec[1]: | 471 if self.int_prec[0] == self.int_prec[1]: |
469 exp -= self.int_prec[0] - 1 | 472 exp -= self.int_prec[0] - 1 |
470 # Exponent grouping | 473 # Exponent grouping |
471 elif self.int_prec[1]: | 474 elif self.int_prec[1]: |