Public Comment Number PC-UK0264 ISO/IEC CD2 9899 (SC22N2794) Public Comment =========================================== Date: 1998-09-22 Author: N.M Maclaren Author Affiliation: Self Postal Address: University of Cambridge, Computer Laboratory, New Museums Site, Pembroke Street, Cambridge CB3 3QG, United Kingdom E-mail Address: Telephone Number: +44 1223 334761 Fax Number: +44 1223 334679 Category: Feature that should be included Committee Draft subsection: 7.8.2 Title: functions for intmax_t and uintmax_t Detailed description: Because of the change in the status of the long type, it is necessary to change many or all uses of that type in many important C89 programs to other types (often intmax_t). It is highly desirable that it should be straightforward to do this by automatic textual processing, but should still produce an efficient result; one obstacle to this is the lack of equivalents to the labs and ldiv functions for the maximum length types. The following should be added to 7.8, after paragraph 1: It declares the type maxdiv_t which is a structure type that is the type of the value returned by the maxdiv function. And the following should be added to 7.8.2: 7.8.2.3 The maxabs function Synopsis [#1] #include intmax_t maxabs(intmax_t j); Description [#2] The maxabs function computes the absolute value of an integer j. If the result cannot be represented, the behavior is undefined. [#3] The maxabs function returns the absolute value. 7.8.2.4 The maxdiv function Synopsis [#1] #include maxdiv_t maxdiv(intmax_t numer, intmax_t denom); Description [#2] The maxdiv function computes numer / denom and numer % denom in a single operation. Returns [#3] The maxdiv function returns a structure of type maxdiv_t, comprising both the quotient and the remainder. The structure shall contain (in either order) the members quot (the quotient) and rem (the remainder), each of which have the same type as the arguments numer and denom. If either part of the result cannot be represented, the behavior is undefined.