duckduckgo / zeroclickinfo-goodies

DuckDuckGo Instant Answers based on Perl & JavaScript

Home Page:https://duckduckhack.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conversions: Incorrect conversion for Digital Storage starting with Gibibyte, and interaction bug/effect

Farxial opened this issue · comments

Description

A. Kibibytes and mebibytes converted to bytes normally. 0.015625 (1/64) GiB, for instance, converted to bytes normally too. But starting with large values such as 1 gibibyte:
1 GiB → 1073742000 bytes
1 TiB → 1099512000000 bytes
1 PiB → 1125900000000000 bytes

B. When copying result with Ctrl+C, input recalculated with invalid conversion.

Steps to recreate

A. Convert some GiBs/TiBs/PiBs to bytes or bits, or some TiBs/PiBs to KiBs/Kibits/bytes/bits...

B.

  1. Convert 1 GiB to bytes
  2. Select resulted number and copy to clipboard using Ctrl+C
    Input value will update to 1.000000164 (gibibyte).
    This also works for some other unit pairs...
  3. If you copy 1.000000164 using Ctrl+C, result will update again...

People to notify


Instant Answer Page: https://duck.co/ia/view/{ID}

@Farxial thanks for this.

Regarding (A)
I'm not sure I understand the problem here. Can you indicate what you're seeing, and what you're expecting?

Our results appear to match Google and others, so it looks like conversions values are correct?

Regarding (B), I'm able to recreate. However given that DuckDuckHack is in maintenance mode and we're only accepting critical bugs I think we can tolerate this for now as it's minor.

@moollaza
A. According to Wikipedia (GiB | TiB | PiB), result for 1 GiB/TiB/PiB should be 1073741824, 1099511627776 and 1125899906842624 bytes, I suppose.
Or is it not? I'm not an expert on standards actually :) I'm just confused by inaccuraty of calculations.

B. OK. I just reported a bug what I'm found.

P.S. Thanks for DuckDuckGo and all it's features :)

It looks like our conversions are correct, but due to our precision settings, the numbers look slightly different. The internal representation of the units in the code appears correct though.

Given DuckDuckHack is in maintenance mode and I don't believe that calculations are actually incorrect I think this can be tolerated as well.

P.S. Thanks for DuckDuckGo and all it's features :)

You're welcome :)