|Do you know where your variables are?|
I know it's confusing
I don't find it so.
But if you stuff a number with more than 15 decimals into a double you'll have loss anyway.
One thing I can guarantee is that if you limit yourself to 15 decimal digits, you will experience the loss of not being able to assign the full range of "double" values.
As an example:
Between 0x1.6a...c3d and 0x1.6a...c6a there exists 45 doubles with distinct, precise values. (c6a - c3d == 2d == 45 in base 10)
But you can't assign to any of those 45 values if you limit yourself to assigning 15-digit values. (For some of those values 16 digits will suffice, but you'll never need more than 17 digits.)
Also, for each of those 45 values, perl will output that they are either 1.41421356237312 or 1.41421356237313.
That's 45 precise, distinct, unique values - for which perl will display only 2 values.
Perl is making itself look ridiculous for the sake of saving 2 digits of precision.
And I doubt it's better in JS or python
Python2 was crap, but python3 (as I've already mentioned in this thread) is exemplary:
Python3 will always output the minimum number of decimal digits needed to preserve the uniqueness of the given value. And, last time I checked, raku was outputting exactly the same as python3 - for "doubles", anyway.