Boost logo

Boost :

From: jvd (vygis_d_at_[hidden])
Date: 2003-07-04 11:51:24


[snip]

> > does not work correctly on some machines.
>
> Could you be more specific. On which machines for instance ?

Me, myself personally tested on Intel Celeron 733, OS WinXP.
Compiler used: gcc 3.2 mingw port for windows.

Also reported not to work on Sun machine although on some other computers
this works.

That mean sometimes this work and sometimes not :)
Depends on processor perhaps, because I've read asm output (I'm just a crap
when it comes to x86 asm reading but...):

// g++ -save-temps -O0 (to avoid overoptimizations when variable comparison
to itself is just replaced with some boolean constant)

There we have is_nan for floats -

 .section .text$_ZN4math4geom6is_nanIfEEbRKT_,"x"
 .linkonce discard
 .align 2
.globl __ZN4math4geom6is_nanIfEEbRKT_
 .def __ZN4math4geom6is_nanIfEEbRKT_; .scl 2; .type 32; .endef
__ZN4math4geom6is_nanIfEEbRKT_:
LFB29:
                      // function prologue
 pushl %ebp
LCFI225:
 movl %esp, %ebp
LCFI226:
 movl 8(%ebp), %eax
 movl 8(%ebp), %edx
                     // operations on stack, sweet

 flds (%eax) // load the same
 flds (%edx) // variable to 2 copr. registers
 fxch %st(1)
 fucompp // comparison (x != x), obviously
 fnstsw %ax
 andb $69, %ah
 xorb $64, %ah
 setne %al
 andl $255, %eax // && std::numeric_limits<float>::has_quiet_NaN

 popl %ebp // function epilogue
ret

Seems like this is not compilers fault. Correct me if I'm wrong. And as me
uses intervals lib and is_nan f-tion, specifically; I'm really concerned
about such problems. If workaround is needed and it's not so simple, perhaps
it could be separated from certain library and moved itself to
numeric_utility.hpp or something?

Respect,
Justinas V.D.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk