CMathClass is a global singleton implementing the JavaScript Math object for XAP scripts. Exposes standard math functions (sin, cos, floor, etc.) and constants (PI, E, etc.). Backed by math_node.cpp in the active source tree.
Function names found in the binary string table:
abs,acos,asin,atan,atan2ceil,cos,exp,floor,logmax,min,pow,random,roundsin,sqrt,tan,itoa
CMathClass_absat0x00032af0CMathClass_floorat0x000223e4CMathClass_ceilat0x000223c4CMathClass_roundat0x00022418CMathClass_randomat0x00022410CMathClass_sqrtat0x00022434CMathClass_powat0x00022408CMathClass_atan2at0x000223b8
g_Math at 0x0001a508. Constructor populates JS Math constants. Not reference counted.
- All math wrappers are thin CRT calls (fabsf, sinf, cosf, etc.)
atan2(y, x)passes args reversed to match JS conventionitoaconverts int to Unicode string via CRT_itoa+Unicode()
CMathClass::CMathClass (0x00032950) registers the class as "Math" and loads E, LN2, LN10, LOG2E,
LOG10E, PI, SQRT1_2 and SQRT2 from 0x0002c034..0x0002c04c. LOG2E and LOG10E are stored as 1.442
and 0.434. round (0x00032b60) is (int)(n + 0.5), random (0x00032b40) is rand() / 32767,
and max/min (0x00032af0, 0x00032b10) return the second argument on a tie.