|
|
|
|
|
by Dylan16807
600 days ago
|
|
The specific type of conversion is one I don't see as a big issue. The programmer deliberately decided to use an imprecise data type for the calculation. But more importantly, I'm saying that the problematic rounding can occur even if your tower does not have both bigint and float. It can happen even if every layer can completely represent every value of the layer above it. Do you have any complaints that are unique to a tower that has both bigint and float, and don't apply to towers that only have float? To elaborate on that, an implicit cast directly from a single bigint to a single float won't happen with the rules in the wikipedia article. You'd have to do something like bigint+float, which can have horrible rounding errors, but those horrible rounding errors are also present in float+float. And you can even have these problems without a tower. So I don't see how the bigint and float scenario is an argument against towers. |
|
But no programming language can have "Reals" (they aren't computable), so floats are a common/useful approximation. And in actuality `bigint?` doesn't imply `floating?`, and `floating?` doesn't imply `bigint?`. Neither is a strict subset of the other, and because of this you can easily find examples where implicit conversion does something "questionable". You've made it about rounding errors, but I'm trying to criticize something about pretending they are subtypes/subsets. Claiming it's a tower and hand waving about exact/inexact doesn't make it a tower, and so I think implicit conversion for these is a poor choice.
You can have little subset relations for implicit conversions:
Since this is supposedly in a discussion about JavaScript, maybe even: All of those relate true subsets for the collection of values they can represent, but it's not much of a tower. It's more a collection of DAGs.