richfloat.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 55 行

SCALA
55
字号
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2002-2006, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |                                         **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id: RichFloat.scala 14416 2008-03-19 01:17:25Z mihaylov $package scala.runtimeimport Predef._final class RichFloat(x: Float) extends Proxy with Ordered[Float] {  // Proxy.self  def self: Any = x  // Ordered[Float].compare  def compare (y: Float): Int = if (x < y) -1 else if (x > y) 1 else 0  def min(y: Float) = Math.min(x, y)  def max(y: Float) = Math.max(x, y)  def abs: Float = Math.abs(x)  def round: Int = Math.round(x)  def ceil: Float = Math.ceil(x).toFloat  def floor: Float = Math.floor(x).toFloat  /** Converts an angle measured in degrees to an approximately equivalent   *  angle measured in radians.   *   *  @param  x an angle, in degrees   *  @return the measurement of the angle <code>x</code> in radians.   */  def toRadians: Float = Math.toRadians(x).toFloat  /** Converts an angle measured in radians to an approximately equivalent   *  angle measured in degrees.   *   *  @param  x angle, in radians   *  @return the measurement of the angle <code>x</code> in degrees.   */  def toDegrees: Float = Math.toDegrees(x).toFloat  def isNaN: Boolean = System.Single.IsNaN(x)  def isInfinity: Boolean = System.Single.IsInfinity(x)  def isPosInfinity: Boolean = System.Single.IsPositiveInfinity(x)  def isNegInfinity: Boolean = System.Single.IsNegativeInfinity(x)}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?