📄 function.ref
字号:
Example: M_APM apmresult, apm_num1, apm_num2; int decimal_places; m_apm_divide(apmresult, decimal_places, apm_num1, apm_num2); This function will divide apm_num1 by apm_num2 and put the result in 'apmresult'. The 'apmresult' parameter cannot be one of the other MAPM parameters. Unlike the other three basic operations, division cannot be counted on to produce non-repeating decimals, so the 'decimal_places' variable is used to tell this routine how many digits are to be calculated before stopping. Note that the number of decimal places is referenced to the value as if the number was in fixed point notation. m_apm_divide is the only function where decimal places is referenced to fixed point notation, all other functions are referenced to scientific notation. This was an intentional design decision so 'm_apm_integer_divide' and 'm_apm_integer_div_rem' would work as expected. Division by zero creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_integer_divide(M_APM, M_APM, M_APM);Example: M_APM apmresult, apm_num1, apm_num2; m_apm_integer_divide(apmresult, apm_num1, apm_num2); This function will divide apm_num1 by apm_num2, truncating the result to an integer and put the result in 'apmresult'. The 'apmresult' parameter cannot be one of the other MAPM parameters. Division by zero creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_integer_div_rem(M_APM, M_APM, M_APM, M_APM);Example: M_APM quotient, remainder, num1, num2; m_apm_integer_div_rem(quotient, remainder, num1, num2); This function will divide num1 by num2, truncating the result to an integer and put the result in 'quotient' and it will put the remainder in 'remainder'. So, 173 / 26 will yield a quotient of 6 and a remainder of 17. Note that the input numbers do not necessarily have to be integers. This function can be used to split up the integer portion and fractional portion of a floating point number by calling the function with num2 set to 'MM_One'. So, 32.17042 can be split up into '32' and '0.17042'. The 'quotient' and 'remainder' parameters cannot be one of the other MAPM parameters. Division by zero creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_factorial(M_APM, M_APM);Example: M_APM apmresult, apm_num; m_apm_factorial(apmresult, apm_num); This function will compute the factorial of 'apm_num' and put the result in 'apmresult'. A non-integer input will yield nonsense. Actually, the algorithm simply multiplies : (though 0! and 1! return 1) N * (N - 1) * (N - 2) ... until N < 2. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_sqrt(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_sqrt(apmresult, decimal_places, apm_num); This function will take the square root of 'apm_num' and it will put the result in 'apmresult'. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter. An input < zero creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_log(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_log(apmresult, decimal_places, apm_num); This function will take the natural log (base 2.718 ...) of 'apm_num' and it will put the result in 'apmresult'. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter. An input <= zero creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_log10(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_log10(apmresult, decimal_places, apm_num); This function will take the common log (base 10) of 'apm_num' and it will put the result in 'apmresult'. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter. An input <= zero creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_exp(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_exp(apmresult, decimal_places, apm_num); This function will perform E ^ apm_num where 'E' is 2.718... (the exponential function) and it will put the result in 'apmresult'. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_pow(M_APM, int, M_APM, M_APM);Example: M_APM apmresult, apm_x, apm_y; int decimal_places; m_apm_pow(apmresult, decimal_places, apm_x, apm_y); This function will raise 'apm_x' to the 'apm_y' power and it will put the result in 'apmresult'. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be one of the other MAPM parameters. 'apm_x' must be >= zero.-----------------------------------------------------------------------------Prototype: void m_apm_integer_pow(M_APM, int, M_APM, int);Example: M_APM apmresult, apm_x; int decimal_places, ipower; m_apm_integer_pow(apmresult, decimal_places, apm_x, ipower); This function will raise 'apm_x' to the 'ipower' power and it will put the result in 'apmresult'. The result will be accurate to the number of decimal places specified. If calculating X^Y, this function should be used when 'Y' is an integer. This function is considerably faster than the generic 'm_apm_pow' function (when 'ipower' is not excessively large). 'apm_x' and/or 'ipower' may be negative. Note that 'ipower' is an integer and not a MAPM number. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_sin(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_sin(apmresult, decimal_places, apm_num); This function will take the sine of 'apm_num' and it will put the result in 'apmresult'. The input angle is assumed to be in radians. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_cos(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_cos(apmresult, decimal_places, apm_num); This function will take the cosine of 'apm_num' and it will put the result in 'apmresult'. The input angle is assumed to be in radians. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_sin_cos(M_APM, M_APM, int, M_APM);Example: M_APM sin_val, cos_val, apm_num; int decimal_places; m_apm_sin_cos(sin_val, cos_val, decimal_places, apm_num); This function computes the sin and cos of apm_num and it will be more efficient than calling each function separately. The input angle is assumed to be in radians. The results will be accurate to the number of decimal places specified. The 'sin_val' and 'cos_val' parameter cannot be the input MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_tan(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_tan(apmresult, decimal_places, apm_num); This function will take the tangent of 'apm_num' and it will put the result in 'apmresult'. The input angle is assumed to be in radians. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_arcsin(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_arcsin(apmresult, decimal_places, apm_num); This function will take the arc sine of 'apm_num' and it will put the result in 'apmresult'. The angle returned is in the range -PI / 2 to +PI / 2. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter. |Input| > 1 creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_arccos(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_arccos(apmresult, decimal_places, apm_num); This function will take the arc cosine of 'apm_num' and it will put the result in 'apmresult'. The angle returned is in the range 0 to +PI. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter. |Input| > 1 creates a zero result and a warning on stderr.-----------------------------------------------------------------------------Prototype: void m_apm_arctan(M_APM, int, M_APM);Example: M_APM apmresult, apm_num; int decimal_places; m_apm_arctan(apmresult, decimal_places, apm_num); This function will take the arc tangent of 'apm_num' and it will put the result in 'apmresult'. The angle returned is in the range -PI / 2 to +PI / 2. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be the other MAPM parameter.-----------------------------------------------------------------------------Prototype: void m_apm_arctan2(M_APM, int, M_APM, M_APM);Example: M_APM apmresult, apm_x, apm_y; int decimal_places; m_apm_arctan2(apmresult, decimal_places, apm_y, apm_x); This function will perform the 4 quadrant arc tangent of 'apm_y' and 'apm_x' and it will put the result in 'apmresult'. The angle returned is in the range -PI to +PI. The function will determine the quadrant based on the signs of the 2 inputs. The result will be accurate to the number of decimal places specified. The 'apmresult' parameter cannot be one of the other MAPM parameters. x, y both = zero yields a zero result and a warning on stderr.-----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -