The result of these methods was incorrectly documented as having
the same sign as `other` (the divisor) rather than `self` (the
dividend). This patch corrects the documentation, and also fixes
the capitalization of `formTruncatingRemainder` in one location.
Replace the non-generic tgmath functions with generic <T: FloatingPoint> implementations where possible, and move the global sqrt() operation into tgmath.
* [stdlib] Introducing the new Arithmetic protocol
* [stdlib] conforming floating point types to the new Arithmetic protocol
* [stdlib] removing AbsoluteValuable conformance from floating point types
* [stdlib] removing the integers prototype
change includes both the necessary protocol updates and the deprecation
warnings
suitable for migration. A future patch will remove the renamings and
make this
a hard error.
Implemented SE-0113 + residual SE-0067 operations.
- adds `rounded` and `round` to `FloatingPoint`, from SE-0113.
- adds `remainder`, `squareRoot`, and `addingProduct`, from SE-0067.
- adds basic test coverage for all of the above.
- provides a default implementation of `nextDown` on `FloatingPoint`.
* Bring the behavior of Self.minimum, .maximum, .minimumMagnitude and .maximumMagnitude in line with the IEEE 754 rules.
Specifically, if either argument is a signaling NaN, the result should be a quiet NaN. Previously, signaling NaN inputs were treated identically to quiet NaN inputs.
Some other changes folded in with this:
- Formally define which argument is returned if lhs == rhs or abs(lhs) == abs(rhs) in the case of the Magnitude versions. This guarantees that the set {min,max} is identitical to the set {lhs,rhs} so long as neither argument is NaN. This is not only a nod to formalism; it's also a critical property for generic head-tail arithmetic to simulate wider types.
- Added test coverage for these four operations.
* Change value of Float.pi so that it's rounded down; this helps insure that angles computed via trigonometry end up in the correct quadrant.
* Missed commit of corresponding test change.
There are a couple of features that are not yet implemented, because they require additions to the Builtin module. Specifically, this implementation does not have:
- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)
Also missing are the generic initializers and comparisons whose implementation depends on having new Integer protocols.
The last remaining feature of SE-0067 is that while the basic operators +,-,*,/, etc are moved onto the FloatingPoint protocol, they are still required on the concrete types in order to disambiguate overloads. Fixing this seems to require either modifying the overload resolution rules or removing these operators from some other protocols. Or it might just require that someone smarter than me looks at the problem.
Passes all the existing tests (with the included changes). I'm working on additional tests for the new features.
wraps up SE-0004 and SE-0029.
I consider the diagnostic changes in Constraints/lvalues.swift to be
indicative of a QoI regression, but I'll deal with that separately.
This is a staging attribute that will eventually mean "fixed-contents"
for structs and "closed" for enums, as described in
docs/LibraryEvolution.rst.
This is pretty much the minimal set of types that must be fixed-layout,
because SILGen makes assumptions about their lowering.
If desired, some SILGen refactoring can allow some of these to be
resilient. For example, bridging value types could be made to work
with resilient types.