Compiler Explorer and 128 bit math

To the curious, exploring int128 C compiler math to the final code: https://godbolt.org/g/JGVb1h

And to play with Quad’s, read this: https://gcc.gnu.org/onlinedocs/libquadmath.pdf

Well, I considered to make a plugin for this some time ago, but than went with a big number library, which works cross platform.
The gcc extensions are probably limited to gcc unless it becomes standard and Visual Studio also implements it.

And for Decimal data types: http://speleotrove.com/decimal/decnumber.html

So we could have a DecQuad too.

Well, if there is a need, I could wrap that in a plugin…

Forget GCC Christian, this playground is just to see a “how to” and explore already done source codes.

I appreciate your plugins, but I am talking about missing data types, those which should work out of box like:

Dim i128 As Int128 = 12416287346197826397461972361
Dim q As Quad = 1273461976237461237641623.99999991234123
Dim dq As DecQuad = 9352638762634756283.999923

You can write feedback cases for Xojo to add 128bit integer data type.

I know. Me too. Or I could use another language to solve things, but I prefer basic data types supported IN the language. :smiley:

I already have one request in feedback for a Quad datatype few years ago. fp128 and more are in LLVM. They know about extended math we have in other languages.

Not when you have the sources…

https://github.com/gcc-mirror/gcc/tree/master/libdecnumber
https://github.com/gcc-mirror/gcc/tree/master/libquadmath

The problem with extended precision add-on packages is that they tend to run very slowly. In most cases when you need extended precision, you also need speed. Rick started a feature request feedback case asking for Xojo to support 128 bit floating point natively. Would be nice if others would give it their vote.
<https://xojo.com/issue/38472>

I think that we could be selective here and these datatypes would be available only for 64bit+ targets and causing a compiler error like “64bit+ platform only datatype” with wrong/below targets. Let’s be real, 32 bit targets, all of them, or are dead or are dying, from desktop to cell phones, from Intel to ARM. I intend to stop writing/supporting 32bit things in 2 years (2020).

I asked time ago to have a Decimal data type for fixed point math. This would permit to overcome the Currency datatype limitations in size (and bugs). Then you went with the BigNumber stuff, which is IMHO not well suited as a substitute for Decimal.
So again, having a Decimal with fixed point would be very useful :wink: