@@ -20,6 +20,52 @@ Swift 3.0
20
20
conjunction with ` sizeof ` should migrate to the ` MemoryLayout ` structure provided by
21
21
[ SE-0101] ( https://github.com/apple/swift-evolution/blob/master/proposals/0101-standardizing-sizeof-naming.md ) .
22
22
23
+ * [ SE-0113] ( https://github.com/apple/swift-evolution/blob/master/proposals/0113-rounding-functions-on-floatingpoint.md )
24
+
25
+ The following two methods were added to ` FloatingPoint ` :
26
+
27
+ ``` swift
28
+ func rounded (_ rule : FloatingPointRoundingRule ) -> Self
29
+ mutating func round ( _ rule : FloatingPointRoundingRule )
30
+ ```
31
+
32
+ These bind the IEEE 754 roundToIntegral operations. They provide the
33
+ functionality of the C / C++ ` round() ` , ` ceil() ` , ` floor() ` , and ` trunc() `
34
+ functions and other rounding operations as well.
35
+
36
+ As a follow-on to the work of SE-0113 and SE-0067, the following
37
+ mathematical operations in the ` Darwin.C ` and ` glibc ` modules now operate
38
+ on any type conforming to ` FloatingPoint ` : ` fabs ` , ` sqrt ` , ` fma ` ,
39
+ ` remainder ` , ` fmod ` , ` ceil ` , ` floor ` , ` round ` , and ` trunc ` .
40
+
41
+ See also the changes associated with SE-0067.
42
+
43
+ * [ SE-0067] ( https://github.com/apple/swift-evolution/blob/master/proposals/0067-floating-point-protocols.md )
44
+
45
+ The ` FloatingPoint ` protocol has been expanded to include most IEEE 754
46
+ required operations. A number of useful properties have been added to the
47
+ protocol as well, representing quantities like the largest finite value or
48
+ the smallest positive normal value (these correspond to the macros such as
49
+ FLT_MAX defined in C).
50
+
51
+ While almost all of the changes are additive, there are four changes that
52
+ will impact existing code:
53
+
54
+ - The ` % ` operator is no longer available for ` FloatingPoint ` types. It
55
+ was difficult to use correctly, and its semantics did not actually match
56
+ those of the corresponding integer operation, making it something of an
57
+ attractive nuisance. The new method ` formTruncatingRemainder(dividingBy:) `
58
+ provides the old semantics if they are needed.
59
+
60
+ - The static property ` .NaN ` has been renamed ` .nan ` .
61
+
62
+ - The static property ` .quietNaN ` was redundant and has been removed. Use
63
+ ` .nan ` instead.
64
+
65
+ - The predicate ` isSignaling ` has been renamed ` isSignalingNaN ` .
66
+
67
+ See also the changes associated with SE-0113.
68
+
23
69
* [ SE-0111] ( https://github.com/apple/swift-evolution/blob/master/proposals/0111-remove-arg-label-type-significance.md ) :
24
70
25
71
Argument labels have been removed from Swift function types. Instead, they are
0 commit comments