Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* CPYSE what is it good for?
@ 2004-02-23 17:49 Albert van der Horst
  0 siblings, 0 replies; only message in thread
From: Albert van der Horst @ 2004-02-23 17:49 UTC (permalink / raw)


I am experimenting with assembler on my DEC Alpha (XL266, 21064A)

What I want to do is trim a g-floating consistently to 24 bits.
That is the same 24 bits each time.
1.11011...001|0101.. * 2^48  --> 111011....001
0.11011...001|0101.. * 2^48  --> 011011....001
             ^
             24 bit boundary.
Of course CVTGF will (in the second case) bring one more bit into
play. (Which in this case would be zero).
It starts off with the number 1.1011..*2^47 .
Of course in the above case you can multiply by 2^-24 and
the do CVTGL CVTLG and multiply back by 2^24.

This made me discover CPYSE .
CPYSE Ra Rb Rc
copies sign and exponent from Ra and fraction from Rb into Rc.

The manual says
"Floating values can be scaled to a known range using CPYSE"
But I wonder what CPYSE can be good for because essential data
is lost :
Say Rb has exponent 0 then both
        1.11011.. *2^48    -->     1.11011.. *2^0
        1.11011.. *2^47    -->     1.11011.. *2^0
are mapped to the same number. Because you never know when an
underflow occurs in fp arithmetic, this looks pretty lame.

So CPYSE seem utterly worthless to me. Can anyone shed some light
on this? (Maybe an example where it is useful.)

Groetjes Albert
--
-- 
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
        One man-hour to invent,
                One man-week to implement,
                        One lawyer-year to patent.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-02-23 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-23 17:49 CPYSE what is it good for? Albert van der Horst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox