Re:Show HN: A Mathematical Integration rust crate
by two_handfuls on Tuesday November 19, 2024 @11:19AM
(#42185117)
Probably but that would slow down compilation a lot.
[ Parent
| on HN ]
Re:Show HN: A Mathematical Integration rust crate
by simlevesque on Tuesday November 19, 2024 @01:06PM
(#42186409)
Exactly, it's not like the constants are gonna change.
Re:Show HN: A Mathematical Integration rust crate
by blharr on Tuesday November 19, 2024 @01:32PM
(#42186665)
You wouldn't have to recompile them every time. What if you didn't necessarily use macros but auto-generated it in a file that you keep separate from the other code at the bottom?
Re:Show HN: A Mathematical Integration rust crate
by dataflow on Tuesday November 19, 2024 @08:52PM
(#42190112)
What I would do in these cases is to define the general computation function, but special-case it to return the hard-coded value for specific common inputs if it's being evaluated at compile time. Then add a test to verify both behaviors.