Speculative Branches
open-menu closeme
Home
Categories
Tags
About
github twitter linkedin email rss
  • Perfect Random Floating-Point Numbers

    calendar May 3, 2025 · 16 min read · Mathematical Algorithms  ·
    Share on: twitter facebook linkedin copy

    When I recently looked at the state of the art in floating point random number generation, I was surprised to see a common procedure in many programming languages and libraries that is not really a floating-point algorithm: Generate a random integer with bits chosen based on the precision of the format. Convert to …


    Read More
  • The Most Useful Statistical Test You Didn't Learn in School

    calendar Jul 4, 2022 · 9 min read · Performance Mathematical Algorithms  ·
    Share on: twitter facebook linkedin copy

    In performance work, you will often find many distributions that are weirdly shaped: fat-tailed distributions, distributions with a hard lower bound at a non-zero number, and distributions that are just plain odd. Particularly when you look at latency distributions, it is extremely common for the 99th percentile to be …


    Read More
  • Fixed Point Arithmetic

    calendar May 18, 2022 · 12 min read · Mathematical Algorithms Performance  ·
    Share on: twitter facebook linkedin copy

    When we think of how to represent fractional numbers in code, we reach for double and float, and almost never reach for anything else. There are several alternatives, including constructive real numbers that are used in calculators, and rational numbers. One alternative predates all of these, including floating point, …


    Read More
  • Racing the Hardware: 8-bit Division

    calendar Feb 22, 2022 · 19 min read · Mathematical Algorithms Division Performance  ·
    Share on: twitter facebook linkedin copy

    Occasionally, I like to peruse uops.info. It is a great resource for micro-optimization: benchmark every x86 instruction on every architecture, and compile the results. Every time I look at this table, there is one thing that sticks out to me: the DIV instruction. On a Coffee Lake CPU, an 8-bit DIV takes a long time: …


    Read More

Nima Badizadegan

Computer systems engineer, performance expert, and applied mathematician in denial. Currently at Anthropic. All views are my own, and do not reflect the opinions of my employer.
Read More

Recent Posts

  • Perfect Random Floating-Point Numbers
  • A Cryptographically Secret Santa
  • Time Programming for Lawyers and Jurors
  • Five Nine Problems
  • The Computer Architecture of AI (in 2024)
  • The Knight Capital Disaster
  • Abstraction is Expensive
  • Contemplating Randomness

Categories

NUMERICAL LIBRARIES AND FUNCTIONS 4 RANDOM 4 ENGINEERING PRACTICES 3 FUNDAMENTALS OF PERFORMANCE 3 BREAKING THE CODING INTERVIEW 2 META POSTS 2 MICRO-OPTIMIZATION 2 RANDOMNESS 2 HISTORY 1

Tags

MATHEMATICAL ALGORITHMS 8 PERFORMANCE 8 SOFTWARE ENGINEERING 7 DIVISION 1

Copyright  NIMA BADIZADEGAN. All Rights Reserved

to-top