Docs Menu

$acosh (aggregation)

項目一覧

$acosh

Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value.

$acoshの構文は次のとおりです。

{ $acosh: <expression> }

$acoshは、 1+Infinityの間の数値に変換される有効なであればどれでもかまいません。例を以下に示します。 1 <= value <= +Infinity

$acoshはラジアン単位で値を返します。 $radiansToDegrees演算子を使用して出力値をラジアンから度に変換します。

デフォルトでは、 $acoshは値をdoubleとして返します。 $acoshは、 <expression>が128ビットの 10 進数値に解決される限り、 128ビットの 10 進数として値を返すこともできます。

式の詳細については、「式 」を参照してください。

If the argument resolves to a value of null or refers to a field that is missing, $acosh returns null. If the argument resolves to NaN, $acosh returns NaN. If the argument resolves to negative infinity, $acosh throws an error. If the argument resolves to Infinity, $acosh returns Infinity. If the argument resolves to a value outside the bounds of [-1, Infinity] inclusive, $acosh throws an error.

結果

{ $acosh: NaN }

NaN

{ $acosh: null }

null

{ $acosh : Infinity}

Infinity

{ $acosh : 0 }

次の形式の出力のようなエラーメッセージをスローします。

"errmsg" :
"Failed to optimize pipeline :: caused by :: cannot
apply $acosh to -inf, value must in (1,inf)"

trigonometryコレクションには、 2 -D グラフのx軸に沿って値を保存するドキュメントが含まれています。

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("3")
}

The following aggregation operation uses the $acosh expression to calculate inverse hyperbolic cosine of x-coordinate and add it to the input document using the $addFields pipeline stage.

db.trigonometry.aggregate([
{
$addFields : {
"y-coordinate" : {
$radiansToDegrees : { $acosh : "$x-coordinate" }
}
}
}
])

$radiansToDegrees式は、 $acoshによって返されたラジアン値を度単位の同等の値に変換します。

このコマンドは、次の出力を返します。

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("3"),
"y-coordinate" : NumberDecimal("100.9979734210524228844295260083432")
}

x-coordinate128ビットの 10 進数として保存されているため、 $acoshの出力は128ビットの 10 進数になります。

trigonometryコレクションには、 2 -D グラフのx軸に沿って値を保存するドキュメントが含まれています。

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("3")
}

The following aggregation operation uses the $acosh expression to calculate inverse hyperbolic cosine of x-coordinate and add it to the input document using the $addFields pipeline stage.

db.trigonometry.aggregate([
{
$addFields : {
"y-coordinate" : {
$acosh : "$x-coordinate"
}
}
}
])

このコマンドは、次の出力を返します。

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("3"),
"y-coordinate" : NumberDecimal("1.762747174039086050465218649959585")
}

x-coordinate128ビットの 10 進数として保存されているため、 $acoshの出力は128ビットの 10 進数になります。

項目一覧