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

feat: <REAL>_TRUNC_<INTEGER> library functions #1336

Closed
wants to merge 1 commit into from
Closed

Conversation

volsa
Copy link
Member

@volsa volsa commented Oct 15, 2024

This commit introduces the <REAL>_TRUNC_<INTEGER> library functions, which under the hood use the compilers built-in implicit conversion feature.

This commit introduces the `<REAL>_TRUNC_<INTEGER>` library functions,
which under the hood use the compilers built-in implicit conversion feature.
Comment on lines +8 to +16
types_to = [
"SINT",
"USINT",
"INT",
"UINT",
"DINT",
"UDINT",
"LINT",
"ULINT",
Copy link
Member Author

@volsa volsa Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing BOOL(?), BYTE, WORD, DWORD and LWORD?
The standard defines ANY_INT, i.e. (U)SINT, (U)INT, (U)DINT, (U)LINT

@@ -0,0 +1,19 @@
// RUN: (%COMPILE %s && %RUN) | %CHECK %s
FUNCTION main
printf('%d$N', REAL_TRUNC_SINT(4.9)); // CHECK: 4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing printf('%d$N', LREAL_TRUNC_REAL(4.9)); // CHECK: 4; there might be a bug here because the CHECK expects some random big number like -2124880280

@volsa volsa changed the title feat: Introduce <REAL>_TRUNC_<INTEGER> feat: Introduce <REAL>_TRUNC_<INTEGER> library functions Oct 15, 2024
@volsa volsa changed the title feat: Introduce <REAL>_TRUNC_<INTEGER> library functions feat: <REAL>_TRUNC_<INTEGER> library functions Oct 16, 2024
@volsa volsa closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant