Skip to content

Instantly share code, notes, and snippets.

View Calvin-Xu's full-sized avatar
๐ŸŒน
่‡ช็”ฑใ‚’่ˆžใ†่–”่–‡ใฎใ‚ˆใ†ใซใ€€็งใฏไธ–็•Œใ‚’ๅค‰ใˆใ‚‹

Calvin Xu Calvin-Xu

๐ŸŒน
่‡ช็”ฑใ‚’่ˆžใ†่–”่–‡ใฎใ‚ˆใ†ใซใ€€็งใฏไธ–็•Œใ‚’ๅค‰ใˆใ‚‹
View GitHub Profile
@Calvin-Xu
Calvin-Xu / math.c
Last active March 23, 2023 08:20
Implementation of some math.h functions
// uses only elementary methods
// guarantees none of speed, precision or accuracy
// I didn't read the specs
// does not handle any errors
// might be educational; definitely not practical
#include "math.h"
// double has 53 bits mantissa
// precision is log_10(2^53) = 15.9546
// part of https://github.com/Calvin-Xu/Allegorical-Lisp-Machine
// that does not disclose CS 107E assignment implementations
// based on The Roots of Lisp by Paul Graham that follows closely McCarthy's original paper
// Lisp in 99 lines of C and how to write one yourself by Robert van Engele
#include "lisp.h"
#include "printf.h"
#include "utils.h"
#include "strings.h"
@Calvin-Xu
Calvin-Xu / furigana.py
Last active July 8, 2026 03:14
Generating reading pairs / furigana string
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
from __future__ import annotations
from dataclasses import dataclass
from functools import lru_cache
from typing import Dict, List, Mapping, Tuple