Ruby CMath sinh() 方法与示例
sinh() 方法是 Math 类,用于返回给定值的双曲正弦值。
Syntax: Math.sinh(z)
Parameter: Here, z is the value whose hyberbolic sine is to be calculated.
Returns: This method returns the hyberbolic sine value of the z.
示例 1:
# Ruby code for sinh() method
require 'cmath'
# Initializing value
a = 0.3584
b = 2
# Printing result
puts "sinh value of a : #{CMath.sinh(a)}\n\n"
puts "sinh value of b : #{CMath.sinh(b)}\n\n"
输出:
sinh value of a : 0.3661222097428432
sinh value of b : 3.626860407847019
示例 2:
# Ruby code for sinh() method
require 'cmath'
# Initializing value
a = 0
b = -0.247
# Printing result
puts "sinh value of a : #{CMath.sinh(a)}\n\n"
puts "sinh value of b : #{CMath.sinh(b)}\n\n"
输出:
sinh value of a : 0.0
sinh value of b : -0.24951920962344676