[Cfp-interest 2773] Re: CFP review of NB comments on CD2 - 20230602

Jim Thomas jaswthomas at sbcglobal.net
Tue Jun 6 21:09:04 PDT 2023


The example offered isn’t about floating-point exceptions. You could have a similar example for int instead of double. The text in 9.1, “Therefore, between function calls, floating-point exceptions need not be precise: …”, doesn’t mean you can delay an operation just because it is exceptional.

- Jim Thomas

> On Jun 6, 2023, at 3:22 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> On Tue, 6 Jun 2023 11:35:26 -0700 Hans Boehm wrote:
>> 
>>> Could you give a specific example illustrating your concern? I'm
>> currently confused.
> 
> Perhaps:
> 
> #define LOCK(S) while( ++S != 1){ --S ; }
> #define UNLOCK(S) --S;
> 
> static _Atomic int state = 0;
> static _Atomic int done = 0;
> static double d = 0.0;
> 
> int main( void ){
> .... start 2nd thread ...
> .... this is 1st thread ...
>  LOCK(state);
>  done = 1;
>  d /= 0.0;     /* without function call, this can be delayed after UNLOCK */
>  UNLOCK(state);
> ...
>    }
> 
> ... 2nd thread ...
>  for(int div_done=0; 0==div_done;){
>    LOCK(state);
>    if( done != 0 ){
>      div_done = 1;
>    }
>    UNLOCK(state);
>  }
>  d = 1.0;      /* if d /= 0.0; is delayed, this could be concurrent  */
>                /* d could be 1.0 or NaN or unknown value */
>  if( 1.0 != d ){
> ...
> 
> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com      Testing, numerics, programming
> +1 (702) 608-6093      Vice-chair of INCITS/C (ANSI "C")
> Sample C17+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.
> 
> _______________________________________________
> 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