📜  红宝石 |数学 atanh()函数

📅  最后修改于: 2022-05-13 01:55:24.414000             🧑  作者: Mango

红宝石 |数学 atanh()函数

atanh()是 Ruby 中的内置函数,返回以弧度为单位的角度的反双曲正切值。它接受[-1, +1]范围内的值并返回[-INFINITY, INFINITY]范围内的值。

示例 1

#Ruby program for atanh() function
  
#Assigning values
val1 = -1 val2 = 1 val3 = -0.5 val4 = 0.7
  
#Prints the atanh() value
                                      puts Math.atanh(val1)
                                          puts Math.atanh(val2)
                                              puts Math.atanh(val3)
                                                  puts Math.atanh(val4)

输出

-Infinity
Infinity
-0.5493061443340548
0.8673005276940531

示例 2

#Ruby program for atanh() function
  
#Assigning values
val1 = -0.7 val2 = 0.6 val3 = -0.56 val4 = 0.90
  
#Prints the atanh() value
                                           puts Math.atanh(val1)
                                               puts Math.atanh(val2)
                                                   puts Math.atanh(val3)
                                                       puts Math.atanh(val4)

输出

-0.8673005276940531
0.6931471805599453
-0.632833186665638
1.4722194895832204

参考:https://devdocs.io/ruby~2.5/math#method-c-atanh