[m-rev.] for review: conversion of 8- and 16-bit integers to floats

Peter Wang novalazy at gmail.com
Tue Oct 9 15:36:27 AEDT 2018


On Mon, 8 Oct 2018 02:44:06 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:
> diff --git a/library/float.m b/library/float.m
> index d9b3c68..ad4a3bc 100644
> --- a/library/float.m
> +++ b/library/float.m
...
> +    % Convert a signed 8-bit integer into a float.
> +    % Always succeeds as all signed 8-bit integers have an exact
> +    % floating-point representation.
> +    %
> +:- func from_int8(int8) = float.
> +
> +    % Convert an unsigned 8-bit integer into a float.
> +    % Always succeeds as all unsigned 8-bit integers have an exact
> +    % floating-point representation.
> +    %
> +:- func from_int16(int16) = float.

signed 16-bit

> +
> +    % Convert a signed 16-bit integer into a float.
> +    % Always succeeds as all signed 16-bit integers have an exact
> +    % floating-point representation.
> +    %
> +:- func from_uint8(uint8) =  float.

unsigned 8-bit

> +
> +    % Convert an unsigned 16-bit integer into a float.
> +    % Always succeeds as all unsigned 16-bit integers have an exact
> +    % floating-point representation.
> +    %
> +:- func from_uint16(uint16) = float.

That's fine otherwise.

Peter


More information about the reviews mailing list