エントリーの編集
![loading...](https://b.st-hatena.com/bdefb8944296a0957e54cebcfefc25c4dcff9f5f/images/v4/public/common/loading@2x.gif)
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント1件
- 注目コメント
- 新着コメント
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
![アプリのスクリーンショット](https://b.st-hatena.com/bdefb8944296a0957e54cebcfefc25c4dcff9f5f/images/v4/public/entry/app-screenshot.png)
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
平方根なんてビット演算ですればいいじゃない - プログラムモグモグ
まぁ何も言わずに次のコードを実行してみましょう... #include <stdio.h> #include <math.h> int mysqrt... まぁ何も言わずに次のコードを実行してみましょう... #include <stdio.h> #include <math.h> int mysqrt(unsigned int); int main(){ int i, arr[] = {0, 15, 53, 193, 456, 46340}; for(i = 0; i < 6; ++i){ unsigned int temp = pow(arr[i], 2); printf("%d = sqrt(%d) = %d\n", arr[i], temp, mysqrt(temp)); } return 0; } int mysqrt(unsigned int x){ int a = 0, c = 0, y = 0, i = 0, t = x; while(t >>= 1){ ++i; } for(i += i & 1; i >= 0; i -=
2015/08/10 リンク