Re: C++Builder and Delphi Exceptions

"Rory Daulton" <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <000901c35536$0676a6a0$6501a8c0@laptop>
Mihai,

> I want as the BCB to return zero for values larger
> than 1E19 or less than 1E-19. If you could write such
> things for me it would be great.

All right, here are three routines that do that (though I assume you
meant -1e19, not 1e-19).  Let me know if you need more.  You should test
these routines.  I don't know how to modify them for BCB.

I should say one more thing.  If you really are encountering X values close
in absolute value to 1e19, something is dicey.  It is OK if you are using
Fourier series or something similar, where the resulting value contributes
little or nothing to the final answer, but the Sin and Cos of such larger
values is pretty meaningless due to precision issues.

Rory Daulton
[email protected]
Campus Crusade for Christ


function RLDSin(X: Double): Double;
asm
        fld     [X]
        fsin
        fnstsw ax
        sahf
        jnp     @@GoodCalc
        fstp    st(0)
        fldz
@@GoodCalc:
end {RLDSin};


function RLDCos(X: Double): Double;
asm
        fld     [X]
        fcos
        fnstsw ax
        sahf
        jnp     @@GoodCalc
        fstp    st(0)
        fldz
@@GoodCalc:
end {RLDCos};


procedure RLDSinCos(Theta: Double; var Sin, Cos: Double);
asm
        fld     [Theta]
        fsincos
        fnstsw ax
        sahf
        jnp     @@GoodCalc
        fstp    st(0)
        fldz
        fldz
@@GoodCalc:
        fstp    qword ptr [edx]
        fstp    qword ptr [eax]
end {RLDSinCos};


---
[This E-mail scanned for viruses by Declude Virus and Nmax "Your MAXimum Connection!"]
[This E-mail scanned for spam by Declude JunkMail and Nmax "Your MAXimum Connection!"] 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.