index | About author | Code speed

Parentheses accuracy. Started 7/20/2024.

I recently had in a Ruby program that with some extra parentheses values were within about 1 of actual value. I removed extra parentheses and values were within 1e-7 or less (1e-8 for example) of actual value. This goes to show that not only does being minimalist save your computer having to process all that extra stuff but also that being minimalist can improve accuracy. Follow code conventions and have minimal everything to do whatever task well. This accuracy thing may be because computers have limited precision and with each parenthesis set it computes value inside to maximum accuracy it can then proceeds to operate continuing on that possibly not accurate value. With more parentheses you are likely to make things less accurate, it may improve readability but really, a difference of like 1e-7 or 1.0 is major. Consider being minimal with your parentheses and maybe other groupings.

X E.