Hacker News new | past | comments | ask | show | jobs | submit login
How to Convert Bytes to Grams (thatxliner.github.io)
52 points by thatxliner on July 17, 2023 | hide | past | favorite | 32 comments



How fun!

The "natural" way to convert bits to grams (ie not based on any specific technology) would be to combine Landauer's Principle and Mass-energy equivalence.

https://en.wikipedia.org/wiki/Landauer's_principle

However even then, you still have to choose a temperature (eg STP) which is ultimately an arbitrary choice.


You do it at the Planck temperature (1.4e32 K), obviously, giving one Planck mass (22 micrograms) per nat, or 15 ug/b. This probably has some physical relevance, but I'm not sure what.


Isn't that more to flip a bit than representing a bit, though?

Another angle might be to look at the Bekenstein bound, i.e. that if you have a physical system of mass-energy m, there's a maximal number of bits B that it can contain. Though that also would need a system-containing volume (surface area?) which would also be arbitrary.


You also have to convert mass to weight, and for that purpose you need to choose a gravity, which is also arbitrary.


But printing out the characters onto the page, and calculating what those pages would weight isn't the same thing as the change in weight for that ordering of bytes in memory vs a blank page. Where electrons have an infinitesimal but non-zero mass, memory (RAM or storage) thus weighs differently when full of ones vs. zeros. A gzipped copy of PrismJS thus weights somewhere between when the memory is empty vs when it is full. Which, for a 16 MB dimm, is roughly 1.46 x 10^-20 kg, or 14.6 yoctograms. Which is close too, but not literally nothing. For a gzipped copy of PrismJS weighing in at 2 kb, we get 1.87 x 10^-27 kg or 18.7 zeptograms.

Where a feather's weight is measured in grams, a feather is 0.4 * 10^21 times the weight of PrismJS, or a feather weighs (a lot) more. So their claim is true.

Interestingly enough, the same applies to electric cars. Full car batteries weigh an infinitesimally larger amount than empty ones. For a 50 kWh Tesla, we're looking at 1.8 nanograms. Which for a battery pack that weighs 324Kg (~750 lb) is less than a rounding error.

https://physics.stackexchange.com/questions/34421/does-the-m....


> Full car batteries weigh an infinitesimally larger amount than empty ones. [...] It's worth noting that when depleted, the battery still has electrons, it just has fewer,

Is that actually true? Does the battery (as a whole) have a different number of electrons than the number of protons? If I brought a negatively charged chunk of material near the battery, would it require more force to move it closer to the battery when the battery is charged (because by what you're saying, a charged battery has more electrons in it)?


Pretty sure the number of electrons is the same, but they have a higher potential energy, which can be described as mass via ∆e=∆m*c^2


The difference in mass is due to the difference in potential energy. Recall that E=mc^2 (I was excited when I got to use this for the first time in a problem set)


Ah no looks like I'm wrong. I updated my comment.


While your response is more interesting than the article it is still dependent of the nature of information storage. Is there a non-storage dependent way to weight information? Perhaps not a "weight of information" itself, but a physical limit to the minimal weight required to store 1 bit?


It would be interesting to redo the calculation based on the weight change in electronic storage media when data is written versus being zeroed out:

https://langa.com/index.php/2019/08/29/yes-your-hdds-and-ssd...


Only as a side note, one of the good things of the (ISO 216) A format for similar calculations is that the largest one, A0, is defined as being 1 m2 (841x1,189 mm) and since smaller formats are obtained halving the size, the common A4 is the 4th halving, thus it is 1/16th of the A0.

A sheet of A4 paper 80 gr/m2 weights 5 grams, easier.

Back to the link, I lost the Author when he uses the "i" and Times New Roman, I would have found the experiment more meaningful if he used a fixed spaced font and thus could print something more than i's, and then there is the issue about non-printable characters, if you really want to "print" a program you will need hex, which would at least double the weight of a byte.


Yea I originally was going to use A4 paper, which is 5 grams. I was thinking "awesome," but then I found out that it wasn't technically MLA. It's a very small difference between 8.5 x 11 inches vs 8.3 x 11.7 inches though.


I kind of wanted to hear about the most "dense" storage mechanism in existence today and to have those compared ;)

