StrictlyNegativeDouble

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
@Serializable(with = StrictlyNegativeDoubleSerializer::class)
class StrictlyNegativeDouble

Represents a floating-point number of type Double that is less than zero.

You can use the StrictlyNegativeDouble.Companion.create or the StrictlyNegativeDouble.Companion.createOrNull functions for creating an instance of this type.


Serialization and deserialization

The serialization and the deserialization processes of this type should behave like for the Double type.

Here's an example of Kotlin code that encodes and decodes this type using the JavaScript Object Notation (JSON) format from kotlinx.serialization:

val number: StrictlyNegativeDouble = StrictlyNegativeDouble.create(-42)
val encoded: String = Json.encodeToString(number)
println(encoded) // -42.0
val decoded: StrictlyNegativeDouble = Json.decodeFromString(encoded)
println(decoded == number) // true

Types

Link copied to clipboard
object Companion

Contains static declarations for the StrictlyNegativeDouble type.

Functions

Link copied to clipboard
operator override fun equals(other: Any?): Boolean

Returns true if the other object is a StrictlyNegativeDouble having the same value as this floating-point number, or returns false otherwise.

Link copied to clipboard
override fun hashCode(): Int

Returns a hash code value for this floating-point number.

Link copied to clipboard

Returns this floating-point number as Double.

Link copied to clipboard
override fun toString(): String

Returns the string representation of this floating-point number.