Skip to content

Commit

Permalink
NLWriter: print -0 as 0 #30
Browse files Browse the repository at this point in the history
Discard usage of macro IEEE_8087 not set in MP
  • Loading branch information
Gleb Belov committed Jan 8, 2024
1 parent 690e9e7 commit d91b160
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ endif ()
# Build NLWriter2 example
if (BUILD_EXAMPLES)
message(STATUS
"Building NLWriter2 example. Set -DBUILD_EXAMPLES=off to switch off.")
"Building NLWriter2 examples. Set -DBUILD_EXAMPLES=off to switch off.")
set(NLW2_DIR nl-writer2)
add_subdirectory(${NLW2_DIR})
# Gather source files for docu
Expand Down
10 changes: 8 additions & 2 deletions nl-writer2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,19 @@ if (BUILD_EXAMPLES_NLW2) # Actually build the example
target_include_directories(nl-writer-example-cpp PUBLIC
${NLW2_INCLUDE_PATH})
target_link_libraries(nl-writer-example-cpp ${NLW2_LIB_NAME})
add_dependencies(nl-writer-example-cpp mp)
## if actually building mp. Otherwise make sure nl-opcodes.h has been generated
if (TARGET mp)
add_dependencies(nl-writer-example-cpp mp)
endif()

add_executable(nl-writer-example-c ${NLSOL_C_EX_FILES})
target_include_directories(nl-writer-example-c PUBLIC
${NLW2_INCLUDE_PATH})
target_link_libraries(nl-writer-example-c ${NLW2_C_API_LIB_NAME})
add_dependencies(nl-writer-example-c mp)
## if actually building mp. Otherwise make sure nl-opcodes.h has been generated
if (TARGET mp)
add_dependencies(nl-writer-example-c mp)
endif()
endif()


Expand Down
10 changes: 1 addition & 9 deletions nl-writer2/src/nl-writer2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,7 @@ g_fmt(char *b, double x, int prec)
char *b0, sbuf[400], *se;

b0 = b;
#if defined(_WIN32) || defined(_WIN64)
#ifdef IEEE_8087
if (!(((Long*)&x)[1] & 0x7fffffff | ((Long*)&x)[0])) {
#else
if (!(((Long*)&x)[0] & 0x7fffffff | ((Long*)&x)[1])) {
#endif /* IEEE_8087 */
#else /* _WIN32 || _WIN64 */
if (! x) {
#endif /*_WIN32 || _WIN64 */
if (! x) { // Report -0 as '0'
*b++ = '0';
*b = 0;
goto done;
Expand Down

0 comments on commit d91b160

Please sign in to comment.