[Cfp-interest 2720] Re: definition of "floating types"

Jim Thomas jaswthomas at sbcglobal.net
Wed Mar 1 20:58:57 PST 2023



> On Mar 1, 2023, at 8:39 AM, Vincent Lefevre <vincent at vinc17.net> wrote:
> 
> On 2023-02-28 14:25:53 -0800, Jim Thomas wrote:
>>> On Feb 28, 2023, at 9:33 AM, Vivian Van Loan <vanloanm at outlook.com> wrote:
>>> 
>>> Rajan and I were discussing it in the chat during the meeting and
>>> came to a possible solution of "and for other values of
>>> FLT_EVAL_METHOD, they are otherwise implementation-defined
>>> floating types
>> 
>> This seems to require the _t types to be defined to
>> implementation-defined types. An implementation might define
>> FLT_EVAL_METHOD to -1 because it sometimes evaluates float to double
>> and sometimes to float; the implementation should be able to define
>> float_t to float or double.
> 
> Is the "evaluation format" associated with float (resp. double)
> necessarily a fixed type?
> 
> For instance, with
> 
>  float f1, f2, f3, f4;
> 
> are f1 + f2 and f3 + f4 necessarily evaluated using the same type?
> If not, ugly things may occur, such as what may be the evaluation
> type of
> 
>  (f1 + f2) * (f3 + f4)
> 
> if this gives x86_extended_prec * double_double? There may be no types
> as wide as both x86_extended_prec and double_double.
> 
> Similar issue (even when the type is fixed) with
> 
>  float f1, f2;
>  double d1, d2;
>  /* ... */
>  (f1 + f2) * (d1 + d2);
> 
> IMHO, the standard should require that the evaluation format
> associated with float be float_t, and similarly for double and
> long double.
> 
> Would this break actual implementations?

Maybe yes. In the past, there were implementations that evaluated expressions in wider registers but (when they ran out of registers) stored intermediate values into narrower storage formats.

Requiring what you suggest would be a substantive change. Would a recommendation be helpful?

- Jim Thomas

> 
> -- 
> Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest




More information about the Cfp-interest mailing list