Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic types support for IEEE 754 decimal32, decimal64 and decimal128 #1451

Open
id3nom opened this issue Sep 16, 2024 · 7 comments
Open
Labels
Enhancement Request New feature or request

Comments

@id3nom
Copy link
Contributor

id3nom commented Sep 16, 2024

I propose to use the dec32, dec64 and dec128 type names.

It would ease financial application development.
It would simplify database interop using the SQL DECIMAL type.

@id3nom id3nom changed the title Add basic types support for IEEE decimal32, decimal64 and decimal128 Add basic types support for IEEE 754 decimal32, decimal64 and decimal128 Sep 16, 2024
@id3nom
Copy link
Contributor Author

id3nom commented Sep 16, 2024

We could do the integration like for the i128 type and when LLVM officialy release the IEEE 754 implementation replaced our implementation with LLVM's one.

Additional information for LLVM integration?

https://discourse.llvm.org/t/rfc-decimal-floating-point-support-iso-iec-ts-18661-2-and-c23/62152
https://github.com/tahonermann/llvm-project

@lerno
Copy link
Collaborator

lerno commented Sep 16, 2024

The question is: how bad would the experience be if this was implemented as user land types. I HAVE thought of it, but the fact that it's not often used in the languages that have it is sort of off-putting.

@id3nom
Copy link
Contributor Author

id3nom commented Sep 16, 2024

In user land we would lost, implicit/explicit cast, and arithmetic operators support.
And when the decimal types are gonna be available in LLVM, code using the user land type will need to be modified,
Or we stick with the user land code and go forward with it?

@id3nom
Copy link
Contributor Author

id3nom commented Sep 16, 2024

Would be nice to have a C3 interface like e.g.: IntegerType, FloatType, ..., that would allow a type to be defined with cast and arithmetic defined functions, and when the interface is implemented in a user type it would gives the same usage as the basic types.

@lerno lerno added the Enhancement Request New feature or request label Sep 16, 2024
@lerno
Copy link
Collaborator

lerno commented Sep 16, 2024

Would be nice to have a C3 interface like e.g.: IntegerType, FloatType, ...,

I've looked at this and it's a surprisingly big feature. If you have any detailed proposal I am definitely willing to look at it.

@id3nom
Copy link
Contributor Author

id3nom commented Sep 18, 2024

Would be nice to have a C3 interface like e.g.: IntegerType, FloatType, ...,

I've looked at this and it's a surprisingly big feature. If you have any detailed proposal I am definitely willing to look at it.

I will work on a proposal this week. do you prefer that I post it in the Discussions >> Ideas section?

@lerno
Copy link
Collaborator

lerno commented Sep 18, 2024

That works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants