Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions reference/cmath/abs.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace std {
int abs(int x); // (6) C++17
constexpr int abs(int x); // (6) C++23

long abs(long int x); // (7) C++17
constexpr long abs(long int x); // (7) C++23
long abs(long x); // (7) C++17
constexpr long abs(long x); // (7) C++23

long long abs(long long x); // (8) C++17
constexpr long long abs(long long x); // (8) C++23
Expand All @@ -38,7 +38,7 @@ namespace std {
- (4) : 浮動小数点数型に対するオーバーロード
- (5) : 整数型に対するオーバーロード (`double`にキャストして計算される)
- (6) : `int`に対するオーバーロード
- (7) : `long int`に対するオーバーロード
- (7) : `long`に対するオーバーロード
- (8) : `long long`に対するオーバーロード


Expand Down Expand Up @@ -100,6 +100,11 @@ namespace std {
```


## 関連項目
- [`abs - <cstdlib>`](/reference/cstdlib/abs.md)
- [`fabs`](/reference/cmath/fabs.md)


## 参照
- [P0533R9 constexpr for `<cmath>` and `<cstdlib>`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0533r9.pdf)
- C++23での、一部関数の`constexpr`対応
Expand Down
6 changes: 6 additions & 0 deletions reference/cmath/fabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ namespace std {
* is_integral[link ../type_traits/is_integral.md]
* enable_if[link ../type_traits/enable_if.md]
## 関連項目
- [`abs - <cmath>`](/reference/cmath/abs.md)
- [`abs - <cstdlib>`](/reference/cstdlib/abs.md)
## 参照
- [P0533R9 constexpr for `<cmath>` and `<cstdlib>`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0533r9.pdf)
- C++23での、一部関数の`constexpr`対応
Expand Down
35 changes: 20 additions & 15 deletions reference/cstdlib/abs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
```cpp
namespace std {
int
abs(int j); // (1) C++03
abs(int j); // (1) C++03
constexpr int
abs(int j); // (1) C++23
abs(int j); // (1) C++23

long
int abs(long j); // (2) C++03
abs(long j); // (2) C++03
constexpr long
int abs(long j); // (2) C++23
abs(long j); // (2) C++23

long long
abs(long long j); // (3) C++11
abs(long long j); // (3) C++11
constexpr long long
abs(long long j); // (3) C++23
abs(long long j); // (3) C++23

float
abs(float j); // (4) C++03からC++20まで
Expand All @@ -27,23 +27,23 @@ namespace std {
long double
abs(long double j); // (6) C++03からC++20まで

floating-point-type
abs(floating-point-type j); // (7) C++03からC++20まで
constexpr floating-point-type
abs(floating-point-type j); // (7) C++23

long
labs(long j); // (8) C++03
labs(long j); // (8) C++03
constexpr long
labs(long j); // (8) C++23
labs(long j); // (8) C++23

long long
llabs(long long j); // (9) C++11
llabs(long long j); // (9) C++11
constexpr long long
llabs(long long j); // (9) C++23
llabs(long long j); // (9) C++23
}
```

## 概要
絶対値を求める。abs は absolute value(絶対値)の略。
算術型の絶対値を求める。abs は absolute value(絶対値)の略。

- (1) : `int`に対するオーバーロード
- (2) : `long`に対するオーバーロード
Expand All @@ -52,8 +52,8 @@ namespace std {
- (5) : `double`に対するオーバーロード
- (6) : `long double`に対するオーバーロード
- (7) : 浮動小数点数型に対するオーバーロード
- (8) : `long`規定
- (9) : `long long`規定
- (8) : `long`型規定
- (9) : `long long`型規定


## 戻り値
Expand Down Expand Up @@ -95,6 +95,11 @@ int main()
- GCC 4.6.1 以上


## 関連項目
- [`abs - <cmath>`](/reference/cmath/abs.md)
- [`fabs`](/reference/cmath/fabs.md)


## 参照
- [P0533R9 constexpr for `<cmath>` and `<cstdlib>`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0533r9.pdf)
- C++23での、一部関数の`constexpr`対応
Expand Down
Loading