Playback speed
Share post
Share post at current time

Paid episode

The full episode is only available to paid subscribers of Computer, Enhance!

Monday Q&A #14 (2023-06-05)

Answers to questions from last week's videos

Each Monday I answer questions from the comments on the prior week’s videos. Transcripts are not available for Q&A videos due to length. I do produce closed captions for them, but Substack still has not enabled closed captions on videos :(

Questions addressed in this video:

  • [00:36] “Will your parser be a fully general json parser that makes no special assumptions about the JSON?”

  • [05:00] “Should we assume the entire Json fits in memory? I.E is it ok to read entire file as a byte array?”

  • [06:47] “I ran into one hiccup with serializing f64s to text. I noticed many of my recomputed sums failed to match the reference sums due to a small precision loss in the JSON data. I'm currently writing out my floats to JSON using `fprintf` with the format specifier `%.15f`.

    Is there a trick to writing out an f64 to text such that it can be parsed back into a bit-identical f64?”
    “I'm not in game dev, and rarely use floating point numbers. I found that naive approach to parsing them from string seems to loose precision. What is the best resource to learn how to parse them precisely? Is it even possible in general? Again naively I'd say that if I was able to print it, I should be able to read it back, but quick googling shows that there are papers on this topic, so this might be non-trivial.”

    “I don't see how the Grug-brained algorithm could possibly be working in generality, given that 0.1 can't be represented precisely. Could anyone explain exactly how we're supposed to be parsing floats? In particular, how does one arrange for e.g. "62.33736768026505" to come out correctly? Why is Casey not seeing precision problems?”

  • [19:42] “Sorry that this question is a bit off-topic. I was thinking more about assembly, and while I understand function calls, I do not yet understand dynamically linked libraries. If a program that uses dynamically linked libraries is compiled, are the methods compiled into special OS methods that ask for a function pointer / hook to another binary? Maybe all needed binaries are registered at the start of the program and get loaded then? Is that sort of thing managed at the OS level?”

The full video is for paid subscribers

Programming Courses
A series of courses on programming topics.