AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

tanh (표현식 연산자)

$tanh

라디안 단위로 측정된 값의 쌍곡선 탄젠트를 반환합니다.

$tanh 의 구문은 다음과 같습니다:

{ $tanh: <expression> }

$tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians.

By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the <expression> resolves to a 128-bit decimal value.

표현식에 대한 자세한 내용은 표현식을 참조하세요 .

If the input argument resolves to a value of null or refers to a field that is missing, $tanh returns null. If the argument resolves to NaN, $tanh returns NaN. If the argument resolves to negative or positive Infinity, $tanh returns -1 or 1 respectively.

예시
결과

{ $tanh: NaN }

NaN

{ $tanh: null }

null

{ $tanh: -Infinity }

-1

{ $tanh: Infinity }

1

다음 trigonometry collection에는 도 단위로 측정된 angle 값을 저장하는 문서가 포함되어 있습니다.

db.trigonometry.insertOne(
{
"_id" : ObjectId( "5c50782193f833234ba90d45" ),
"angle" : Decimal128( "53.1301023541559787031443874490659" )
}
)

The following aggregation operation uses the $tanh expression to calculate the hyperbolic tangent of angle and adds it to the input document using the $addFields pipeline stage:

db.trigonometry.aggregate( [
{
$addFields : {
"tanh_output" : { $tanh : { $degreesToRadians : "$angle" } }
}
}
] )

$degreesToRadians 표현식은 angle 단위를 라디안으로 변환합니다.

출력 예시:

{
"_id" : ObjectId("5c50782193f833234ba90d45"),
"angle" : Decimal128("53.1301023541559787031443874490659"),
"tanh_output" : Decimal128("0.7293303448445332820512777329448416")
}

Because angle is stored as a 128-bit decimal, the $tanh output is also a 128-bit decimal.

이 페이지 평가하기

이 페이지의 내용