consts.bend source
consts.bend on the hub · documented module
# bend-float64's constants for the math functions, as big integers: c = floor(value * 2^bits), so value lies in# [c, c + 1) * 2^-bits. Generated with mpmath (test/gen_consts.py).import Base# floor(pi * 2^2400)def pi() -> List<&2, U32>: [999245976, 680887927, 2050118529, 1814351708, 2950085171, 2609353502, 3462151702, 1947742710, 732546397, 1668267050, 3018724369, 2087905683, 2706671279, 289532110, 3033291828, 715854006, 1439316330, 1676153920, 1464375394, 2857741204, 3864339955, 1432378464, 2024746970, 3174124327, 3608508353, 2954791486, 1822297739, 1614419982, 2390351024, 3101374703, 3393288472, 677414384, 3318853667, 720527379, 2620446009, 3260701109, 2069144605, 2182433518, 1904987480, 1921955416, 227898511, 4103290238, 2757295779, 1901547113, 1667834072, 2240740374, 134345442, 3012652279, 614570311, 4046225305, 3128725573, 1780907670, 3101798381, 3491422135, 805139163, 2564797868, 3509652390, 2306472731, 2450970073, 3041331479, 1065670069, 3380367581, 3232508343, 887688300, 3193202383, 953160567, 1160258022, 3964562569, 137296536, 698298832, 2752067618, 57701188, 320440878, 2242054355, 608135816, 3]def pi_bits() -> U32: 2400# floor(ln 2 * 2^2400)def ln2() -> List<&2, U32>: [2708640721, 1931271310, 1151346004, 816810139, 2530535123, 2409011252, 1433450182, 451048430, 1972937109, 3009774909, 1293299123, 1348780427, 1599124760, 455979803, 126841693, 1818258609, 2922462427, 2984344477, 2505920889, 389352748, 206047828, 1560181411, 122533377, 1578405506, 1788641162, 895787831, 627481395, 3520465245, 1276780043, 2475905356, 3435941477, 3027881267, 3376670514, 3683225829, 390465397, 335590294, 2100175838, 4229888533, 3998653805, 2414170530, 1628254456, 4217109392, 133483025, 255841734, 3660421061, 790684578, 1700766087, 942682696, 4125075133, 2640660682, 1926137777, 1985476427, 628072684, 2973130811, 3119160259, 830224510, 449567249, 575334597, 1050069526, 292141093, 660028201, 3241681220, 3979259445, 1257904912, 1435849467, 1844161688, 3887625760, 2343238187, 2316113755, 1922610733, 1089684262, 66254511, 3387143064, 3520035243, 2977044471]def ln2_bits() -> U32: 2400# floor(ln 10 * 2^2400)def ln10() -> List<&2, U32>: [2845315732, 60195882, 3616720675, 3050091806, 3989042024, 1682565560, 621381088, 2440527648, 3859455538, 3663543512, 3194430359, 2263454267, 851515829, 1619453993, 3048206335, 4286101190, 2385075203, 978380163, 3724074369, 2108138135, 2770840235, 3962989890, 2717982661, 2126278443, 3777176393, 3526997432, 4160024901, 2799501432, 3189842362, 2895921538, 3523126711, 2584536943, 366572408, 2018527657, 2419052336, 1599338243, 1819583401, 1580299583, 2449157274, 2828818534, 1935069369, 3035347554, 2300460842, 1276618247, 444241466, 1471645757, 1814217055, 300052797, 978115125, 2374058518, 698273132, 1214717679, 1166470439, 718216169, 3181066945, 3277899759, 3647642382, 707937401, 3769885322, 194272089, 3997032976, 70224747, 2978517089, 2977707424, 834875136, 3332391283, 1488718686, 130069962, 253262344, 1769464890, 2319430631, 189540515, 2841335982, 2862788699, 1299593078, 2]def ln10_bits() -> U32: 2400# floor(2 / pi * 2^3600)def two_over_pi() -> List<&2, U32>: [507726408, 2964189929, 1536095615, 2197899395, 321806866, 1541412916, 396828147, 2111852736, 383977675, 3794979526, 2250788184, 673370856, 1486003166, 3726040635, 3560922583, 4010358380, 3219574212, 2313695840, 2125948194, 4222408831, 1633130823, 2674531942, 3457810225, 453702111, 1522081536, 2329289556, 3408077943, 993559719, 1237375446, 3876919126, 1666691194, 3614505084, 714957995, 2751231565, 1054283792, 3579131894, 3029837748, 1647541458, 2596707072, 2251125219, 804477, 1095576669, 3284321453, 347446553, 1127945670, 3581357360, 610990702, 563117180, 2132641777, 523619058, 1593351994, 653224734, 2109457213, 3729758258, 870855362, 117784446, 87991807, 1154570009, 480697775, 3296103318, 153781081, 1741544680, 1204033987, 2076216427, 2831769826, 358009459, 657524230, 3632287091, 1749061119, 2237600928, 453535129, 2439077606, 907913699, 3156253428, 1806430415, 809958523, 1560827395, 1605443469, 2464836603, 972524114, 4051385607, 3133664229, 3928847655, 1063689823, 163008326, 2127505355, 1830776118, 294345226, 2551181103, 2550128133, 674963448, 1602993657, 972332164, 3594093395, 2118203793, 1881584735, 1149561244, 905260731, 2805917826, 3944526121, 2451373597, 787089873, 3537897033, 1849311821, 3311515428, 1672208059, 2420244049, 2509847619, 3720403810, 1473377588, 355073063, 2205044292, 41721]def two_over_pi_bits() -> U32: 3600