Hi Mike,
When dealing with a fractional representation of a number having
numerator and denominator,
the system would have to find the greatest common factor (of numerator
and denominator) to represent a number uniquely (when comparing).
For addition you would have to make the denominators equal.
So having this kind of type would require a bit more computing than a
decimal number where the denominator is fixed to be 10.
The only upside would be the ability to represent 1/3 (and similar
numbers that can only be represented as repeating decimals) exactly but
if you now have 64 bit integer to represent a decimal then you would
need a lot of precision before noticing any practical difference.
Furthermore you could have even more precision using larger integers
than long (eg. java's BigInteger).
Of course in mathematics you might have uses for fractional representation.
In which problem area do you have a need for absolute precision?
And finally we would still be unable to represent the irrational numbers
exactly.
What kind of representation would work for all real numbers?
Just curious.
- Rami
On 7.8.2020 18.38, Mike Goodwin wrote:
What do you see as the driver for having the field be a column
type? Have you looked into H2 function support?
Hi Matt,
Mostly just selfish reasons, but I do think there is a sound
engineering/computer science basis for having another numeric type.
Decimal types are arbitrary for computation, and we allow unlimited
precision for decimal numbers (I guess in practice they round before
too long). It is to avoid unnecessary rounding and wrinkles.
I do think we tend to paper over these kind of issues in our industry
and as a consequence end up with mediocre standards such as SQL. The
strength of 'SQL' databases is the relational model not SQL. In
anycase virtually all databases don't conform and have their own
superset of functionality.
- mike
--
You received this message because you are subscribed to the Google
Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to h2-database+unsubscr...@googlegroups.com
<mailto:h2-database+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/CAOZwqwnhFnB8-Zny1CcK4G%2By3wduZWkMR%3DOC3ybvLSrag8kS5g%40mail.gmail.com
<https://groups.google.com/d/msgid/h2-database/CAOZwqwnhFnB8-Zny1CcK4G%2By3wduZWkMR%3DOC3ybvLSrag8kS5g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/84bf5a41-0759-9654-6e7c-58be60eb0bc9%40gmail.com.