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

From WikiTI
Jump to: navigation, search
 
m (formatting)
 
Line 19: Line 19:
 
== Example ==
 
== Example ==
 
  <nowiki>B_CALL OP1Set3  ;OP1=floating point 3
 
  <nowiki>B_CALL OP1Set3  ;OP1=floating point 3
B_CALL SqRoot ;returns with OP1=floating point 1.7320508075689
+
B_CALL SqRoot   ;returns with OP1=floating point 1.7320508075689
 
ld d,2
 
ld d,2
B_CALL Round ;returns with OP1=1.73</nowiki>
+
B_CALL Round   ;returns with OP1=1.73</nowiki>

Latest revision as of 14:23, 27 March 2006

Synopsis

Official Name: Round

BCALL Address: 40A8

Rounds OP1 to the Nth decimal place where N is specified by register D.

Inputs

  • D = number of decimal digits to round to
  • OP1 = floating point

Outputs

  • OP1 = OP1 rounded to an integer

Destroys

  • AF, BC, HL

Example

B_CALL OP1Set3  ;OP1=floating point 3
B_CALL SqRoot   ;returns with OP1=floating point 1.7320508075689
ld d,2
B_CALL Round    ;returns with OP1=1.73