~lottanzb/lottanzb/trunk-packaging-9.10

« back to all changes in this revision

Viewing changes to lottanzb/backend/hubs/__init__.py

  • Committer: Severin Heiniger
  • Date: 2010-08-15 18:12:38 UTC
  • mfrom: (1212.1.150 trunk)
  • Revision ID: severinheiniger@gmail.com-20100815181238-yqzrdla3qyn6nxt7
Sync with main.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
        value = self._data
65
65
        n = 0
66
66
        
67
 
        while value > 1023.0 and n < len(self.UNITS) - 1:
 
67
        # Use 1000 as the lower boundary for switching the the next-higher
 
68
        # scale. 1024 would be more accurate, but may cause the returned number
 
69
        # to consist of 5 numbers instead of 4.
 
70
        # Thus, even though this change introduces a slight mathematical
 
71
        # inaccuracy ('1.0 MiB/s' is returned instead of '1023.9 KiB/s'),
 
72
        # it will save a few pixels here and there and is also more readable.
 
73
        while value >= 1000.0 and n < len(self.UNITS) - 1:
68
74
            value = value / 1024.0
69
75
            n = n + 1
70
76