View a markdown version of this page

$atanh - Amazon DocumentDB

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

$atanh

버전 8.0.1에서 새로 추가되었습니다.

Amazon DocumentDB의 $atanh 연산자는 값의 역 하이퍼볼릭 탄젠트(하이퍼볼릭 아크 탄젠트)를 반환합니다.

입력 표현식은 ~1(포함) 범위의 숫자-1로 확인되어야 합니다. 이 범위를 벗어나는 값은 오류를 일으킵니다.

반환 유형은 double 기본적으로 입니다. 입력이 128비트 10진수인 경우 출력도 128비트 10진수입니다.

파라미터

  • expression: -1 ~ 사이의 숫자로 확인되는 표현1식입니다.

동작

null, NaN 및 +/- 무한대

예제 결과
{ $atanh: NaN } NaN
{ $atanh: null } null
{ $atanh: 1 } Infinity
{ $atanh: -1 } -Infinity
{ $atanh: Infinity } 또는 { $atanh: -Infinity } 오류가 발생합니다.

입력이 null 이거나 참조된 필드가 누락된 경우 결과는 입니다null. 의 입력은를 NaN 생성합니다NaN. 경계 값과는 -Infinity 각각 Infinity1-1 생성합니다. [-1, 1] 범위를 벗어나는 값( 포함±Infinity)이 있으면 오류가 발생합니다.

예제(MongoDB 쉘)

다음 예제에서는 $atanh 연산자를 사용하여 값의 역 하이퍼볼릭 탄젠트를 계산하는 방법을 보여줍니다.

샘플 문서 생성

db.values.insertMany([ { "_id": 1, "value": 0 }, { "_id": 2, "value": 0.5 }, { "_id": 3, "value": -0.5 } ]);

쿼리 예제

db.values.aggregate([ { $project: { "result": { $atanh: "$value" } }} ]);

출력

[ { "_id": 1, "result": 0 }, { "_id": 2, "result": 0.5493061443340548 }, { "_id": 3, "result": -0.5493061443340548 } ]

코드 예제

$atanh 연산자 사용에 대한 코드 예제를 보려면 사용하려는 언어의 탭을 선택합니다.

Node.js
const { MongoClient } = require('mongodb'); async function main() { const client = await MongoClient.connect('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'); const db = client.db('test'); const collection = db.collection('values'); const result = await collection.aggregate([ { $project: { "result": { $atanh: "$value" } }} ]).toArray(); console.log(result); await client.close(); } main();
Python
from pymongo import MongoClient def main(): client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') db = client['test'] collection = db['values'] result = list(collection.aggregate([ { '$project': { 'result': { '$atanh': '$value' } }} ])) print(result) client.close() if __name__ == "__main__": main()