Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Math.f16round()

2 tags 1 category

The Math.f16round() static method returns the nearest 16-bit half precision float representation of a number.

Math.f16round is the 16-bit counterpart of Math.fround(). It is intended to smooth some rough edges when interacting with float16 numbers, such as when reading from a Float16Array. Internally, JavaScript continues to treat the number as a 64-bit float, it just performs a “round to even” on the 10th bit of the mantissa, and sets all following mantissa bits to 0. If the number is outside the range of a 16-bit float, Infinity or -Infinity is returned.

Because f16round() is a static method of Math, you always use it as Math.f16round(), rather than as a method of a Math object you created (Math is not a constructor).

Syntax example: Math.f16round(doubleFloat)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…