名前空間
変種
操作

std::ratio_subtract

提供: cppreference.com
< cpp‎ | numeric‎ | ratio

 
 
ニューメリックスライブラリ
一般的な数学関数
浮動小数点環境
複素数
数値配列
擬似乱数生成
コンパイル時有理数演算 (C++11)
汎用の数値演算
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iota(C++11)
accumulate
inner_product
adjacent_difference
partial_sum
 
時間有理数演算をコンパイルします
ratio(C++11)
算術
Original:
Arithmetic
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ratio_add(C++11)
ratio_subtract(C++11)
ratio_multiply(C++11)
ratio_divide(C++11)
比較
Original:
Comparison
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ratio_equal(C++11)
ratio_not_equal(C++11)
ratio_less(C++11)
ratio_less_equal(C++11)
ratio_greater(C++11)
ratio_greater_equal(C++11)
 
Defined in header <ratio>
template< class R1, class R2 >
using ratio_subtract = /* unspecified */;
テンプレートエイリアスstd::ratio_subtractstd::ratioインスタンスによって表される2つの正確な有理数分数を減算した結果を示しR1R2。結果std::ratioインスタンスstd::ratio<Num, Denom>どこNum == R1::num * R2::den - R2::num * R1::denDenom == R1::den * R2::den
Original:
The template alias std::ratio_subtract denotes the result of subtracting two exact rational fractions represented by the std::ratio instances R1 and R2. The result a std::ratio instance std::ratio<Num, Denom> where Num == R1::num * R2::den - R2::num * R1::den and Denom == R1::den * R2::den.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] メンバータイプ

メンバー·タイプ
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
type std::ratio<num, den>

[編集] メンバー定数

num
[静的]
タイプのconstexprstd::intmax_tsign(Num) * sign(Denom) * abs(Num) / gcd(Num, Denom)に等しい
Original:
constexpr value of type std::intmax_t equal to sign(Num) * sign(Denom) * abs(Num) / gcd(Num, Denom)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
den
[静的]
タイプのconstexprstd::intmax_tabs(Denom) / gcd(Num, Denom)に等しい
Original:
constexpr value of type std::intmax_t equal to abs(Denom) / gcd(Num, Denom)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)

[編集]

#include <iostream>
#include <ratio>
 
int main()
{
    typedef std::ratio<2, 3> two_third;
    typedef std::ratio<1, 6> one_sixth;
 
    typedef std::ratio_subtract<two_third, one_sixth> diff;
    std::cout << "2/3 - 1/6 = " << diff::num << '/' << diff::den << '\n';
}

Output:

2/3 - 1/6 = 1/2