function writeFloat64(bufferWriter, value) {
  bufferWriter.writeByte(FLOAT64);
  if (value === 0) {
    // Canonicalize 0
    bufferWriter.writeFloat64(0, false); // big end
  } else if (Number.isNaN(value)) {
    // Canonicalize NaN
    // @ts-expect-error using frozen array as Uint8Array
    bufferWriter.write(NAN64);
  } else {
    bufferWriter.writeFloat64(value, false); // big end
  }
}
@param {import('./buffer-writer.js').BufferWriter} bufferWriter
@param {number} value