Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Inexact floating-point compare



Terje Mathisen wrote:
> 
> Fred J. Tydeman wrote:
> 
> > Does anyone know of any machines, that have a floating-point compare
> > instruction, where that instruction is not exact?  That is, some of
> > the value bits of the floating-point numbers are ignored.  Or, if
> > the compare is done internally as a subtract, the subtract results in
> > an underflow (so two different numbers near the minimum normalized
> > value, when subtracted produce a subnormal number) that is then
> > flushed to zero, so compare equal.
> 
> The easiest method would seem to be a subtract, scale, add and compare:

I am not looking for a way to simulate.  

My hypothesis is all machines are exact when they do floating-point
compares.
I am looking for a counter-example, i.e., a machine that is inexact when
it 
does compares (==, !=, <=, <, >, >=).

> double inexact_compare(double a, double b, int bits_to_skip)
> {
>    // First the the regular difference:
>    double diff = b - a;

That subtract can underflow (with subnormal difference flushed to zero) 
and it can overflow (which might be OK if an appropriate signed infinity
were produced; you know the numbers are very different).
---
Fred J. Tydeman        Tydeman Consulting
[EMAIL PROTECTED]      Programming, testing, numerics
+1 (775) 287-5904      Vice-chair of J11 (ANSI "C")
Sample C99+FPCE tests: ftp://jump.net/pub/tybor/
Savers sleep well, investors eat well, spenders work forever.



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.