Bug 171088

Summary: Units doesn't correctly convert (x)bytes into (y)bytes.
Product: [Fedora] Fedora Reporter: Ian <iapetus>
Component: unitsAssignee: Harald Hoyer <harald>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-18 07:39:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ian 2005-10-18 02:18:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050923 Fedora/1.7.12-1.5.1

Description of problem:
The units program doesn't correctly convert between bytes, kilobytes, megabytes, gigabytes, etc (or kilobits &c. for that matter.) Here's output from my units program.

2084 units, 71 prefixes, 32 nonlinear units

You have: 1024 kilobytes
You want: megabytes
        * 1.024
        / 0.9765625
You have: 5000 megabytes
You want: gigabytes
        * 5
        / 0.2
You have: 1024 kilobits
You want: megabits
        * 1.024
        / 0.9765625
You have: 5000 megabits
You want: gigabits
        * 5
        / 0.2



Version-Release number of selected component (if applicable):
units-1.80-12

How reproducible:
Always

Steps to Reproduce:
1. start units
2. try converting bit/byte units

  

Actual Results:  It gives the wrong answer!

Expected Results:  It should give the right answer (sorry not a math person.)

Additional info:

Comment 1 Harald Hoyer 2005-10-18 07:39:41 UTC
kibi-                   2^10     # In response to the convention of illegally
mebi-                   2^20     # and confusingly using metric prefixes for
gibi-                   2^30     # powers of two, the International
tebi-                   2^40     # Electrotechnical Commission aproved these
pebi-                   2^50     # binary prefixes for use in 1998.  If you
exbi-                   2^60     # want to refer to "megabytes" using the
Ki-                     kibi     # binary definition, use these prefixes.


$ units
You have: 1024 kibits
You want: mebits
        * 1
        / 1

Comment 2 Harald Hoyer 2005-10-18 07:43:11 UTC
$ units
2438 units, 71 prefixes, 32 nonlinear units

You have: 5000 MiB
You want: GiB
        * 4.8828125
        / 0.2048
You have: 5000 MiB
You want: bits
        * 4.194304e+10
        / 2.3841858e-11

You have: 1 KiB
You want: bits
        * 8192
        / 0.00012207031