LoginSignup
0
0

More than 3 years have passed since last update.

Calc メモ 〜 大きな数字を扱える計算ツール

Posted at

大きな数字を扱える計算ツールについてのメモです。
環境は Mac です。
※ まとめ中です。

概要

Calc で大きな数字を扱った例です。

% calc          
C-style arbitrary precision calculator (version 2.12.7.1)
Calc is open software. For license details type:  help copyright
[Type "exit" to exit, or "help" for help.]

; 3 * 19 ^ 43 - 1
    29075426613099201338473141505176993450849249622191102976
; (3 * 19 ^ 43 - 1) / 2 * 2
    29075426613099201338473141505176993450849249622191102976

Python でも大きな整数を扱えますが、

(3 * 19 ** 43 - 1)
29075426613099201338473141505176993450849249622191102976

浮動小数になるとほとんどの系では double 相当の演算になります。
Python チュートリアル「15. 浮動小数点演算、その問題と制限」の記述が詳しいです。

(3 * 19 ** 43 - 1) / 2 * 2
2.90754266130992e+55

インストール

Homebrew を用いてインストールをするのが簡単です。

brew install calc

関連情報

GitHub lcn/calc
開発者のサイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0