Emacs Bra Size Calculator

grumblepeet1 pts0 comments

Emacs bra size calculator - pulusound

Emacs bra size calculator<br>posted 2026-05-27, updated 2026-05-27<br>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:<br>(defun my-math-compute-bra-size (band-expr bust-expr &optional region)<br>(cl-flet ((to-unit (expr unit)<br>(string-to-number<br>(calc-eval (math-convert-units<br>(calc-eval expr 'raw)<br>(calc-eval unit 'raw)<br>t)))))<br>(let* ((region-info-alist<br>'((eu . ((unit . "cm")<br>(cups . ((12 . "AA") (14 . "A") (16 . "B") (18 . "C")<br>(20 . "D") (22 . "E") (24 . "F") (26 . "G")<br>(28 . "H") (30 . "I") (32 . "J") (34 . "K")))))<br>(uk . ((unit . "in")<br>(cups . ((1 . "AA") (2 . "A") (3 . "B") (4 . "C")<br>(5 . "D") (6 . "DD") (7 . "E") (8 . "F")<br>(9 . "FF") (10 . "G") (11 . "GG") (12 . "H")))))<br>(us . ((unit . "in")<br>(cups . ((1 . "AA") (2 . "A") (3 . "B") (4 . "C")<br>(5 . "D") (6 . "DD/E") (7 . "DDD/F") (8 . "DDDD/G")<br>(9 . "H") (10 . "I") (11 . "J") (12 . "K")))))))<br>(region (or region 'eu))<br>(region-info (alist-get region region-info-alist))<br>(unit (alist-get 'unit region-info))<br>(cups (alist-get 'cups region-info))<br>(band (to-unit band-expr unit))<br>(bust (to-unit bust-expr unit))<br>(diff (- bust band))<br>(cup (or (cdr (seq-find (lambda (x) ( diff (car x))) cups))<br>(format "%s+" (cdar (last cups))))))<br>(format "%s%s" (round band) cup diff))))<br>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<br>(my-math-compute-bra-size "90 cm" "105 cm" 'eu)<br>giving "90B". you could also use other units of length, such as in (inches), or ly (light years), or Ang (Angstrom). hooray for Calc!<br>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.<br>this is not too difficult to achieve by using Emacs Lisp as formulas. you can copy-paste the following table as a template:<br>| date | band | bust | EU size | UK size | US size |<br>|------------+-------+--------+---------+---------+---------|<br>| 2026-05-27 | 90 cm | 105 cm | | | |<br>#+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)<br>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.<br>disclaimers:<br>i implemented support for EU, UK and US sizing as these are the ones i usually encounter. other standards might need some additional logic.<br>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.<br>there may be mistakes in my data/code.<br>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.<br>i am reasonably confident my EU size calculation is consistent with EN 13402 though.

size unit region band math bust

Related Articles