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

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

红宝石 |数学 sinh()函数

sinh()是 Ruby 中的一个内置函数,返回以弧度给出的值的双曲正弦值。传递的值在[-inf, +inf]范围内。返回值在[-inf, +inf]范围内。

示例 1

#Ruby program for sinh() function
  
#Assigning values
val1 = 0 val2 = 0.67 val3 = 1 val4 = 2
  
#Prints the sinh() value
                                     puts Math.sinh(val1)
                                         puts Math.sinh(val2)
                                             puts Math.sinh(val3)
                                                 puts Math.sinh(val4)

输出

0.0
0.7212643714246986
1.1752011936438014
3.626860407847019

示例 2

#Ruby program for sinh() function
  
#Assigning values
val1 = 131 val2 = -0.9 val3 = -98 val4 = -767
  
#Prints the sinh() value
                                          puts Math.sinh(val1)
                                              puts Math.sinh(val2)
                                                  puts Math.sinh(val3)
                                                      puts Math.sinh(val4)

输出

3.9043355367595756e+56
-1.0265167257081753
-1.8189854738044024e+42
-Infinity

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