Difference between revisions of "83Plus:BCALLs:40C0"

From WikiTI
Jump to: navigation, search
 
(Comments)
Line 18: Line 18:
 
* OP1-OP5
 
* OP1-OP5
  
=== Comments ===
+
 
The cycle count for this routine is very high because the algorithm uses an infinite series to approximate the cosine.  Where speed is critical, a trig table should be used.
+
  
 
== Example ==
 
== Example ==
 
  <nowiki>B_CALL OP1Set3  ;OP1=floating point 3
 
  <nowiki>B_CALL OP1Set3  ;OP1=floating point 3
 
B_CALL cos  ;returns with OP1=-0.9899924...</nowiki>
 
B_CALL cos  ;returns with OP1=-0.9899924...</nowiki>

Revision as of 07:09, 3 August 2005

Synopsis

Official Name: cos

BCALL Address: 40C0

Computes the cosine of OP1 and returns the result in OP1.

Inputs

  • OP1 = floating point

Outputs

  • OP1 = cosine of OP1
  • Approx. TStates: 150,000 to 200,000

Destroys

  • AF, BC, DE, HL
  • OP1-OP5


Example

B_CALL OP1Set3  ;OP1=floating point 3
B_CALL cos  ;returns with OP1=-0.9899924...