writeDouble
Writes eight bytes of a bit representation of double, in the big-endian order, to this sink. Bit representation of the double corresponds to the IEEE 754 floating-point "double format" bit layout.
To obtain a bit representation, the Double.toBits function is used.
Should be used with care when working with special values (like NaN
) as bit patterns obtained for Double.NaN may vary depending on a platform.
Parameters
double
the floating point number to be written.
Throws
when the sink is closed.
when some I/O error occurs.
Samples
import kotlinx.io.*
import kotlin.test.*
fun main() {
//sampleStart
val buffer = Buffer()
buffer.writeDouble(123456.78901)
assertContentEquals(byteArrayOf(64, -2, 36, 12, -97, -56, -13, 35), buffer.readByteArray())
//sampleEnd
}