James Cloos:
If so, please use something compatable with ieee 754 decimal floats, so
that they can be used when running on hardware which supports them.

Even w/o such hardware, gcc (at least) has support for software
emulation of _Decimal32 and _Decimal64 (and _Decimal128?).
I think there are different ways to go.
The traditional fixed byte length numbers like float32, float64, int16,
int32, int64 etc. that
are quite common in most programming languages.  But especially for
integers, where it
makes most sense, it has become popular to have arbitrary length integers.

Using something like decimal32 or decimal64 fits into this fixed byte
length world and is
quite useful for many things without doubt.  BigDecimal in Java and
LongDecimal for Ruby
tend to go the other way, so they basically combine an arbitrary length
integer with some
additional information to make it a LongDecimal or BigDecimal or so, so
they are not
compatible with ieee 754, but they allow the int part to grow to
arbitrary size.

Both ways are possible and usually one would expect to find them in
addon libraries (perl-modules
in our context here).

Going for such a type by default would require to integrate it into the
language.  But there
might be some concerns for going this direction instead of good old
float.  One side of the
story is that float is way better in terms of performance, because it
has been implemented in most
common hardware for about 20 years now (and decent hardware
implementations have been around
much longer than that), so the hardware implementation should be mature and
well optimized.  On the other hand people are used to the behaviour of
float and use decimal
types where some kind of explicit control is needed, like in finance
applications.

Best regards,

Karl


Reply via email to