Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-08

Question about Word128

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Aelita

Hello!

My name is Aelita and for many years I have been fruitfully using your wonderful freepascal for my research in algebra, geometry and physics.
Thank you for your inspirational work!

I'm very interested in seeing the numbers Word128 and Int128 appear in freepascal (with natural operations A*B, A div B, A mod B, A xor B, A shl N, etc.)!

Is there a chance that this will happen in the near future?

Thanks again,
Aelita

С уважением, Aelita

Reply by email

Sven Barth
to Aelita

Aelita schrieb am Di., 7. Aug. 2018, 09:53:

Show quoted text 13 lines
Hello! My name is Aelita and for many years I have been fruitfully using your wonderful freepascal for my research in algebra, geometry and physics. Thank you for your inspirational work! I'm very interested in seeing the numbers Word128 and Int128 appear in freepascal (with natural operations A*B, A div B, A mod B, A xor B, A shl N, etc.)! Is there a chance that this will happen in the near future?

Using records and operator overloading you can implement them yourself. No need to burden the compiler with it. The only disadvantage would be the inability to use that large literals... but that could be helped a bit with conversions from floating points,at least if full accuracy isn't required.

Regards,
Sven

Reply by email

J. Gareth Moreton

I think there was talk at one point about implementing Float128 (or "Quadruple") for Free Pascal, mostly for internal compiler purposes.  For OWords though (or is it EWords or DQWords?) I think a library or package will be better initially.  Still, it might be something to consider if Intel or another processor manufacturer introduce 128-bit number functions for XMM registers and equivalent.

Gareth aka. Kit

On Tue 07/08/18 10:09 , Sven Barth via fpc-devel
sent:
Aelita schrieb am Di., 7. Aug. 2018, 09:53:
Hello!

My name is Aelita and for many years I have been fruitfully using your wonderful freepascal
for my research in algebra, geometry and physics.
Thank you for your inspirational work!

I'm very interested in seeing the numbers Word128 and Int128 appear in freepascal
(with natural operations A*B, A div B, A mod B, A xor B, A shl N, etc.)!

Is there a chance that this will happen in the near future?

Using records and operator overloading you can implement them yourself. No need to burden the compiler with it. The only disadvantage would be the inability to use that large literals... but that could be helped a bit with conversions from floating points,at least if full accuracy isn't required. 
Regards,  Sven  _______________________________________________

Reply by email

Kirinn
to J. Gareth Moreton

To be clear, 128-bit octawords and the like are not natively supported on most consumer-oriented processors. To support 128-bit operations, an extensive emulation layer would need to be set up, not an easy task within the scope of a compiler and the RTL.

If you need 128-bit integer maths in the near future, your best bet would be to write a quick and dirty implementation yourself with records and operator overloading, as Sven described. Has anyone done that yet? It might make an interesting unit for the Free Component Library or something.

I note that SysUtils includes an "Int128Rec", which is a record type for holding a 128-bit int. Looks like it's currently used only by InterlockedCompareExchange128. Someone brave could expand upon that.

~Kirinn

J. Gareth Moreton wrote 51 lines
I think there was talk at one point about implementing Float128 (or "Quadruple") for Free Pascal, mostly for internal compiler purposes.  For OWords though (or is it EWords or DQWords?) I think a library or package will be better initially.  Still, it might be something to consider if Intel or another processor manufacturer introduce 128-bit number functions for XMM registers and equivalent. Gareth aka. Kit On Tue 07/08/18 10:09 , Sven Barth via fpc-devel sent: Aelita < > schrieb am Di., 7. Aug. 2018, 09:53: Hello! My name is Aelita and for many years I have been fruitfully using your wonderful freepascal for my research in algebra, geometry and physics. Thank you for your inspirational work! I'm very interested in seeing the numbers Word128 and Int128 appear in freepascal (with natural operations A*B, A div B, A mod B, A xor B, A shl N, etc.)! Is there a chance that this will happen in the near future? Using records and operator overloading you can implement them yourself. No need to burden the compiler with it. The only disadvantage would be the inability to use that large literals... but that could be helped a bit with conversions from floating points,at least if full accuracy isn't required. Regards, Sven _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel <%3Ca%20href=>">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth Moreton

I'll happily give it a shot, so long as I don't give myself too many side-projects that I forget more important things!

Gareth aka. Kit

On Tue 07/08/18 22:06 , Kirinn sent:

To be clear, 128-bit octawords and the like are not natively supported on most consumer-oriented processors. To support 128-bit operations, an extensive emulation layer would need to be set up, not an easy task within the scope of a compiler and the RTL.

If you need 128-bit integer maths in the near future, your best bet would be to write a quick and dirty implementation yourself with records and operator overloading, as Sven described. Has anyone done that yet? It might make an interesting unit for the Free Component Library or something.

I note that SysUtils includes an "Int128Rec", which is a record type for holding a 128-bit int. Looks like it's currently used only by InterlockedCompareExchange128. Someone brave could expand upon that.

~Kirinn

On 08/07/2018 03:11 PM, J. Gareth Moreton wrote:
I think there was talk at one point about implementing Float128 (or "Quadruple") for Free Pascal, mostly for internal compiler purposes.  For OWords though (or is it EWords or DQWords?) I think a library or package will be better initially.  Still, it might be something to consider if Intel or another processor manufacturer introduce 128-bit number functions for XMM registers and equivalent.

Gareth aka. Kit

On Tue 07/08/18 10:09 , Sven Barth via fpc-devel
[1] sent:
Aelita schrieb am Di., 7. Aug. 2018, 09:53:
Hello!

My name is Aelita and for many years I have been fruitfully using your wonderful freepascal
for my research in algebra, geometry and physics.
Thank you for your inspirational work!

I'm very interested in seeing the numbers Word128 and Int128 appear in freepascal
(with natural operations A*B, A div B, A mod B, A xor B, A shl N, etc.)!

Is there a chance that this will happen in the near future?

Using records and operator overloading you can implement them yourself. No need to burden the compiler with it. The only disadvantage would be the inability to use that large literals... but that could be helped a bit with conversions from floating points,at least if full accuracy isn't required. 
Regards,  Sven  _______________________________________________

Reply by email