Skip to content

Move _Floating_type_traits-related functions#4615

Merged
StephanTLavavej merged 3 commits intomicrosoft:mainfrom
frederick-vs-ja:constexpr-fp-helpers
Apr 26, 2024
Merged

Move _Floating_type_traits-related functions#4615
StephanTLavavej merged 3 commits intomicrosoft:mainfrom
frederick-vs-ja:constexpr-fp-helpers

Conversation

@frederick-vs-ja
Copy link
Contributor

Towards #3599.

  • Move _Float_abs_bits, _Float_abs, _Is_nan, and _Is_finite to <type_traits> to avoid including <xutility> in <cmath>.
    • However, throughput may be slightly damaged when <cmath> is not included.
  • Move _Is_signaling_nan and _Is_inf to <complex> as they are not used elsewhere.
  • Remove _Float_copysign as it's unused.
  • Reimplement _Floating_max and _Floating_min in a consistent way.

- Move `_Float_abs_bits`, `_Float_abs`, `_Is_nan`, and `_Is_finite`
to `<type_traits>` to avoid including `<xutility>` in `<cmath>`cmath
- Move `_Is_signaling_nan` and `_Is_inf` to `<complex>` as they are
not used elsewhere.
- Remove `_Float_copysign` as it's unused.
- Reimplement `_Floating_max` and `_Floating_min` in a simpler way.
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner April 21, 2024 16:58
@StephanTLavavej StephanTLavavej added the throughput Must compile faster label Apr 21, 2024
@StephanTLavavej
Copy link
Member

Thanks! I pushed a further simplification to use hexfloats.

Note that this makes _Floating_type_traits<long double>::_Meowimum_value not have exactly the right type, but this is fine - we end up "widening" it to _Ty. I didn't think it was worth the effort to try to "fix" the type for this internal trait.

@StephanTLavavej StephanTLavavej self-assigned this Apr 26, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 4ab1364 into microsoft:main Apr 26, 2024
@StephanTLavavej
Copy link
Member

Thanks again for noticing these possibilities for improvement! 🪄 🚀 🎉

@frederick-vs-ja frederick-vs-ja deleted the constexpr-fp-helpers branch April 27, 2024 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

throughput Must compile faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants