float32 Type
Info
Due to the nature of float32 storage, it may lose precision in some cases. For example, 3.141592653 will be stored as 3.141592741, and 123456789 will be rounded to 123456792. If you need higher precision, use float64.
Information
- Used to describe floating-point numbers.
float32provides approximately 6-7 decimal significant digits of precision.float32supports special values±0,±Infinity,NaN- Use
numberfor assignment.
Example Usage
import { Serializer, t } from "encodexx"
const serializer = new Serializer({ info: { pi: t.float32, inf: t.float32, nan: t.float32, }})
serializer.encode({ info: { pi: 3.14159, inf: -Infinity, nan: NaN }});