Skip to content

Conversation

@jamesjer
Copy link
Contributor

@jamesjer jamesjer commented Dec 3, 2025

Define IEEE_MC68k instead of IEEE_8087 on big endian architectures.

Fixes #183. All tests pass on s390x with this patch. The unconditional #define IEEE_8087 does not seem to be present in the AMPL ASL git repository, so it appears to be a SCIP addition. You might prefer to remove that addition, and instead use cmake to add either -DIEEE_8087 or -DIEEE_MC68k to the build flags.

Define IEEE_MC68k instead of IEEE_8087 on big endian architectures.
@jamesjer
Copy link
Contributor Author

jamesjer commented Dec 3, 2025

The other approach I mentioned would look like this. Let me know if you prefer that approach and I will update this PR.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c6ce72830c..9892c9776c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,6 +12,12 @@ set(CMAKE_C_STANDARD 99)
 set(CMAKE_C_STANDARD_REQUIRED on)
 set(CMAKE_C_EXTENSIONS OFF)
 
+if(CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIEEE_MC68k")
+else()
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIEEE_8087")
+endif()
+
 if(NOT WIN32)
     set(SCIP_COMP_OPTIONS ${SCIP_COMP_OPTIONS} "$<$<COMPILE_LANGUAGE:C>:-D_XOPEN_SOURCE=600>")
 endif()
diff --git a/src/amplmp/src/dtoa.cpp b/src/amplmp/src/dtoa.cpp
index 3386cea500..9c064d308a 100644
--- a/src/amplmp/src/dtoa.cpp
+++ b/src/amplmp/src/dtoa.cpp
@@ -349,8 +349,6 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
 extern "C" {
 #endif
 
-#define IEEE_8087
-#define IEEE_Arith
 #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
 Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
 #endif

@svigerske svigerske self-assigned this Dec 4, 2025
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.

SCIP 10 NL writer endian issue

2 participants