std::modf
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
ヘッダ <cmath> で定義
|
||
float modf( float x, float* iptr ); |
||
double modf( double x, double* iptr ); |
||
long double modf( long double x, long double* iptr ); |
||
整数部と小数部、
x
と同じ型と符号を有する各々に浮動小数点値x
与え分解する。不可分の一部は(浮動小数点形式)iptr
が指すオブジェクトに格納されてい.Original:
Decomposes given floating point value
x
into integral and fractional parts, each having the same type and sign as x
. The integral part (in floating-point format) is stored in the object pointed to by iptr
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
arg | - | 浮動小数点値
Original: floating point value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
iptr | - | に不可欠な要素を格納するための浮動小数点値へのポインタ
Original: pointer to floating point value to store the integral part to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
x
と同じ符号を持つx
の小数部分。整数部はiptr
が指す値に入れられ.Original:
The fractional part of
x
with the same sign as x
. The integral part is put into the value pointed to by iptr
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
Run this code
#include <iostream> #include <cmath> int main() { double f = 123.45; double f3; double f2 = std::modf(f, &f3); std::cout << "Given the number " << f << ", " << "modf() makes " << f3 << " and " << f2 << '\n'; f = -3.21; f2 = std::modf(f, &f3); std::cout << "Given the number " << f << ", " << "modf() makes " << f3 << " and " << f2 << '\n'; }
出力:
Given the number 123.45, modf() makes 123 and 0.45 Given the number -3.21, modf() makes -3 and -0.21
[編集] 参照
(C++11) |
指定された値より絶対値が大きくない最も近い整数を返します (関数) |