Could SWI-Prolog have or need decimals?

I noticed that I am currently facinated by decimals. So
not to polute the other thread, here a collection what came
to my mind so far, and what I could find:

In Java they mainly bundle the Java class BigDecimal because
of their java.sql JDBC adapter. The class delivers CR_XXX
functionality, you have a couple of rounding modes available,

and can do arithmetic just like crlibm. Whats not provided
is trigonometry etc… i.e. functions above the basic operations.
It has also a flexible mode for some basic operations, where no

precision needs to be specified, and where precision can grow,
like for example these two rules, I have sketeched them a little
simplfied, since for addition the place of the period is also important:

precision(a+b) = max(precision(a), precision(b))
precision(a*b) = precision(a)+precision(b)

Having binary p=52 not fixed requires possibly a slightly different
. What should the architectual decision be? Some new
flag for the precision? What if a database row has columns from

a diversity of precisions? Anyway its amazing, that the most demand
for flexible precision comes from the commercial domain, and not
from some computation in physics, chemistry, etc…

Edit 22.10.2022
BTW: Here you see an alternative to rational/1. It is based
on the observation that 1/2^n has a finite decimal expansion.
You can check yourself, it grows more and more but you can

prove that it terminates for each n:

?- between(1,5,N), X is 1/2^N, write(N), write(': '),
write(X), nl, fail; true.
1: 0.5
2: 0.25
3: 0.125
4: 0.0625
5: 0.03125

So you can use this to convert a binary floating point value into
a decimal, and this conversion is exact, just like the rational
conversion. Here you see two binary floating point values near

to each other, exactly decimal expanded to their maximum
needed digits to identify them in a decimal system, after
this expansion, digits going farther than what is shown,

only zeros in the digits:

/* Binary Floating Point Value from f64 */
?- X is decimal(1.4262129449486016).
X = 0d1.42621294494860162416216553538106381893157958984375.

?- X is decimal(1.4262129449486018).
X = 0d1.4262129449486018462067704604123719036579132080078125.

Problem is you cannot convert rational numbers like this,
there is no way rational to radix=10 always. But you have a bridge
between radix=2 → radix=10. But also the other way doesn’t

work exact radix=10 → radix=2, since 1/5 is not exact in
radix=2 with finite amount of binary digits. So rational numbers
are a quite amazing middle ground. If some floating point

values F2 have radix=2 and some floating point values F10 have
radix=10, then we have both F2 ⊆ Q and F10 ⊆ Q, where Q
are the rational numbers. But the reverse direction doesn’t work,

we have neither Q ⊆ F2 nor Q ⊆ F10, even if we look at arbitrary
but finite precision. And the only bridge is, we have F2 ⊆ F10 if
we look at arbitrary but finite precision, but not F10 ⊆ F2.