math.sqrt

math.sqrt 値の平方根を返す。

------------------------------------------
-- math.sqrt 標準ライブラリ(数学関数) sqrt_sample.lua
------------------------------------------
function main()
 
  C_Black = color( 0, 0, 0)       -- 黒(ブラック)
  C_White = color(255, 255, 255)  -- 白(ホワイト)
 
  -- メイン画面サイズを変更
  canvas.setMainBmp(500,300)
 
  canvas.drawCls(C_White)
  canvas.drawText("math.sqrt サンプル", 10, 4, 24, C_Black)
 
  canvas.drawText("math.sqrt( 2) = " .. math.sqrt( 2), 10, 100, 20, C_Black)
  canvas.drawText("math.sqrt( 100) = " .. math.sqrt( 100), 10, 120, 20, C_Black)
  canvas.drawText("math.sqrt( 0) = " .. math.sqrt( 0), 10, 140, 20, C_Black)
  canvas.drawText("math.sqrt( -2) = " .. math.sqrt( -2), 10, 160, 20, C_Black)
 
  canvas.drawText("画面タッチで終了します。", 10, 280, 16, C_Black)
  touch(3)
 
end
 
main()
 

math.sqrtのサンプルの実行結果です。



コメント(最大10行)
名前:
コメント

すべてのコメントを見る

タグ:

+ タグ編集
  • タグ:
最終更新:2012年04月14日 21:18
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。