Eg. a 1TB USB flash (casing removed as long it's operational), vs a microSD card vs a NVMe SSD vs a SATA SSD vs a hard drive vs a CD/DVD/BlueRay vs RAM chips...


Instead of using MLA, it might have been better to base the amount of text able to fit on the page off of 80-column punch cards or GNU Enscript [1]. I think you would probably get a vastly different number, as that seems more information dense. Also, does the weight of the ink matter at all?

---

[1]: https://www.gnu.org/software/enscript/


I like the punch cards idea.

If we take the un-punched card as baseline then we could say that all of the bytes 0x00 to 0xFF have negative weight except one. Presumably the 0x00 would be zero weight byte, as it damn well should! ;), and all of the other bytes would have various amounts of negative weights.

Now I want a punch card computer.


I think that filling the page with "i"'s where an "i" represents a whole byte of a data, is overcounting (as admitted in the article), so I tried with 3320 bytes of base64-encoded data. Two pages and 2/3. (Replaced "/" with "_" as "/" made the lines to break too early.) Here, each letter represents 6 bits, so it's clearly undercounting. However the widths of the characters are a bit more realistic, as the narrow "i" is definitely overcounting.


>Get the amount of data we can put on a agreed-on physical medium

I’d go further, figure out the theoretical maximum amount of information that can be stored in a gram of matter and use that. If we’re trying to make a lasting standard then let’s avoid specific storage mediums that may eventually be outdated.

Interestingly, this prior HN post nibbles at the question but doesn’t get into what the composition of the volume would need to be to achieve the density they talk about: https://news.ycombinator.com/item?id=6466430


Technically, doesn’t information have entropy, and therefore mass?


Perhaps sometimes, but I doubt always: Consider a spray of photons, usually considered massless. Would they gain mass based on whether they encoded a message?


> Consider a spray of photons, usually considered massless.

They are massless but have finite energy, which is the flip side of the same coin; see https://en.wikipedia.org/wiki/Mass%E2%80%93energy_equivalenc....

> Would they gain mass based on whether they encoded a message?

They already do encode something. Whether that's message or noise, depends on other parts of the information system that creates/processes those photons, and it is in those parts that the variable costs will be incurred.


However, they contain momentum and energy. With an "photons in a mirror box" type of a system, this translates to the system "as a whole" having mass.


I feel dumb asking this but how does digital storage work. Is there more charge representing 1s than zeros? Would a drive full of byte 254 be heavier than a zerod out HD?


The total charge in an electrostatic device like SSD/Flash remains about the same, but it's moved around in different microscopic parts inside to represent data. In the "floating gate" at the heart of an SSD/Flash cell the 1 or 0 is indeed represented by presence or absence of some quantity of charge, but it's balanced out by charges elsewhere in the device, nearby.

In a HDD charge isn't obviously involved; the data is represented by magnetic patterns on the surface of each spinning platter. Ultimately those also represent data by movements of charge, though: charge naturally orbiting around atoms creates the magnetic fields, and the data is represented by the orientation of those orbits.

So a drive of either kind full of byte 254 contains about the same charge as one that's zeroed out.

They don't have exactly the same mass though, and therefore have slightly different weight, even if they contain identical charge. That's because mass (and weight) doesn't just come from matter. It also comes from the potential energy of different patterns of charge or their orbits, pushing and pulling on each other. It's counter-intuitive that things merely pushing and pulling on each other create mass just by their configuration, and that the mass changes when their configuration changes. But it's true, assuming the theory of relativity is true (it seems to be). That said, the mass created by the configuration of forces is very small indeed. Your SSD or HDD probably changes mass by a very much larger amount in a short time just by existing, giving off or absorbing minute quantities of gases from the air, acquiring dust, and other natural physical changes as the materials age.


Most (all?) SSDs code the data before writing it so you don't commonly get runs of 0s or 1s. Quite a few also at least claim to encrypt it securely, so you can erase the whole thing by just changing the encryption key.


Thank you! Amazing post that taught me something new on a topic I was casually thinking about for a long time.


I would love to see this conversion made into a webpack plugin that logs out the closest "weight" of your build, sort of like those apps that tell you how "big" your fetus is at certain points on the pregnancy timeline.


Just couple of days ago had a discussion about measuring information in units of area. Perhaps spacetime has rest mass after all?


A gram isn't a unit of weight.


Maybe the author was referring to the old pre-2019 gram, referenced to 1/1000th of the weight of the International Prototype Kilogram held in Paris, which is famously on Earth and subject to the very same gravitational field.

/playful


It’s a unit of mass, but for normal people it doesn’t really matter.


Why not use the weight of DNA?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: