StrictlyNegativeDouble
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
@Serializable(with = StrictlyNegativeDoubleSerializer::class)
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
Content copied to clipboard
Types
Link copied to clipboard
object Companion
Contains static declarations for the StrictlyNegativeDouble type.