Topic: Defect Report : numeric_limits::is_modulo insufficently defined.


Author: "Chris Jefferson" <4zumanga@gmail.com>
Date: Fri, 10 Nov 2006 11:14:26 CST
Raw View
Apologises that I recently posted this in the wrong group
(comp.lang.c++). This message I believe sums up the recent discussion
in comp.std.c++ on this issue. Exactly what value is most useful for
most compilers to give this flag was still being debated, but that is
not the problem here.

18.2.1.2 55 states that "A type is modulo if it is possible to add two
positive numbers together and have a result that wraps around to a
third number that is less".
This seems insufficent for the following reasons:

1) Doesn't define what that value recieved is.
2) Doesn't state the result is repeatable
3) Doesn't require that doing addition, subtraction and other
operations on all values is defined behaviour.

Suggest this text is ammeded to:

"A type is modulo if, given any operation involving +,- or * on values
of that type whose value would fall outside the range [min(), max()],
then the value returned differs from the true value by an integer
multiple of (max() - min() + 1) "

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: M.Kronenburg@inter.nl.net ("Maarten Kronenburg")
Date: Fri, 10 Nov 2006 18:14:31 GMT
Raw View
"Chris Jefferson" wrote in message
> Apologises that I recently posted this in the wrong group
> (comp.lang.c++). This message I believe sums up the recent discussion
> in comp.std.c++ on this issue. Exactly what value is most useful for
> most compilers to give this flag was still being debated, but that is
> not the problem here.
>
> 18.2.1.2 55 states that "A type is modulo if it is possible to add two
> positive numbers together and have a result that wraps around to a
> third number that is less".
> This seems insufficent for the following reasons:
>
> 1) Doesn't define what that value recieved is.
> 2) Doesn't state the result is repeatable
> 3) Doesn't require that doing addition, subtraction and other
> operations on all values is defined behaviour.
>
> Suggest this text is ammeded to:
>
> "A type is modulo if, given any operation involving +,- or * on values
> of that type whose value would fall outside the range [min(), max()],
> then the value returned differs from the true value by an integer
> multiple of (max() - min() + 1) "
>

Currently I am working on a small proposal titled:
"Proposal for exact specification of is_modulo".
I'm not sure when a proposal is required or when
a defect report is sufficient.
Anyway, my small proposal suggests the formula
x = x_min + ( ( x - x_min ) mod ( x_max - x_min + 1 ) )
which amounts to the same as your wording.
In my proposal I will add your wording as extra explanation.

> ---



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: geunnaro_pruota@yahoo.com (Gennaro Prota)
Date: Sat, 11 Nov 2006 01:47:22 GMT
Raw View
On Fri, 10 Nov 2006 11:14:26 CST, Chris Jefferson wrote:

>Apologises that I recently posted this in the wrong group

And now that you posted it in the right group... no "forwarded" note,
once again. I've lost track of how many of such posts haven't reached
the committee. At least three from me, and really a lot from other
contributors.
--
Gennaro Prota
[To mail me, remove any 'u' from the provided address]

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: howard.hinnant@gmail.com (Howard Hinnant)
Date: Sat, 11 Nov 2006 02:07:14 GMT
Raw View
In article <ahaal2pm46mgrnmgpc6332de0eckvbsl1e@4ax.com>,
 geunnaro_pruota@yahoo.com (Gennaro Prota) wrote:

> On Fri, 10 Nov 2006 11:14:26 CST, Chris Jefferson wrote:
>
> >Apologises that I recently posted this in the wrong group
>
> And now that you posted it in the right group... no "forwarded" note,
> once again. I've lost track of how many of such posts haven't reached
> the committee. At least three from me, and really a lot from other
> contributors.

I picked this one up today and created LWG issue 612.  If there are
others that have slipped through the cracks, please feel free to email
me directly (if you do not want public comment on it).

Don't forget:  we're all just a bunch of volunteers as far as the C++
committee is concerned.  Just keep pinging us and we'll try to do better
as time permits.  Perhaps you could even better the system by creating a
queue of issues you see as proposed, but not yet processed by the
committee (just a thought).  Anyway, we're trying, and overwhelmed, and
falling behind, and all help is welcomed.

Howard Hinnant
LWG Chairman

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]