factoriolib / flib

A set of high-quality, commonly-used utilities for creating Factorio mods.
https://mods.factorio.com/mod/flib
MIT License
61 stars 15 forks source link

Some math additions. #39

Closed Nexela closed 2 years ago

Nexela commented 2 years ago

See changelog for a list.

raiguard commented 2 years ago

Honestly, I like the distinction between round and round_to more than combining the functions. It makes it very clear that you're using one or the other, whereas rounded is much less clear. Same applies for ceil and floor.

Additionally degrees and radians are much less clear than rad_to_deg and deg_to_rad.

The tests are pretty cool though!

Nexela commented 2 years ago

Round is still the same round.

ceiled/floored are open to better names. I would have used ceil_to/floor_to but those are used by the more ineffiecent versions and would be a breaking change for anyone using them. If it wasn't so much overhead involved the best thing to do would be to swap ceil/floor.

I will probably throw the tests back up once I get it to run reliably without a janky setup (I think I am almost there) and can get some setup instructions going. I was going to go with busted as it is a much better suite but luaunit has a mostly working vscode sidebar plugin...... and the in depthness of busted probably isn't needed.