Skip to content

Draft: Generalized numeric type#5

Open
walseb wants to merge 1 commit into
zaidan:masterfrom
walseb:master
Open

Draft: Generalized numeric type#5
walseb wants to merge 1 commit into
zaidan:masterfrom
walseb:master

Conversation

@walseb

@walseb walseb commented Nov 30, 2025

Copy link
Copy Markdown

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant