This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

547. division should be floating-point, not integer

Section: 29.5 [rand], 99 [tr.rand] Status: NAD Submitter: Matt Austern Opened: 2006-01-10 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [rand].

View all issues with NAD status.

Discussion:

Paragraph 10 describes how a variate generator uses numbers produced by an engine to pass to a generator. The sentence that concerns me is: "Otherwise, if the value for engine_value_type::result_type is true and the value for Distribution::input_type is false [i.e. if the engine produces integers and the engine wants floating-point values], then the numbers in s_eng are divided by engine().max() - engine().min() + 1 to obtain the numbers in s_e." Since the engine is producing integers, both the numerator and the denominator are integers and we'll be doing integer division, which I don't think is what we want. Shouldn't we be performing a conversion to a floating-point type first?

Proposed resolution:

Rationale:

Recommend NAD as the affected section is now gone and so the issue is moot. N2111.