this post was submitted on 23 Jan 2024
900 points (95.4% liked)

Memes

45729 readers
813 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] mindbleach@sh.itjust.works 3 points 10 months ago

I do some 8-bit coding and only last month realized logarithms allow dirt-cheap multiplication and division. I had never used them in a context where floating-point wasn't readily available. Took a function I'd painstakingly optimized in 6502 assembly, requiring only two hundred cycles, and instantly replaced it with sixty cycles of sloppy C. More assembly got it down to about thirty-five... and more accurate than before. All from doing exp[ log[ n ] - log[ d ] ].

Still pull my hair out doing anything with tangents. I understand it conceptually. I know how it goddamn well ought to work. But it is somehow the fiddliest goddamn thing to handle, despite being basically friggin' linear for the first forty-five degrees. Which is why my code also now cheats by doing a (dirt cheap!) division and pretending that's an octant angle.