完整文档页面(中文翻译)。文末附有来源说明。

阅读英文版

appdevreferencedaml-standard-libraryda-math

DA.Math

Daml 模块 DA.Math 参考文档。

DA.Math

Math — Decimal 实用数学函数。

本库侧重高精度,通常可提供约 9 位正确小数。数值算法经多次迭代达到该精度,由 Daml 运行时解释执行,性能不高。在性能敏感场景不建议使用。

模块概览

稳定(Stable)。 状态:`active` 引入版本:`3.4.9` 移除版本:`-` 警告:`0` 弃用:`0` 弃用自:`-`

函数

**

** : Decimal -> Decimal -> Decimal

幂运算。示例:2.0 ** 3.0 == 8.0

sqrt

sqrt : Decimal -> Decimal

计算 Decimal 的平方根。

>>> sqrt 1.44
1.2

exp

exp : Decimal -> Decimal

指数函数。示例:exp 0.0 == 1.0

log

log : Decimal -> Decimal

自然对数。示例:log 10.0 == 2.30258509299

logBase

logBase : Decimal -> Decimal -> Decimal

以给定底数的对数。示例:log 10.0 100.0 == 2.0

sin

sin : Decimal -> Decimal

sin 为正弦函数。

cos

cos : Decimal -> Decimal

cos 为余弦函数。

tan

tan : Decimal -> Decimal

tan 为正切函数。


本文由 CC Privacy Club 根据 Canton Network 官方文档(CC-BY-4.0)整理翻译,仅供学习;实现细节以官方最新版本为准。