Skip to content

Comments

math: remove ieee_arithmetic import#920

Merged
VincentVanlaer merged 1 commit intomainfrom
bad-ieee
Feb 17, 2026
Merged

math: remove ieee_arithmetic import#920
VincentVanlaer merged 1 commit intomainfrom
bad-ieee

Conversation

@VincentVanlaer
Copy link
Member

Importing any of the ieee modules has a somewhat unexpected effect. Each procedure that has an ieee module in scope will (1) save the FPU state at the start and (2) restore it at the end, adding any flags that were raised by the procedure. Since the use ieee_arithmetic is included in the main math module directly, everything that imports math will be effectively be importing an ieee module. This has a large impact on performance (for example, the low_z test case runs in 2/3 the time with this patch).

Importing any of the ieee modules has a somewhat unexpected effect. Each
procedure that has an ieee module in scope will (1) save the FPU state
at the start and (2) restore it at the end, adding any flags that were
raised by the procedure. Since the `use ieee_arithmetic` is included in
the main math module directly, everything that imports math will be
effectively be importing an ieee module. This has a large impact on
performance (for example, the `low_z` test case runs in 2/3 the time
with this patch).
@VincentVanlaer VincentVanlaer merged commit ffbbf2e into main Feb 17, 2026
5 checks passed
@rhdtownsend
Copy link
Contributor

rhdtownsend commented Feb 17, 2026 via email

@VincentVanlaer
Copy link
Member Author

so surely importing the math module should not mean that the IEEE module is in scope?

gfortran seems to think otherwise. I tracked down where in the code it was adding the save/restore functions, and from what I can tell it just checks whether any symbols from any ieee modules are in scope (for whatever definition of scope is used within gfortran). Perhaps worthy of a bug report, but that might take a while to go through the pipeline.

@VincentVanlaer VincentVanlaer deleted the bad-ieee branch February 17, 2026 17:09
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.

2 participants