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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
U
Unit 42
B
Blog RSS Feed
博客园 - 【当耐特】
T
Tailwind CSS Blog
V
V2EX
S
SegmentFault 最新的问题
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
量子位
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
P
Proofpoint News Feed
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
About on SuperTechFans

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.