andrea.giammarchi at gmail.com
Fri Nov 21 02:48:28 PST 2014
I think this is another missed train/opportunity for the long-time-ago
discussed ArrayType which would give the ability to define any sort of
typed collection together with StructType, somehow forgotten too, and new
primitives such Type.int16, Type.uint16, Type.int32 and all possible others.
You can indeed find current types here:
unfortunately float16 is missing, as well as int64 and uint64 ... I hope
these three will be introduced too.
The numeric value types are:
- uint8, uint8Clamped : 8-bit unsigned integers
- uint16 : 16-bit unsigned integers
- uint32 : 32-bit unsigned integers
- int8 : 8-bit signed integers
- int16 : 16-bit signed integers
- int32 : 32-bit signed integers
- float32 : 32-bit IEEE754 floating-point numbers
- float64 : 64-bit IEEE754 floating-point numbers
Each numeric value type’s coercion is the standard coercion, except for
uint8Clamped, which performs a saturating coercion.
The other value types are:
- boolean : ECMAScript primitive boolean
- string : ECMAScript primitive string
The coercions associated with these types are the standard ECMAScript
algorithms [[ToBoolean]] and [[ToString]], respectively.
On Fri, Nov 21, 2014 at 8:52 AM, Florian Bösch <pyalot at gmail.com> wrote:
> Typed arrays today are specified with support for Float32Array,
> A useful additional data type would be Float16Array. It's useful because
> GPUs (particularly mobiles) have support for it, and because VRAM and
> bandwidth limits are a legitimate concern (particularly for mobiles).
> GPU support for it appears in the following forms:
> - Desktop OpenGL ARB_half_float_pixel: support for half-float textures
> - Desktop OpenGL ARB_half_float_vertex: support for half-float vertex
> - Desktop OpenGL 2.1 core specification, extended support in 3.0
> - Mobile OES_texture_float: support for half-float textures
> - Mobile OES_vertex_half_float: support for half-float vertex data
> - Mobile EXT_color_buffer_half_float: support to render to half-float
> render targets
> - Mobile OpenGL ES 3.0 core specification.
> - WebGL OES_texture_half_float: support for half-float textures
> - WebGL OES_texture_half_float_linear: support for half-float texture
> linear filtering
> - WebGL EXT_color_buffer_half_float: support for half-float render
> - WebGL 2.0 core specification
> These types are defined per IEEE 753-2008
> - binary16, common: half
> - binary32, common: single
> - binary64, common: double
> It is possible today to service half-float data types trough JS, by
> performing the conversion in JS. The code for this is however rather
> complex and it's difficult to implement all of IEEE 753-2008 correctly (my
> version doesn't support rounding quite correctly
> http://codeflow.org/experiment/half-float/main.js). It may also be
> unnecessarily slow. Convenience is also an issuebecause JS can't override
> the array access  operator to do the job.
> I'd like to propose adding Float16Array to the typed array specification.
> If JS accesses arrays like these, appropriate conversion is applied (as is
> the case for any other non JS-native numerical type)
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss