Remove /fp:fast ceil/floor workarounds from floatdouble.cpp and floatsingle.cpp#127325
Open
Remove /fp:fast ceil/floor workarounds from floatdouble.cpp and floatsingle.cpp#127325
Conversation
…single.cpp These workarounds were added in dotnet/coreclr#19725 to ensure ceil and floor returned the appropriate values (particularly for -0.0) when compiled with MSVC under /fp:fast. These can now be removed because: 1. The MSVC /fp:fast bugs have been resolved 2. The hardware baseline has been updated to SSE4.1 where roundss/roundsd are available, so the MSVCRT implementations will never be hit on xarch Fixes #11003 Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b14e52eb-82fa-4f73-8722-0df9a7bc86a3 Co-authored-by: tannergooding <10487869+tannergooding@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove workaround from floatdouble and floatsingle
Remove /fp:fast ceil/floor workarounds from floatdouble.cpp and floatsingle.cpp
Apr 23, 2026
tannergooding
approved these changes
Apr 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Removes legacy MSVC /fp:fast ceil/floor #pragma float_control(precise, on) workarounds in CoreCLR float helpers, based on the claim that the compiler/CRT issues are resolved and xarch now uses SSE4.1 instructions.
Changes:
- Delete MSVC
float_controlpush/pop blocks aroundCOMSingle::CeilandCOMDouble::Ceil. - Delete MSVC
float_controlpush/pop blocks aroundCOMDouble::Floor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/coreclr/vm/floatsingle.cpp | Removes MSVC AMD64 float_control(precise) workaround guard around ceilf. |
| src/coreclr/vm/floatdouble.cpp | Removes MSVC AMD64 float_control(precise) workaround guard around ceil, and MSVC x86 guard around floor. |
AaronRobinsonMSFT
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Remove MSVC
/fp:fastworkarounds forceil/ceilfandfloorinfloatdouble.cppandfloatsingle.cpp. These#pragma float_control(precise, on)guards were added in dotnet/coreclr#19725 to handle incorrect-0.0results from the CRT.They are no longer needed:
/fp:fastbugs (DevDiv 673060/673062) have been resolvedroundss/roundsdare used instead of the MSVCRT implementations on xarchThe unrelated SinCos workaround (for https://developercommunity.visualstudio.com/t/10582378) is not touched.
Changes
floatdouble.cpp: Remove#if defined(_MSC_VER) && defined(TARGET_AMD64)guard aroundCeil; remove#if defined(_MSC_VER) && defined(TARGET_X86)guard aroundFloorfloatsingle.cpp: Remove#if defined(_MSC_VER) && defined(TARGET_AMD64)guard aroundCeilExisting
Ceiling_Double_IEEE,Floor_Double_IEEE, and correspondingMathFtests already validate-0.0handling.