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

Fix GDL Convert() internal function for compatibility with ARM64 #1949

Conversation

GillesDuvert
Copy link
Contributor

@GillesDuvert GillesDuvert commented Dec 15, 2024

PRINT, PRINTF, STRING, STRTRIM, all formats ... depend on C/C++ casting to different types.
This PR modifies the Convert() function to get similar results on X86_64 and AARCH64 (ARM64, M1,M2...) when needed (conversion of a float/double towards unsigned integer types)
This to solve 99% of #1881 , #1877 and #1842 but see #1948

Besides, snprintf format was 'i' and not 'u' in Ulong and Uint --- this made for error #1874

Addditionnally it was found that multithreading in Convert() may have been wrongly activated during some conversions, the code now checks GDL_NTHREADS value everywhere (?). Could potentially speedup things.

…or error gnudatalanguage#1874

Addditionnally it was found that multithreading may have been wrongly activated during those conversions to string, the code now checks GDL_NTHREADS value.
…nes.

enables arm64 for test_byte_conversion, test_bytscl and test_formats
removed printing and comparison of NaN and Inf formats by default in test_formats (use option /with_nans added to GENERATE_FORMAT_FILE for that)
@GillesDuvert GillesDuvert changed the title Fix wrong values returned by STRING and STRTRIM for large ULONG values Fix GDL Convert() internal function for compatibility with ARM64 Dec 15, 2024
@GillesDuvert
Copy link
Contributor Author

As a result, test_byte_conversion, test_bytscl and test_formats were reenabled for ARM64 machines.
Strangely, these test continue to fail on macos-15 on GH, but they pass OK on a arm64+macos-15 machine I have access. So I deem the PR to be OK.

@GillesDuvert
Copy link
Contributor Author

One thing that will NOT be the same is related to Infinity and NaN conversion to integer, that cannot be solved easily.

@GillesDuvert GillesDuvert merged commit 2990fa2 into gnudatalanguage:master Dec 15, 2024
6 of 7 checks passed
@GillesDuvert GillesDuvert deleted the close_1874_Ulong_and_Uint_StringConversionWrong branch December 16, 2024 12:56
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