Two mechanical errata in Mike Day, Generalising the Fast Reciprocal Square Root Algorithm (arXiv:2307.15600v1, 28 Jul 2023), surfaced while reproducing the paper's numbers. Verified by 2 robots and 1 human.
The paper prints
| kind | display_name | q | p_num | q_den | layer_dependent | min_depth | max_depth | tol | dyadic_bits | n_digits | split_counts | sequence | runs_at_max_depth | elapsed | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uniform_x | uniform | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [0, 2, 4, 4] | 1.0244 | 9 | 0.012370109558105469 | |
| geometric_x | geometric | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [1, 1, 2, 0] | 1.1120 | 2 | 0.0012631416320800781 | |
| harmonic_x | harmonic | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [2, 1, 1, 0] | 1.2110 | 2 | 0.0012788772583007812 | |
| mirror_harmonic_x | mirror-harmonic | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [2, 2, 1, 5] | 1.2215 | 11 | 0.0025589466094970703 | |
| ruler_x | ruler | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [0, 2, 5, 4] | 1.0254 | 7 | 0.0023572444915771484 | |
| sinusoidal_x | sinusoidal | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [1, 3, 2, 1] | 1.1321 | 3 | 0.0012438297271728516 | |
| chebyshev_x | chebyshev | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [1, 0, 0, 0] | 1.1000 | 2 | 0.0012700557708740234 | |
| thuemorse_x | thue-morse | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [0, 2, 2, 3] | 1.0223 | 7 | 0.0016057491302490234 | |
| bitrev_geometric_x | bitrev-geometric | 3 | 1 | 2 | False | 3 | 7 | 1e-10 | 20 | 4 | [1, 2, 1, 3] | 1.1213 | 7 | 0.0028460025787353516 |
| % Compact "happy path" for the classic FRSR exponent x^(-1/2), | |
| % from "Generalising the Fast Reciprocal Square Root Algorithm" | |
| % (arXiv:2307.15600). | |
| % 1. Pseudolog and inverse. | |
| % The IEEE-754 float bit-pattern of x approximately encodes log2(x). | |
| % Day's pseudolog makes that precise: | |
| % L(x) = floor(log2 x) + x * 2^{-floor(log2 x)} - 1. | |
| % It is piecewise linear on each octave [2^e, 2^(e+1)), agrees with log2 | |
| % at powers of two, and has an explicit inverse on each affine segment. |
macOS sandbox profiles used to be able to include a trace command that would write all the denied operations to a sandbox profile, allowing a profile to be iterativley built up. Apple removed that functionality for reasons explained below.
trace.sh examines the kernel log for the denied operations and creates the relevant allow rules in a sandbox profile, just like the sandbox profile trace command used to.
shrink.sh tries to reduce a sandbox profile to the minimum lines necessary.
It's very rough and ready at the moment (check the sed regex'es in the script to see what I mean) and needs more testing with a wider set of use cases.
| ## there are simpler ways to do this in R. See | |
| ## for example https://github.com/itchyny/fastinvsqrt/blob/main/src/r/fastinvsqrt.r | |
| ## contains a reasonable way to do this unreasonable thing. | |
| ## What follows is an unreasonable way to do an unreasonable thing. | |
| doubleTofloatBits <- function(x) { | |
| # Convert double to character in scientific notation | |
| x_char <- format(x, scientific = TRUE) | |
| # Parse the character representation |
| ### Compare original and adjusted values | |
| library(dplyr) | |
| library(ggplot2) | |
| library(latex2exp) | |
| ## blends from standard form to original Kadlec constants | |
| ## A = 0.70395 & B = 2.38924 | |
| original_kadlec_blend <- read.csv(text = " | |
| input,output,error,diff,iters,alpha |
| kadlec <- read.csv(text = " | |
| reference,kadlec,iters,error,input | |
| 1.189297,1.189539,1,0.000242,0.707000 | |
| 1.189297,1.162983,2,0.026314,0.707000 | |
| 1.189297,1.173180,3,0.016117,0.707000 | |
| 1.189297,1.169557,4,0.019740,0.707000 | |
| 1.189297,1.170886,5,0.018411,0.707000 | |
| 1.189297,1.170404,6,0.018893,0.707000 | |
| ") |
| // accepts a double and splits it, like KahanNg | |
| // See https://inbetweennames.net/blog/2021-05-06-i76rsqrt/ | |
| // for more details and the original recovered code (in C++) | |
| // It is different from KahanNg as it splits the double into | |
| // exponent and mantissa, whereas KahanNg splits it into | |
| // high 32 and low 32 bits | |
| double i76ISR(double x, int NR) { | |
| // Interstate76's lookup table generator | |
| // uint8_t LUT[256]; | |
| // void generateLUT(){ |
| ;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY | |
| ;by doppelganger (doppelheathen@gmail.com) | |
| ;This file is provided for your own use as-is. It will require the character rom data | |
| ;and an iNES file header to get it to work. | |
| ;There are so many people I have to thank for this, that taking all the credit for | |
| ;myself would be an unforgivable act of arrogance. Without their help this would | |
| ;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into | |
| ;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no |
| // c++ -O3 -o nanof2a nanof2a.cpp && ./nanof2a | |
| #include <cstdint> | |
| #include <cstring> | |
| namespace { // anonymous namespace to encourage inlining | |
| struct f2a { | |
| char str[16]; | |
| f2a(float f) { // example usage: printf("%s", f2a(f).str) |