Draft: Generalized numeric type#5
Open
walseb wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello!
I recently needed to use this library again. However, my game simulation is entirely deterministic, while this library isn't entirely deterministic because it uses the type Double everywhere, which is prone to device-dependent floating-point errors.
Instead, I wanted to use a softfloat for the computations, to ensure all collisions are deterministic. I thought I might as well generalize the numeric type used in this library. So far in this PR I have only done this to the code, not the tests or documentation.
Do you think it's a good idea to merge something like this into this repo? There are some downsides to doing this like increased type signature complexity I suppose. It also could impact performance I think? I think the Geomancy library explicitly chose to not generalize for performance purposes, but I don't know a whole lot on this subject.
Regarding performance, we should probably inline a lot of this code. I might look into that later when I'm able to compare how inlining affects performance.
I haven't had time to test these changes yet, so it's only a draft for now.
Thanks for writing this library!