float()
原文
値をfloatデータ型に変換します。 以下に例を示します( "2.0f"の説明については定数リファレンスを参照してください):
code:sample.ino
int x = 2;
float f = float(x); // f now holds 2.0f, a float value
値xは任意のタイプでよい。 しかし、xが(intのような)数値でない場合は、奇妙な結果が得られます。
Maple(Arduino STM32)上のfloat値の精度と制限の詳細については、floatリファレンスを参照してください。
関連項目
float
double
double()
License and Attribution: Portions of this page were adapted from the Arduino Reference Documentation, which is released under a Creative Commons Attribution-ShareAlike 3.0 License.
このドキュメントはleafLabs, LLC.が執筆し、たま吉が翻訳・一部加筆修正したものです。
Arduino STM32 リファレンス 日本語版 に戻る