Docs 菜单

Docs 主页开发应用程序MongoDB Manual

$atanh(聚合)

在此页面上

  • 行为
  • 例子
$atanh

4.2 版本中的新增功能

返回某个值的反双曲正切(双曲弧正切)值。

$atanh 通过以下语法实现:

{ $atanh: <expression> }

$atanh接受解析为-11之间数字的任何有效表达式,例如-1 <= value <= 1

$atanh返回以弧度为单位的值。使用$radiansToDegrees操作符将输出值从弧度转换为度数。

默认情况下, $atanhdouble形式返回值。只要<expression>解析为128位十进制值, $atanh也可以返回128位十进制值。

有关表达式的更多信息,请参阅表达式运算符。

如果参数解析为null值或引用了缺失的字段,则$atanh返回null 。如果参数解析为NaN ,则$atanh返回NaN 。如果参数解析为负无穷大或正无穷大, $atanh会引发错误。如果参数解析为+1-1 ,则$atanh分别返回Infinity-Infinity

例子
结果
{ $atanh: NaN }
NaN
{ $atanh: null }
null
{ $atanh: 1 }
Infinity
{ $atanh: -1}
-Infinity

{ $atanh : Infinity}

{ $atanh : -Infinity }

抛出类似于以下格式输出的错误消息:

"errmsg" :
"Failed to optimize pipeline :: caused by :: cannot
apply $atanh to -inf, value must in (-inf,inf)"
← $atan2(聚合)

在此页面上