This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Public Domain under http://unlicense.org, see link for details. | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <string.h> | |
#include "xmmintrin.h" | |
#include "wmmintrin.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if page.mathjax3 %} | |
<script> | |
window.MathJax = { | |
options: { | |
menuOptions: { | |
settings: { | |
zoom: "None", | |
zscale: "150%" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* -*- mode: c; -*- */ | |
// create primary range approximations of sin(pi x) and cos(pi x) for x on [-1/4,1/4] | |
// both for single and double precision | |
R = [0;1/4]; | |
T = floating; | |
E = relative; | |
B = [|24...|]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <inttypes.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include "gdef.h" | |
#include "swrite.h" | |
#include "bbattery.h" | |
#include "scomp.h" | |
#include "swalk.h" | |
#include "svaria.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <string.h> | |
inline uint32_t f32_to_bits(float x) | |
{ | |
uint32_t u; memcpy(&u, &x, 4); return u; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Mathematica source | |
same method as the previous gist for double. This validates that the constants giving here are optimal: | |
https://stackoverflow.com/questions/26692859/best-machine-optimized-polynomial-minimax-approximation-to-arctangent-on-1-1 | |
*) | |
(* round(Pi,48,RN) *) | |
s = 221069929750889 | |
(* prime factors of 's' and nearby integers *) | |
f0 = FactorInteger[s]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Pi correctly rounded to 106 digits via sollya: | |
> display=dyadic!; | |
> round(Pi,106,RN); | |
63719069007931157819013617823235b-104 | |
*) | |
s = 63719069007931157819013617823235 | |
(* prime factors of 's' and nearby integers *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SEE: https://lemire.me/blog/2019/03/19/the-fastest-conventional-random-number-generator-that-can-pass-big-crush/ | |
__uint128_t g_lehmer64_state; | |
uint64_t lehmer64() { | |
uint64_t r = (g_lehmer64_state >> 64); | |
g_lehmer64_state *= 0xda942042e4dd58b5; | |
return r; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Public Domain under http://unlicense.org, see link for details. | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <string.h> | |
#include "xmmintrin.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1 dep-chain (assuming state words in reg) to result. | |
// DON'T USE ME UNLESS YOUR PARINOID AND | |
// USING SOMETHING MORE EXPENSIVE (actually inferior | |
// to some other formulations...period is only 2^32-1) | |
// Zero is illegal for both state words. | |
typedef struct { uint32_t s[2]; } rng_state_t; | |
// smallcrush: passes | |
// crush: 1 systematic failure = 72 LinearComp, r = 29 |