Re: small numerical differences in floating point result between wintel and Sun/SPARC
From: James Van Buskirk (not_valid_at_comcast.net)
Date: 12/15/04
- Next message: Arnaud Desitter: "Re: allocatable array in a type definition?"
- Previous message: Gerry Thomas: "Re: Who uses clapack?notions to pastures."
- In reply to: James Giles: "Re: small numerical differences in floating point result between wintel and Sun/SPARC"
- Next in thread: Richard E Maine: "Re: small numerical differences in floating point result between wintel and Sun/SPARC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 15 Dec 2004 09:41:47 GMT
"James Giles" <jamesgiles@worldnet.att.net> wrote in message
news:BbTvd.1097101$Gx4.553006@bgtnsc04-news.ops.worldnet.att.net...
> But, as I say, I don't think we need to worry about integers that
> happen to have NaN bit patterns when interpreted as floats, or
> other such issues. They will only arise when (and if) the result
> of TRANSFER is actually used in a float operation.
Exactly this is a recurring problem. In the original Pentium
Classic, the widest registers you could access without RDMSR/
WRMSR were its x87 FP stack. Many times people would try to
move data around 64 bits at a time via FLD QWORD PTR x[8*ecx]/
FSTP QWORD PTR y[8*ecx] sequences. They would then be surprised
because some of the data would have one bit changed. The right
way to use the FP stack to move data, of course, was to use
FILD QWOR PTR x[8*ecx]/FISTP QWORD PTR y[8*ecx] because SNANs
would never get loaded into the FP registers in this way. Even
though the instruction timings were worse for the latter
sequence, if the data transfer was between memory locations
this was quite unimportant and using the FP stack with a
carefully unrolled and scheduled loop could be the fastest
way to move big aligned chunks of data around with that processor.
I would have thought it desirable when designing a low-level
primitive like TRANSFER that one might as well assume that the
user knows what he's doing so that for example an implementation
could assume that a user knows what kind of data he's TRANSFERring
into a floating point mold so that it would be OK for the Fortran
processor to touch it with its FPU. The TRANSFER back and forth
clause in the standard document seems to require otherwise,
though. It seems to put some kind of requirement on what a
Fortran processor has to do with the holes in data structures
under some circustances -- what if the result of TRANSFER is
used as an actual argument, then the associated dummy argument...
But maybe I am thinking about this all wrong, and the word 'shall'
in the standard is saying the the Fortran programmer had better
not write expressions where the values and appropriately preserved?
-- write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, & 6.0134700243160014d-154/),(/'x'/)); end P.S. conversion from integer to real and resulting TRANSFER of the real back to integer is the fastest way on some processors to implement a LEADZ function. I'm tired too, so working out an example for IEEE-754 single precision representation is left to the early risers to enjoy with their worms.
- Next message: Arnaud Desitter: "Re: allocatable array in a type definition?"
- Previous message: Gerry Thomas: "Re: Who uses clapack?notions to pastures."
- In reply to: James Giles: "Re: small numerical differences in floating point result between wintel and Sun/SPARC"
- Next in thread: Richard E Maine: "Re: small numerical differences in floating point result between wintel and Sun/SPARC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|