; math.inc- ; ; Header file for the Art of 64-bit Assembly, v2, ; transcendental function library option casemap:none ifndef math_h math_h = 1 include aoaMacros.inc externdef math_nan:qword externdef math_nan10:tbyte externdef math_inf:qword externdef math_inf10:tbyte externdef math_minf:qword externdef math_minf10:tbyte externdef math_acos:proc externdef math_acot:proc externdef math_acsc:proc externdef math_asec:proc externdef math_asin:proc externdef math_atan:proc externdef math_cos:proc externdef math_csc:proc externdef math_sin:proc externdef math_sec:proc externdef math_tan:proc externdef math_cot:proc externdef math_twoTox:proc externdef math_exp:proc externdef math_tenTox:proc externdef math_yTox:proc externdef math_ln:proc externdef math_log:proc ; Create a namespace for the math member functions ; and data values: math macro arg namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) namespace (&arg, , ) echo ************************** echo Error:bad math member name echo ************************** exitm <.err> endm ; Helper macros for each of the functions. ; If an operand is present, push that value onto ; the FPU stack. If an operand is not present, ; assume the value is already on TOS: math_ifarg macro arg ifnb <&arg> fld arg endif endm math_doln macro arg math_ifarg arg call math_ln endm math_dolog macro arg math_ifarg arg call math_log endm math_doexp macro arg math_ifarg arg call math_exp endm math_dotenTox macro arg math_ifarg arg call math_tenTox endm math_dotwoTox macro arg math_ifarg arg call math_twoTox endm math_dosin macro arg math_ifarg arg call math_sin endm math_docos macro arg math_ifarg arg call math_cos endm math_dotan macro arg math_ifarg arg call math_tan endm math_doacos macro arg math_ifarg arg call math_acos endm math_doacot macro arg math_ifarg arg call math_acot endm math_doacsc macro arg math_ifarg arg call math_acsc endm math_doasec macro arg math_ifarg arg call math_asec endm math_doasin macro arg math_ifarg arg call math_asin endm math_doatan macro arg math_ifarg arg call math_atan endm math_docsc macro arg math_ifarg arg call math_csc endm math_dosec macro arg math_ifarg arg call math_sec endm math_docot macro arg math_ifarg arg call math_cot endm ; Special case for doyTox as it takes two args. ; ; math(yTox) y, x -- good ; math(yTox) -- good ; math(yTox) y -- bad ; math(yTox) , x -- bad math_doyTox macro yArg, xArg ifnb <&xArg> ifnb <&yArg> fld yArg fld xArg else ;nb(xArg), b(yArg) echo ********************* echo Must have zero or two ech0 non-blank arguments echo ********************* .err endif else ;xArg was blank ifnb <&yArg> echo ********************* echo Must have zero or two ech0 non-blank arguments echo ********************* .err else ;;Both are blank endif ;;nb yArg endif ;;nb xArg call math_yTox endm endif ;math_h