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(-4.2)
val encoded: String = Json.encodeToString(number)
assertEquals(expected = "-4.2", actual = encoded)
val decoded: StrictlyNegativeDouble = Json.decodeFromString(encoded)
assertEquals(expected = number, actual = decoded)
Content copied to clipboard
Types
Link copied to clipboard
object Companion
Contains static declarations for the StrictlyNegativeDouble type.