惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
Martin Fowler
Martin Fowler
B
Blog
The GitHub Blog
The GitHub Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
月光博客
月光博客
人人都是产品经理
人人都是产品经理
IT之家
IT之家
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
C
Check Point Blog
罗磊的独立博客

Lobsters

CIFSwitch: a non-universal Linux local root vulnerability RIPE NCC session fixation: poaching logins with an Atlas probe GNOME 2.20 but its Web Components Agentic Search for Context Engineering – Leonie Monigatti Garnix is shutting down [not OC] akashina.tngl.sh/jjc Concerning Emacs (and Jazz) Nitpicking the shell history scene in ‘Tron: Legacy’ What's cooking on SourceHut? Q2 2026 The tenth OpenPGP email summit Package managers that package package managers Clojure on Fennel part three: parsing WordPress at 23 Finding Miscompiles for Fun, Not Profit GitHub - creusot-rs/creusot: Creusot helps you prove your Rust code is correct. Announcing Rust 1.96.0 | Rust Blog A Love Letter to Neovim sqlite AGENTS.md Am I a Bad Friend? CSS vs. JavaScript • Josh W. Comeau Erlang Ecosystem Foundation - Supporting the BEAM community A brief note about slot access cost in Common Lisp Keyboard latency probe Rethinking the GNOME clipboard issues Back to the Building Blocks’ Building Blocks Tech Notes: Theseus: translating win32 to wasm Fast is better than slow Content-addressed Rust builds (or, what kache actually caches) Intent to Prototype: Embedding API Canada’s Bill C-22 and the security cost of collecting more data
Emacs bra size calculator
pulusound.fi · 2026-05-29 · via Lobsters
posted 2026-05-27, updated 2026-05-28

recently i needed some new bras. my measurements had changed a bit since last time, so to make my life easier(?) i decided to write a bra size calculator that i can use in Emacs. the core function, my-math-compute-bra-size, is as follows:

;; dependencies - these come with recent Emacs versions but might not be loaded
(require 'calc-units)
(require 'cl-lib)
(require 'seq)

(defun my-math-compute-bra-size (band-expr bust-expr &optional region)
  (cl-flet ((to-unit (expr unit)
              (string-to-number
               (calc-eval (math-convert-units
                           (calc-eval expr 'raw)
                           (calc-eval unit 'raw)
                           t)))))
    (let* ((region-info-alist
            '((eu . ((unit . "cm")
                     (cups . ((12 . "AA") (14 . "A") (16 . "B") (18 . "C")
                              (20 . "D") (22 . "E") (24 . "F") (26 . "G")
                              (28 . "H") (30 . "I") (32 . "J") (34 . "K")))))
              (uk . ((unit . "in")
                     (cups . ((1 . "AA") (2 . "A") (3 . "B") (4 . "C")
                              (5 . "D") (6 . "DD") (7 . "E") (8 . "F")
                              (9 . "FF") (10 . "G") (11 . "GG") (12 . "H")))))
              (us . ((unit . "in")
                     (cups . ((1 . "AA") (2 . "A") (3 . "B") (4 . "C")
                              (5 . "D") (6 . "DD/E") (7 . "DDD/F") (8 . "DDDD/G")
                              (9 . "H") (10 . "I") (11 . "J") (12 . "K")))))))
           (region (or region 'eu))
           (region-info (alist-get region region-info-alist))
           (unit (alist-get 'unit region-info))
           (cups (alist-get 'cups region-info))
           (band (to-unit band-expr unit))
           (bust (to-unit bust-expr unit))
           (diff (- bust band))
           (cup (or (cdr (seq-find (lambda (x) (< diff (car x))) cups))
                    (format "%s+" (cdar (last cups))))))
      (format "%s%s" (round band) cup diff))))

this makes use of Emacs Calc's built-in unit conversion functions, so you need to pass in the measurements as unit-suffixed strings. for example, given a made-up band (underbust) measurement of 90 cm and a bust measurement of 105 cm, you could calculate the EU bra size as

(my-math-compute-bra-size "90 cm" "105 cm" 'eu)

giving "90B". you could also use other units of length, such as in (inches), or ly (light years), or Ang (Angstrom). hooray for Calc!

we can take this further with some nice UI around it. i have recently enjoyed using Org tables as spreadsheets, and wanted to make a table where i can just type in my measurements, refresh, and have EU/UK/US bra sizes automatically filled in.

this is not too difficult to achieve by using Emacs Lisp as formulas. you can copy-paste the following table as a template:

|       date | band  | bust   | EU size | UK size | US size |
|------------+-------+--------+---------+---------+---------|
| 2026-05-27 | 90 cm | 105 cm |         |         |         |
#+TBLFM: $4='(my-math-compute-bra-size $2 $3 'eu)::$5='(my-math-compute-bra-size $2 $3 'uk)::$6='(my-math-compute-bra-size $2 $3 'us)

modify the band and bust numbers (again, with your preferred length units!), update the table, for example with C-u C-c *, and all the size fields get recomputed :) you can also add more rows and keep a log of measurements over time, if you want to.

disclaimers:

  • i implemented support for EU, UK and US sizing as these are the ones i usually encounter. other standards might need some additional logic.
  • there are larger cup sizes than the ones i entered, but the data i found on them was a bit inconsistent. sorry! for sizes that are out of range, the function will return the largest known size with a + added. it should hopefully be easy to augment the data if needed.
  • there may be mistakes in my data/code.
    • i know in practice sizes vary by brand, model, etc. but results from online calculators that i tried while writing this post vary so wildly that i now question whether these numbers really mean anything at all.
    • i am reasonably confident my EU size calculation is consistent with EN 13402 though.