NAME

fix2flt - convert a value or values from fixed-point to floating-point

SYNOPSIS

val.fix2flt(typ)

DESCRIPTION

val must be a Byte, Ubyte, Short, Ushort, or an array of those types
typ must be one of Half, Float, or Double

fix2flt converts a value or array of values from 8- or 16-bit signed or unsigned integers to the specified floating point type (Half, Float, or Double). The result is clamped to the range -1.0 to 1.0, inclusive. The conversion factors are:

Source type Multiplier
Byte 1./127.
Ubyte 1./255.
Short 1./32767.
Ushort 1./65535.

RETURN VALUE

A floating point value of the specified Type typ

ERRORS

TypeCheck is thrown if typ is not a Type
RangeCheck is thrown if typ is not one of the scalar floating point types
TypeCheck is thrown if val does not have a short integral type

EXAMPLE

    {127b, 255ub, 32767s, 65535us}->fix2flt(Float)
1. 1. 1. 1.

SEE ALSO

flt2fix