logoalt Hacker News

FearNotDaniel • yesterday at 8:01 PM • 0 replies • view on HN

Exactly. If you want an actual decimal literal you should always write it as 1.2345m rather than converting it with the (decimal) prefix. The compiler refuses to accept a plain 1.2345 assigned to a decimal type so it’s not such a footgun as it may appear to some; though it might offer a better DX if the type of the literal was inferred from the thing you are trying to assign it to, that would no doubt have unintended consequences.