Get the latest tech news
Nix Trigonometric Math Library from Ground Zero
(Title image sourced from: Wikipedia - Trigonometry) Why I wanted to calculate the network latency between all my VPS nodes, and add the latency into the configuration file of Bird BGP daemon, so the network packets are forwarded through the lowest latency route. However, I have 17 nodes as of today, and I didn't want to manually run a ping command between each pair.
This means that their reference count is 0, and will be immediately garbage collected with nixos-collect-garbage -d. Next time I want to build my config, it needs another 22.5s to calculate all of them again. We can implement Newtonian square root calculation in Nix with the following code, and iterate until the change in result is below epsilon: I finally reached the target I was aiming for: calculate the theoretical network latency between my nodes based on the light speed.
Or read this on Hacker News