Rounding Mode

discussion of forwardcom instruction set and corresponding hardware and software

Moderator: agner

Post Reply
damianmoz
Posts: 9
Joined: 2023-11-26, 0:05:59

Rounding Mode

Post by damianmoz »

I am assuming that a rounding mode of 000 in Table 3.3 used for both floating point arithmetic and in the round on Page 27 is more strictly defined as
... round to nearest with ties to even

In the round instruction, will the following be supported into the future:
... round to nearest with ties to odd
and
... round to nearest with ties away from zero
and (maybe for symmetry)
... round to nearest with ties towards zero
Or should this functionality be done as an elementary function.

What rounding is used for Augmented Addition?

How can I use a mul_add to produce the same result as an IEEE 754 Augmented Multiplication.
agner
Site Admin
Posts: 177
Joined: 2017-10-15, 8:07:27
Contact:

Re: Rounding Mode

Post by agner »

I have added the rounding mode "odd if not exact" in the compress instruction because this is needed in a two step reduction: double precision -> single precision -> half precision.

Other rounding modes can be added if they are needed. Do you have any good use cases for the rounding modes you propose?

BTW, I have added rounding modes to integer division. This is something that is missing in existing architectures.

Augmented addition has the optional rounding mode specified in the same way as normal addition. Nearest with ties to even is the default if you don't specify otherwise.
damianmoz
Posts: 9
Joined: 2023-11-26, 0:05:59

Re: Rounding Mode

Post by damianmoz »

Thanks for the update on augmented addition. I like your approach. I find the IEEE 754 approach of mandating "round to nearest ties towards zero" is overly prescriptive although I understand and sympathize why they chose that if they had to run with a single rounding mode.

There are 3 missing cases.

I use "round to nearest ties away from zero" for most of my own coding which are engineering applications. Whether that is a good reason to continue is another thing altogether but I cannot see myself changing after 30 years.

I recently noticed (I think some papers from INRIA) that there are some problems where round to nearest with ties to odd is optimal. I will try and dig it up. I am not going to argue with that team. They are smarter than I am. I thought it was a paper by Sylvie Boldo but I could be wrong.

And as I said, "round to nearest ties towards zero" is the mode used in IEEE 754 2019's augmented operations.

How do you achieve (easily) augmented multiplication without an explicit instruction? If I wanted to use round to nearest, ties to even, I would do
... float xy = mul_add(x, y, 0.0);
... float dxy = mul_add(x, y, -xy);

but that is not quite in the spirit of IEEE 754 2019.
Post Reply