3 ms·
It's a tricky case because they do provide the `big""` macros for literals, and mention in BigFloat's docs that: BigFloat(x::AbstractString) is identical
by sundarurfriend 3y ago
It's a tricky case because they do provide the `big""` macros for literals, and mention in BigFloat's docs that:
BigFloat(x::AbstractString) is identical to parse. This is provided for convenience since decimal literals are converted to
Float64 when parsed, so BigFloat(2.1) may not yield what you expect.
...
Examples
≡≡≡≡≡≡≡≡≡≡
julia> BigFloat(2.1) # 2.1 here is a Float64
2.100000000000000088817841970012523233890533447265625
However, saying RTFM is not a solution, especially for not-too-frequent parts of the language like BigFloats. It's still a trap many people are going to fall for.
The solution here is a good linter though, not adding more work to the already overstressed compiler. It comes back to the issue of Julia needing more mature, easy-to-work-with tooling, that could say "hey, this is technically allowed, but you probably didn't mean this".