Raku의 acotan — 아크코탄젠트 구하기

Raku의 acotan — 아크코탄젠트 구하기

코탄젠트(cotangent)의 역함수가 필요할 때 acotan을 써요. Cool 계층에 정의된 루틴으로, 호출자(또는 서브 형태에서는 인자)를 Numeric으로 강제 변환한 뒤 그 아크코탄젠트라디안 단위로 반환합니다.

출처: Raku 공식 문서 — routine acotan

sub acotan(Numeric(Cool))
method acotan()
say 45.acotan;              # OUTPUT: «0.0222185653267191␤»
say acotan(45)              # OUTPUT: «0.0222185653267191␤»

메서드 형태(45.acotan)와 서브 형태(acotan(45))가 같은 값을 돌려주는 걸 확인할 수 있어요.