sq()
原文
sq()はマクロ関数です。数値の2乗を計算します。
書式
sq(a)
引数
a :数値
戻り値
指定した引数を2乗した値を返します。
注意
sq()を利用する場合、カッコ内で他の関数の使用は避けてください。 結果が正しくない可能性があります。
マクロ関数のため引数の評価の順番が、通常の関数と異なる場合があります。
code:sample1.ino
b = sq(a++); // avoid this - yields incorrect results
b = sq(a); // use this instead -
a++; // keep other operations outside sq()
Arduinoとの互換性
sq()のMaple(Arduino STM32)バージョンはArduinoと互換性があります。
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 リファレンス 日本語版 に戻る