RE: [vhdl-200x] [RFC] Rounding functions proposal

From: <ryan.w.hinton@L-3com.com>
Date: Mon May 20 2013 - 11:22:43 PDT
There are several options missing from Matlab.  (Use a fixed-width font
for easiest viewing.)

| Mode       | Description                                   
| ceil       | Round to plus infinity 
| floor      | Round to minus infinity 
| fix        | Round to zero 
| (not def)  | Round away from zero
-------------------------------
| nearest    | Round to nearest; ties to greatest absolute value (away
from zero)
| (not def)  | Round to nearest; ties to towards zero 
| (not def)  | Round to nearest; ties to negative infinity 
| round      | Round to nearest; ties to plus infinity 
| convergent | Round to nearest; ties to closest even 

As you suggest, I favor adding all the cases for symmetry.

- Ryan

-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf
Of nkavvadias
Sent: Monday, May 20, 2013 9:45 AM
To: vhdl-200x@eda.org
Subject: Re: [vhdl-200x] [RFC] Rounding functions proposal

Hi David and Ryan,

>> I believe the resize function in fixed_pkg already provides the 
>> beginning of the rounding capabilities you describe.  I would rather 
>> expand the fixed_round_style options and then add some or all of the 
>> functions you describe to call resize with the appropriate 
>> fixed_round_style.

Since the infrastructure is there, this seems the proper way of
implementing the additional rounding modes.

> The current enumeration handles two of the eight possibilities. Matlab

> doesn't (directly) offer two of the eight.

Indeed, the MATLAB language offers ceil, floor, fix, round, nearest,
convergent.

A quick overview of these modes follows (just for reference):

| Mode          | Description |
| ceil              | Round to plus infinity |
| floor             | Round to minus infinity |
| fix                | Round to zero |
| nearest       | Round to nearest; ties to greatest absolute value |
| round          | Round to nearest; ties to plus infinity |
| convergent | Round to nearest; ties to closest even |

Ryan: do you mean that some rounding modes e.g. round to nearest; ties
to minus infinity are missing?
Such cases could be added for symmetry and in order to have all options
there.

> My plan was to implement the new rounding functions as described int 
> IEEE-754-2008 in both fixed and floating point.    Options were made 
> in the original packages to allow for more rounding modes.

Indeed, the same principles apply to floating-point rounding.

Best regards
Nikolaos Kavvadias
CEO
Ajax Compilers
Athens, Greece


--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon May 20 11:23:24 2013

This archive was generated by hypermail 2.1.8 : Mon May 20 2013 - 11:24:07 PDT