scala

# Float

#### final class Float extends AnyVal

`Float` is a member of the value classes, those whose instances are not represented as objects by the underlying host system.

There is an implicit conversion from Float => RichFloat which provides useful non-primitive operations.

Source
  Float.scala

Linear Supertypes
AnyVal, Any
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. Hide All
2. Show all

1. Float
2. AnyVal
3. Any

Visibility

1. Public
2. All

### Value Members

1. #### def !=(x: Double): Boolean

2. #### def !=(x: Float): Boolean

3. #### def !=(x: Long): Boolean

4. #### def !=(x: Int): Boolean

5. #### def !=(x: Char): Boolean

6. #### def !=(x: Short): Boolean

7. #### def !=(x: Byte): Boolean

8. #### final def !=(arg0: Any): Boolean

   Test two objects for inequality.

   Test two objects for inequality.

   returns

     `true` if !(this == that), false otherwise.

   Definition Classes
     Any

9. #### final def ##(): Int

   Equivalent to `x.hashCode` except for boxed numeric types.

   Equivalent to `x.hashCode` except for boxed numeric types. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them.

   returns

     a hash value consistent with ==

   Definition Classes
     Any

10. #### def %(x: Double): Double

11. #### def %(x: Float): Float

12. #### def %(x: Long): Float

13. #### def %(x: Int): Float

14. #### def %(x: Char): Float

15. #### def %(x: Short): Float

16. #### def %(x: Byte): Float

17. #### def *(x: Double): Double

18. #### def *(x: Float): Float

19. #### def *(x: Long): Float

20. #### def *(x: Int): Float

21. #### def *(x: Char): Float

22. #### def *(x: Short): Float

23. #### def *(x: Byte): Float

24. #### def +(x: Double): Double

25. #### def +(x: Float): Float

26. #### def +(x: Long): Float

27. #### def +(x: Int): Float

28. #### def +(x: Char): Float

29. #### def +(x: Short): Float

30. #### def +(x: Byte): Float

31. #### def +(x: String): String

32. #### def -(x: Double): Double

33. #### def -(x: Float): Float

34. #### def -(x: Long): Float

35. #### def -(x: Int): Float

36. #### def -(x: Char): Float

37. #### def -(x: Short): Float

38. #### def -(x: Byte): Float

39. #### def /(x: Double): Double

40. #### def /(x: Float): Float

41. #### def /(x: Long): Float

42. #### def /(x: Int): Float

43. #### def /(x: Char): Float

44. #### def /(x: Short): Float

45. #### def /(x: Byte): Float

46. #### def <(x: Double): Boolean

47. #### def <(x: Float): Boolean

48. #### def <(x: Long): Boolean

49. #### def <(x: Int): Boolean

50. #### def <(x: Char): Boolean

51. #### def <(x: Short): Boolean

52. #### def <(x: Byte): Boolean

53. #### def <=(x: Double): Boolean

54. #### def <=(x: Float): Boolean

55. #### def <=(x: Long): Boolean

56. #### def <=(x: Int): Boolean

57. #### def <=(x: Char): Boolean

58. #### def <=(x: Short): Boolean

59. #### def <=(x: Byte): Boolean

60. #### def ==(x: Double): Boolean

61. #### def ==(x: Float): Boolean

62. #### def ==(x: Long): Boolean

63. #### def ==(x: Int): Boolean

64. #### def ==(x: Char): Boolean

65. #### def ==(x: Short): Boolean

66. #### def ==(x: Byte): Boolean

67. #### final def ==(arg0: Any): Boolean

    Test two objects for equality.

    Test two objects for equality.

    returns

      `true` if the receiver object is equivalent to the argument; `false` otherwise.

    Definition Classes
      Any

68. #### def >(x: Double): Boolean

69. #### def >(x: Float): Boolean

70. #### def >(x: Long): Boolean

71. #### def >(x: Int): Boolean

72. #### def >(x: Char): Boolean

73. #### def >(x: Short): Boolean

74. #### def >(x: Byte): Boolean

75. #### def >=(x: Double): Boolean

76. #### def >=(x: Float): Boolean

77. #### def >=(x: Long): Boolean

78. #### def >=(x: Int): Boolean

79. #### def >=(x: Char): Boolean

80. #### def >=(x: Short): Boolean

81. #### def >=(x: Byte): Boolean

82. #### final def asInstanceOf[T0]: T0

    Cast the receiver object to be of type `T0`.

    Cast the receiver object to be of type `T0`.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression `1.asInstanceOf[String]` will throw a `ClassCastException` at runtime, while the expression `List(1).asInstanceOf[List[String]]` will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

      the receiver object.

    Definition Classes
      Any
    Exceptions thrown
      ClassCastException

      if the receiver object is not an instance of the erasure of type `T0`.

83. #### def equals(arg0: Any): Boolean

    Compares the receiver object (`this`) with the argument object (`that`) for equivalence.

    Compares the receiver object (`this`) with the argument object (`that`) for equivalence.

    The default implementations of this method is an equivalence relation:

    - It is reflexive: for any instance `x` of type `Any`, `x.equals(x)` should return `true`.
    - It is symmetric: for any instances `x` and `y` of type `Any`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
    - It is transitive: for any instances `x`, `y`, and `z` of type `AnyRef` if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override `hashCode` to ensure that objects which are "equal" (`o1.equals(o2)` returns `true`) hash to the same Int. (`o1.hashCode.equals(o2.hashCode)`).

    returns

      `true` if the receiver object is equivalent to the argument; `false` otherwise.

    Definition Classes
      Any

84. #### def getClass(): Class[Float]

    Returns the runtime class representation of the object.

    Returns the runtime class representation of the object.

    returns

      a class object corresponding to the static type of the receiver

    Definition Classes
      Float → Any

85. #### def hashCode(): Int

    Calculate a hash code value for the object.

    Calculate a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (`o1.hashCode.equals(o2.hashCode)`) yet not be equal (`o1.equals(o2)` returns `false`). A degenerate implementation could always return `0`. However, it is required that if two objects are equal (`o1.equals(o2)` returns `true`) that they have identical hash codes (`o1.hashCode.equals(o2.hashCode)`). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the `equals` method.

    returns

      the hash code value for this object.

    Definition Classes
      Any

86. #### final def isInstanceOf[T0]: Boolean

    Test whether the dynamic type of the receiver object is `T0`.

    Test whether the dynamic type of the receiver object is `T0`.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression `1.isInstanceOf[String]` will return `false`, while the expression `List(1).isInstanceOf[List[String]]` will return `true`. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

      `true` if the receiver object is an instance of erasure of type `T0`; `false` otherwise.

    Definition Classes
      Any

87. #### def toByte: Byte

88. #### def toChar: Char

89. #### def toDouble: Double

90. #### def toFloat: Float

91. #### def toInt: Int

92. #### def toLong: Long

93. #### def toShort: Short

94. #### def toString(): String

    Returns a string representation of the object.

    Returns a string representation of the object.

    The default representation is platform dependent.

    returns

      a string representation of the object.

    Definition Classes
      Any

95. #### def unary_+: Float

96. #### def unary_-: Float

### Inherited from AnyVal

### Inherited from Any