From Jason Turner

[c.math.abs]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2zxo5zo4/{from.md → to.md} +13 -10
tmp/tmp2zxo5zo4/{from.md → to.md} RENAMED
@@ -2,26 +2,29 @@
2
 
3
  [*Note 1*: The headers `<cstdlib>` and `<cmath>` declare the functions
4
  described in this subclause. — *end note*]
5
 
6
  ``` cpp
7
- int abs(int j);
8
- long int abs(long int j);
9
- long long int abs(long long int j);
10
- float abs(float j);
11
- double abs(double j);
12
- long double abs(long double j);
13
  ```
14
 
15
- *Effects:* The `abs` functions have the semantics specified in the C
16
- standard library for the functions `abs`, `labs`, `llabs`, `fabsf`,
17
- `fabs`, and `fabsl`.
18
 
19
- *Remarks:* If `abs()` is called with an argument of type `X` for which
20
  `is_unsigned_v<X>` is `true` and if `X` cannot be converted to `int` by
21
  integral promotion [[conv.prom]], the program is ill-formed.
22
 
23
  [*Note 1*: Arguments that can be promoted to `int` are permitted for
24
  compatibility with C. — *end note*]
25
 
 
 
 
 
 
 
26
  See also: ISO C 7.12.7.2, 7.22.6.1
27
 
 
2
 
3
  [*Note 1*: The headers `<cstdlib>` and `<cmath>` declare the functions
4
  described in this subclause. — *end note*]
5
 
6
  ``` cpp
7
+ constexpr int abs(int j);
8
+ constexpr long int abs(long int j);
9
+ constexpr long long int abs(long long int j);
 
 
 
10
  ```
11
 
12
+ *Effects:* These functions have the semantics specified in the C
13
+ standard library for the functions `abs`, `labs`, and `llabs`,
14
+ respectively.
15
 
16
+ *Remarks:* If `abs` is called with an argument of type `X` for which
17
  `is_unsigned_v<X>` is `true` and if `X` cannot be converted to `int` by
18
  integral promotion [[conv.prom]], the program is ill-formed.
19
 
20
  [*Note 1*: Arguments that can be promoted to `int` are permitted for
21
  compatibility with C. — *end note*]
22
 
23
+ ``` cpp
24
+ constexpr floating-point-type abs(floating-point-type x);
25
+ ```
26
+
27
+ *Returns:* The absolute value of `x`.
28
+
29
  See also: ISO C 7.12.7.2, 7.22.6.1
30