new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · Runtime · all subjects

binary-data/dataview

2 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

DataView get/set methods

DataView provides getters and setters for reading and writing binary data at specific byte offsets. Getters: getBigInt64(), getBigUint64(), getFloat32(), getFloat64(), getInt16(), getInt32(), getInt8(), getUint16(), getUint32(), getUint8(). Setters: setBigInt64(), setBigUint64(), setFloat32(), setFloat64(), setInt16(), setInt32(), setInt8(), setUint16(), setUint32(), setUint8(). Writing a value that needs more space than the underlying ArrayBuffer has throws a RangeError: Out of bounds access.

DataView example: write and read bytes

To create a DataView and set the first byte to 3: const buf = new ArrayBuffer(4); const dv = new DataView(buf); dv.setUint8(0, 3); dv.getUint8(0); // => 3. To write a Uint16 at byte offset 1 with value 513: dv.setUint16(1, 513); console.log(dv.getUint16(1)); // => 513. Even though the second and third bytes were written with setUint16(), you can still read each component byte with getUint8(): console.log(dv.getUint8(1)); // => 2; console.log(dv.getUint8(2)); // => 1.

Give your agent this brain