News for hackers. Stuff that matters.
Re:Writing a Minecraft server from scratch in Bash (2022) by BearOso on Saturday March 02, 2024 @11:25AM (#39573575)
A negative power, i.e. 2^(-n) is just 1/(2^n). I'm surprised the author didn't remember that with their own 2^-1 = 0.5 example and eventually reached out to awk for it.
Re:Writing a Minecraft server from scratch in Bash (2022) by tryauuum on Saturday March 02, 2024 @04:36PM (#39575985)
I don't understand how this would help the author. Since the bash doesn't support floating point numbers anyway
Re:Writing a Minecraft server from scratch in Bash (2022) by anthk on Sunday March 03, 2024 @09:01AM (#39580879)
This. Also, gawk has netwoki support, so you can write an mc server with just gawk.
Re:Writing a Minecraft server from scratch in Bash (2022) by BearOso on Sunday March 03, 2024 @11:29AM (#39581882)
I had the same thought. bc would have been a lighter choice.

And tryauuum, I think the author only needed powers of two to emulate floating point in the first place. So they could just divide said number by 2 a number of times.