Skip to content

Commit 1cc77b0

Browse files
authored
Disable fast-math optimization (#105)
1 parent 181f870 commit 1cc77b0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ if(WIN32)
4747
"/DynamicBase "
4848
)
4949
string(CONCAT PRECISION_FLAGS
50-
"/fp:fast=2 "
50+
"/fp:precise "
5151
"/Qimf-precision=high "
5252
"/Qprotect-parens "
5353
)
5454
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox ${WARNING_FLAGS} ${SDL_FLAGS} ${PRECISION_FLAGS}")
5555
set(CMAKE_C_FLAGS_DEBUG
56-
"${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} ${SDL_FLAGS} -O0 -g1 -DDEBUG"
56+
"${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} ${SDL_FLAGS} /fp:precise -O0 -g1 -DDEBUG"
5757
)
5858
set(MKL_UMATH_LINKER_OPTIONS "LINKER:/NXCompat;LINKER:/DynamicBase")
5959
elseif(UNIX)
@@ -87,11 +87,11 @@ elseif(UNIX)
8787
string(CONCAT PRECISION_FLAGS
8888
"-fprotect-parens "
8989
"-fimf-precision=high "
90-
"-fp-model fast=2 "
90+
"-fno-fast-math "
9191
)
9292
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ${CFLAGS} ${PRECISION_FLAGS}")
9393
set(CMAKE_C_FLAGS_DEBUG
94-
"${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -g1 -DDEBUG"
94+
"${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -fno-fast-math -O0 -g1 -DDEBUG"
9595
)
9696
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types ${CFLAGS}")
9797
set(MKL_UMATH_LINKER_OPTIONS "LINKER:-z,noexecstack,-z,relro,-z,now")

conda-recipe/conda_build_config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ cxx_compiler: # [win]
1616
- vs2022 # [win]
1717
c_compiler: # [win]
1818
- vs2022 # [win]
19+
CFLAGS:
20+
- -fno-fast-math # [linux]
21+
CXXFLAGS:
22+
- -fno-fast-math # [linux]
23+
CL:
24+
- /fp:precise # [win]

0 commit comments

Comments
 (0)