IEEE 754-2008 | ISO/IEC TR 18037

Hi,

Does LLVM support decimal precision numbers supported? Also does it have Fixed point arithmetic?

S

LLVM does not support IEEE decimal-floating point.

If by “fixed point arithmetic” you are asking about associating a scale factor with a variable/value, and doing the correct scaling for arbitrary arithmetic… LLVM doesn’t do that either. It’s a rare IR that even has the concept. The OpenVMS GEM compilers supported it (along with other special features for COBOL), but I’m not aware of any others.

–paulr

Many thanks for getting back.

This will come in handy if you do not have a floating point unit. Also for speed in some cases.

To be generic as possible it might be good to have this.

BTW, in the doc I was reading there was not mention about Quad size numbers, decimal numbers and extended precision numbers. http://llvm.org/docs/LangRef.html#type-system

Also Q numbers format can be added for added precision.

Also Q numbers format can be added for added precision without rounding.

This will come in handy if you do not have a floating point unit. Also for
speed in some cases.

To be generic as possible it might be good to have this.

The goal isn't really maximum generality, but support for languages
that people care about. Currently that's mostly C and C++, with a
smattering of features for some others.

But features almost never get added speculatively. At the very least
someone needs to care enough to write a patch, and generally we want
to be reasonably sure that it'll be maintained.

BTW, in the doc I was reading there was not mention about Quad size numbers,
decimal numbers and extended precision numbers.
http://llvm.org/docs/LangRef.html#type-system

There appear to be numerous mentions of fp128 (which is IEEE
quad-precision), ppc_fp128 and x86_fp80 (at least one of which
probably qualifies as extended precision).

Of course, those types have much more limited support in the backends
than standard float and double. AArch64 should support fp128, and
obviously ppc and x86 for their specific formats.

Tim.

These features can find use in embedded micro controllers and situation where you do not want rounding errors. x86 and ppc sound like Intel and Power PC specific.

Of course once introduced some one must maintain it.

These features can find use in embedded micro controllers and situation where you do not want rounding errors. x86 and ppc sound like Intel and Power PC specific.

Of course once introduced some one must maintain it.

Not until someone comes up with a language specifying them (or at
least a highly suspect variant of C specifying them) they can't.

Tim.

Perhaps this can be used in DSLs if it is there.

I don’t see why you should wait for a language adaptation.

Perhaps you can add it to Clang as an extension.