decimal:任意精度十进制算术

时间:2021-05-05 08:03:52
【文件属性】:
文件名称:decimal:任意精度十进制算术
文件大小:29KB
文件格式:ZIP
更新时间:2021-05-05 08:03:52
Elixir 小数 任意精度的十进制算术。 用法 在您的mix.exs文件中添加Decimal作为依赖mix.exs : def deps do [{ :decimal , " ~> 2.0 " }] end 接下来,在您的shell中运行mix deps.get以获取并编译Decimal 。 使用iex -S mix启动交互式Elixir Shell: iex > alias Decimal , as: D iex > D . add ( 6 , 7 ) # Decimal<13> iex > D . div ( 1 , 3 ) # Decimal<0> iex > D . new ( " 0.33 " ) # Decimal<0> 例子 使用上下文 上下文指定计算结果的最大精度,如果结果的精度高于指定的最大值,则舍入算法指定四舍五入算法。 它还包含陷阱启用器集和
【文件预览】:
decimal-master
----mix.lock(2KB)
----.gitignore(54B)
----mix.exs(806B)
----.formatter.exs(77B)
----CHANGELOG.md(3KB)
----LICENSE.txt(10KB)
----.github()
--------workflows()
----README.md(4KB)
----lib()
--------decimal()
--------decimal.ex(50KB)
----test()
--------decimal()
--------test_helper.exs(274B)
--------decimal_test.exs(32KB)

网友评论