by bazoom42 · 2w ago · 0 comments
Then you dont need the cast and there is no problem with hidden roundings.
I know. It shouldn't be.
If practical, I'd give it either infinite precision or the type of whatever variable it's being stored into.
If that doesn't work and it has to be a specific type in all cases, making it a special decimal that converts to double without a warning would be a better baseline.
The bottom line is you need to know if you are using a decimal or a double. If you think suffix-less literals are confusing, just make it a rule to always use a suffix.
Why is double the default for suffix-less numbers? Probably because it is a standard floating point type supported by all processors and languages. Seems like a reasonable default.