Files
swift-mirror/stdlib/public/Platform
Stephen Canon ff89fce7df Make FloatingPoint require that Self.Magnitude == Self (#17323)
* Make FloatingPoint require that Self.Magnitude == Self

We didn't have the where clause to express this constraint at the time that the FloatingPoint protocol was implemented, but we do now. This is not a semantic change to FloatingPoint, which has always bound IEEE-754 arithmetic types, for which this constraint would necessarily hold, but it does effect the type system.

For example, currently the following function does not type check:
~~~~
func foo<T>(x: T) -> T where T: FloatingPoint {
  var r = x.remainder(dividingBy: 1)
  return r.magnitude
}
~~~~
with this change, it compiles correctly.

Having done this, we no longer need to have a separate `abs` defined on FloatingPoint; we can use the existing function defined on `SignedNumeric` instead. Additionally mark the global `fabs` defined in the platform C module deprecated in favor of the Swift `abs`; we don't need to carry two names for this function going forward.
2018-06-20 19:56:22 -04:00
..
2017-01-06 16:41:22 +01:00

This directory holds the Swift Standard Library's Darwin and Glibc Module, comprised of

  • The overlay library, which amends some APIs imported from Clang module.
  • Glibc only: The clang module map which specifies which headers need to be imported from Glibc for bare minimum functionality.

Note: On Darwin platforms, we assume clang module map is already installed in the system SDK.