Denormal floats are something special:
What does the ISO-Prolog standard say on how these should be handled?
It is clear to me that raising a evaluation_error(underflow)
exception whenever these denormals occur is a proper way of dealing with them, but this incurs additional costs—each float produced must be checked.
But what about the "flush denormals to zero" (FTZ) and "treat denormals as zero" (DAZ) operating modes that many processors offer? Can Prolog implementations use these, and, if so, how do they do that properly?
Does (1) documenting the use of these operating modes, (2) ensuring that denormals are flushed to zero of the same sign (FTZ), and (3) ensuring that denormals are treated as zero of the same sign (DAZ) suffice? Help please!