3 ms·
Due to the nature of C# math generics, it could theoretically be any size that is supported during runtime. If I add support for 512-bit integers to the languag
by kittoes 3y ago
Due to the nature of C# math generics, it could theoretically be any size that is supported during runtime. If I add support for 512-bit integers to the language and implement the appropriate interface, then this function should "just work". It currently doesn't only due to the fact that I'm hard-coding the constants instead of calculating them. I do indeed want a replacement for "BigDecimal" in this specific context because we don't actually need to do arbitrary arithmetic, we need to be able to generate the digits of (1 - SQRT(0.5)) and then transform them.
- pestatije 3y agoright, im not a maths guy but id go for the BigInteger way, or if speed was paramount id build a lookup table for the expected values of T. That link in your question also points to the algo for sqrt(x), should be possible to optimize for 1-sqrt(1/2) but as i said im not into maths