Skip to content

Instantly share code, notes, and snippets.

View shibatch's full-sized avatar
😊

Naoki Shibata shibatch

😊
  • Kyoto, Japan
View GitHub Profile
@simonbyrne
simonbyrne / paynehanek.jl
Last active November 18, 2023 02:39
Payne-Hanek reduction in Julia
import Base: TwicePrecision, significand_bits, significand_mask, exponent_mask, exponent_bias
# Bits of 1/2π
# 1/2π == sum(x / 0x1p64^i for i,x = enumerate(INV2PI))
# Can be obtained by:
#
# setprecision(BigFloat, 4096)
# I = 0.5/big(pi)
# for i = 1:19
# I *= 0x1p64