Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

New zine: How Integers and Floats Work

Hello! On Wednesday, we released a new zine: How Integers and Floats Work!You can get it for $12 here:https://wizardzines.com/zines/integers-floats, or getan 13-pack of all my zines here.Here’s the cover:Here’s the table of contents! Now let’s talk about some of the motivations for writing this zine!I wrote this zine because I used to find binary data really impenetrable. Thereare all these 0s and 1s! What does it mean?But if you look at any binary file format, most of it is integers! For example,if you look at the DNS parsing in Implement DNS in a Weekend, it’s all about encoding anddecoding a bunch of integers (plus some ASCII strings, which arguably are also arrays of integers).So I think that learning how integers work in depth is a really nice way to getstarted with understanding binary file formats. The zine also talks about someother tricks for encoding binary data into integers with binary operations andbit flags.The second motivation was to explain floating point. Floating point is prettyweird! (see [examples of floating point problems]()for a very long list)And almost all explanations of floating point I’ve read have been really mathand notation heavy in a way that I find pretty unpleasant and confusing, eventhough I love math more than most people (I did a pure math degree) and ampretty good at it.We spent weeks working on a clearer explanation of floating point with minimalmath jargon and lots of pictures and I think we got there. Here’s one example page, onthe floating point number line:One of my favourite ways to learn about how my computer represents things inmemory has been to use a debugger to look at the memory of a real program.But C debuggers like gdb are pretty hard to use at first! SoMarie and I made a playground called Memory Spy. It runs a C debugger behind thescenes, but it provides a much simpler interface – there are a bunch ofvery simple example C programs, and you can just click on each line to view howthe variable on that line is represented in memory.Here’s a screenshot:Memory Spy is inspired by Philip Guo’s great Python Tutor.When doing demos and research for this zine, I found myself reaching forfloat.exposed a lot to show how numbers are encodedin floating point. It’s by Bartosz Ciechanowski, who has tons of other great visualizations on his site.I loved it so much that I made a clone called integer.exposed forintegers (with permission), so that people could look at integers in a similar way.Here are a few blog posts I wrote while thinking about how to write this zine:There’s always been the option to print the zines yourself on your homeprinter.But this time there’s a new option too: you can get a print copy shipped toyou! (just click on the “print version” link on this page)The only caveat is print orders will ship in August – Ineed to wait for orders to come in to get an idea of how many I should printbefore sending it to the printer.I don’t make these zines by myself!I worked with Marie LeBlanc Flanagan everymorning for 5 months to clarify explanations and build memory spy.The cover is by Vladimir Kašiković, Gersande La Flèche did copy editing, DollyLanuza did editing, another friend did technical review.Stefan Karpinski gave a talk 10 years ago at the Recurse Center (I even blogged about it at the time)which was the first explanation of floating point that ever made any sense tome. He also explained how signed integers work to me in a Mastodon post a fewmonths ago, when I was in the middle of writing the zine.And finally, I want to thank all the beta readers – 60 of you read the zine and leftcomments about what was confusing, what was working, and ideas for how to makeit better. It made the end product so much better.As always: if you’ve bought zines in the past, thank you for all your supportover the years. I couldn’t do this without you. Some blogging myths You might also like the Recurse Center, my very favorite programming community (my posts about it)



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

New zine: How Integers and Floats Work

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×