946. duration_cast improperly specified

Section: 29.5.8 [time.duration.cast] Status: NAD Submitter: Pete Becker Opened: 2008-12-20 Last modified: 2016-01-28 10:19:27 UTC

Priority: Not Prioritized

View all other issues in [time.duration.cast].

View all issues with NAD status.


29.5.8 [time.duration.cast]/3:

.... All intermediate computations shall be carried out in the widest possible representation... .

So ignoring floating-point types for the moment, all this arithmetic has to be done using the implementation's largest integral type, even if both arguments use int for their representation. This seems excessive. And it's not at all clear what this means if we don't ignore floating-point types.

This issue is related to 952.

[ Howard adds: ]

The intent of this remark is that intermediate computations are carried out using:

common_type<typename ToDuration::rep, Rep, intmax_t>::type

The Remark was intended to be clarifying prose supporting the rather algorithmic description of the previous paragraph. I'm open to suggestions. Perhaps the entire paragraph 3 (Remarks) would be better dropped?

[ Batavia (2009-05): ]

We view this as a specific case of issue 952, and should be resolved when that issue is resolved.

Move to NAD.

Proposed resolution: