Commit Graph

10 Commits

Author SHA1 Message Date
Stephen Canon
57a4553832 SE-0246: Protocols and static functions (#23824)
This implements the protocols and static functions proposed in SE-0246, plus some initial test coverage. It also has some rough accompanying cleanup of tgmath. It does not include the globals (on scalars or SIMD types) nor does it deprecate much in tgmath.h.
2019-04-17 23:57:33 +02:00
Stephen Canon
c5e3f85378 Revert SE-0246 (#23800)
* Revert "Merge pull request #23791 from compnerd/you-know-nothing-clang"

This reverts commit 5150981150, reversing
changes made to 8fc305c03e.

* Revert "Merge pull request #23780 from compnerd/math-is-terrible"

This reverts commit 2d7fedd25f, reversing
changes made to 0205150b8f.

* Revert "Merge pull request #23140 from stephentyrone/mafs"

This reverts commit 777750dc51, reversing
changes made to 0c8920e747.
2019-04-04 19:35:25 -04:00
Steve (Numerics) Canon
3fda509805 Implementation of ElementaryFunctions / Real protocols.
This commit implements SE-0246, by adding conformance to Real to the Float, CGFloat, Double, and Float80 types, implemented either in terms of the system's C math library, existing standard library functionality, or LLVM intrinsics. It includes basic test coverage for these new functions, and deprecates and obsoletes *some* existing functionality in the Platform overlay. We still need to make a decision about how to handle the remaining "tgmath" functions, because obsoleting them is technically a source-breaking change (if users have unqualified names like "exp(1)", it's fine, but it would break users who have used qualified names like "Darwin.exp(1)".)
2019-04-02 18:49:31 -04:00
Stephen Canon
60fc39e72a Improve codegen for init(signOf: magnitudeOf:) (#23727)
This can map straight to the LLVM copysign intrinsic for builtin types, which both gets us better codgen and lets the compiler plug this operation into other LLVM-level optimizations.
2019-04-02 09:49:18 -04:00
Stephen Canon
20a1781842 Minor improvement for the documentation of ulp and ulpOfOne. (#23211)
1. Move discussion of `DBL_EPSILON` etc. onto `ulpOfOne` instead of `ulp`.
2. Add text explaining that `ulpOfOne` is a poor value to use for approximate comparison.
2019-03-11 13:06:41 -04:00
Karoy Lorentey
545fa5e640 [stdlib] Re-add previously synthesized hashing definitions 2018-11-22 17:15:36 +00:00
Maxim Moiseev
cbf83ac04f [NFC][stdlib] Add FIXME markers to simplify audit 2018-11-14 11:58:42 -08:00
Slava Pestov
f6c2caf64b stdlib: Add @inlinable to @inline(__always) declarations
These should be audited since some might not actually need to be
@inlinable, but for now:

- Anything public and @inline(__always) is now also @inlinable
- Anything @usableFromInline and @inline(__always) is now @inlinable
2018-11-13 15:15:07 -05:00
Maxim Moiseev
a54c53580c [stdlib] Audit use of @_transparent in FP code
<rdar://problem/45140678>
2018-10-10 17:00:39 -07:00
Stephen Canon
0707ca6dac Remove concrete floating-point inits from integer types (#19624)
Also removes .gyb from FloatingPoint.swift, since we barely are using it after this change.

Rework Self._convert from integer, by making it require RawSignificand: FixedWidthInteger. This requirement should have always been there, and the existing implementaiton wouldn't have actually worked correctly without it. Making it explcit makes the implementation quite a bit simpler, which is nice.

Additionally add a  fast-path conversion that will catch all concrete integer types without needing to be a concrete implementation itself. Room for further improvement, but good start. See RandomDouble performance improvements, for example.
2018-09-30 11:57:49 -04:00