Skip to content

Commit

Permalink
Added #pragma STDC FP_CONTRACT OFF
Browse files Browse the repository at this point in the history
Apparently, Apple's ARM compilers default to using FMA for expressions
like a * b - c * d, which causes undesirable results in Free42 and
Plus42. Specifically, (pi-pi*i)*(pi-pi*i) was producing a result with
nonzero real part in the binary builds.
Note that the x86_64 builds, iOS and MacOS, were not affected, and
neither were the Android, Linux and Windows builds.
I'm adding a #pragma to turn off this optimization, rather than the
-ffp-contract=off command-line option, so I won't have to deal with
making this change in all projects and makefiles, and having to keep
track of which compilers need it and which ones don't.
  • Loading branch information
thomasokken committed Feb 27, 2025
1 parent 517047e commit e37d203
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/free42.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#define int8 long long
#define uint8 unsigned long long

#pragma STDC FP_CONTRACT OFF

#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
/* I have tested big-endian state file compatibility in Fedora 12
* running on qemu-system-ppc. I found that I needed to explicitly
Expand Down
1 change: 1 addition & 0 deletions gtk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ CFLAGS += -MMD \
-Wno-format-truncation \
-Wno-class-memaccess \
-Wno-unknown-warning-option \
-Wno-unknown-pragmas \
-g \
$(shell $(PKG_CONFIG) --cflags gtk+-3.0) \
-DGDK_DISABLE_DEPRECATION_WARNINGS -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE \
Expand Down

0 comments on commit e37d203

Please # to comment.