本文简要介绍ruby语言中 Complex.numerator
的用法。
用法
numerator → numeric
返回分子。
1 2 3+4i <- numerator - + -i -> ---- 2 3 6 <- denominator c = Complex('1/2+2/3i') #=> ((1/2)+(2/3)*i) n = c.numerator #=> (3+4i) d = c.denominator #=> 6 n / d #=> ((1/2)+(2/3)*i) Complex(Rational(n.real, d), Rational(n.imag, d)) #=> ((1/2)+(2/3)*i)
见分母。
相关用法
- Ruby Complex.arg用法及代码示例
- Ruby Complex.abs2用法及代码示例
- Ruby Complex.angle用法及代码示例
- Ruby Complex.polar用法及代码示例
- Ruby Complex.to_f用法及代码示例
- Ruby Complex.cmp / numeric用法及代码示例
- Ruby Complex.conj用法及代码示例
- Ruby Complex.infinite?用法及代码示例
- Ruby Complex.abs用法及代码示例
- Ruby Complex.phase用法及代码示例
- Ruby Complex.rationalize用法及代码示例
- Ruby Complex.cmp ==用法及代码示例
- Ruby Complex.imaginary用法及代码示例
- Ruby Complex.cmp * numeric用法及代码示例
- Ruby Complex.fdiv用法及代码示例
- Ruby Complex.rect用法及代码示例
- Ruby Complex.inspect用法及代码示例
- Ruby Complex.magnitude用法及代码示例
- Ruby Complex.-cmp用法及代码示例
- Ruby Complex.rectangular用法及代码示例
- Ruby Complex.conjugate用法及代码示例
- Ruby Complex.real用法及代码示例
- Ruby Complex.imag用法及代码示例
- Ruby Complex.cmp - numeric用法及代码示例
- Ruby Complex.cmp + numeric用法及代码示例
注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 Complex.numerator。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。