zbeyens
zbeyens

Reputation: 331

What is the type of the bytes of UInt32, Int32 and Float32?

To convert UInt32, Int32 and Float32 to bytes (and vice versa), I'm using DataView.

I was asking myself what is the type of the corresponding bytes : Int8 or Uint8 ?

I would say Uint8 for Uint32 and Int8 for Int32, but what about Float32 ?

Upvotes: 0

Views: 603

Answers (1)

nwellnhof
nwellnhof

Reputation: 33658

DataView doesn't "convert UInt32, Int32 and Float32 to bytes", it converts JavaScript Numbers to bytes in UInt32, Int32, and Float32 formats. How the bytes are stored in a DataView and the underlying ArrayBuffer is an implementation detail.

Upvotes: 1

Related Questions