{"id":7210,"date":"2022-12-20T19:35:50","date_gmt":"2022-12-20T22:35:50","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/mdkcommonmath-man3\/"},"modified":"2022-12-20T19:35:50","modified_gmt":"2022-12-20T22:35:50","slug":"mdkcommonmath-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/mdkcommonmath-man3\/","title":{"rendered":"MDK::Common::Math (man3)"},"content":{"rendered":"<h1 align=\"center\">MDK::Common::Math<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#EXPORTS\">EXPORTS<\/a><br \/> <a href=\"#OTHER\">OTHER<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">MDK::Common::Math \u2212 miscellaneous math functions<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use MDK::Common::Math qw(:all);<\/p>\n<h2>EXPORTS <a name=\"EXPORTS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\">$PI<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"35%\">\n<p style=\"margin-top: 1em\">the well-known constant<\/p>\n<\/td>\n<td width=\"48%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\">even( <small>INT<\/small> ) <br \/> odd( <small>INT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">is the number even or odd?<\/p>\n<p style=\"margin-left:11%;\">sqr( <small>FLOAT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">sqr(3) gives 9<\/p>\n<p style=\"margin-left:11%;\">sign( <small>FLOAT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">returns a value in { \u22121, 0, 1 }<\/p>\n<p style=\"margin-left:11%;\">round( <small>FLOAT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">&#8220;round(1.2)&#8221; gives 1, &#8220;round(1.6)&#8221; gives 2<\/p>\n<p style=\"margin-left:11%;\">round_up( <small>FLOAT, INT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">returns the number rounded up to the modulo: &#8220;round_up(11,10)&#8221; gives 20<\/p>\n<p style=\"margin-left:11%;\">round_down( <small>FLOAT, INT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">returns the number rounded down to the modulo: &#8220;round_down(11,10)&#8221; gives 10<\/p>\n<p style=\"margin-left:11%;\">divide( <small>INT, INT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">integer division (which is lacking in perl). In array context, also returns the remainder: &#8220;($a, $b) = divide(10,3)&#8221; gives &#8220;$a is 3&#8221; and &#8220;$b is 1&#8221;<\/p>\n<p style=\"margin-left:11%;\">min( <small>LIST<\/small> ) <br \/> max( <small>LIST<\/small> )<\/p>\n<p style=\"margin-left:17%;\">returns the minimum\/maximum number in the list<\/p>\n<p style=\"margin-left:11%;\">or_( <small>LIST<\/small> )<\/p>\n<p style=\"margin-left:17%;\">is there a true value in the list?<\/p>\n<p style=\"margin-left:11%;\">and_( <small>LIST<\/small> )<\/p>\n<p style=\"margin-left:17%;\">are all values true in the list?<\/p>\n<p style=\"margin-left:11%;\">sum( <small>LIST<\/small> ) <br \/> product( <small>LIST<\/small> )<\/p>\n<p style=\"margin-left:17%;\">returns the sum\/product of all the element in the list<\/p>\n<p style=\"margin-left:11%;\">factorial( <small>INT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">factorial(4) gives 24 (4*3*2)<\/p>\n<h2>OTHER <a name=\"OTHER\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">the following functions are provided, but not exported: <br \/> factorize( <small>INT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">&#8220;factorize(40)&#8221; gives &#8220;([2,3], [5,1])&#8221; as 40\u00c2\u00a0=\u00c2\u00a02^3\u00c2\u00a0+\u00c2\u00a05^1<\/p>\n<p style=\"margin-left:11%;\">decimal2fraction( <small>FLOAT<\/small> )<\/p>\n<p style=\"margin-left:17%;\">&#8220;decimal2fraction(1.3333333333)&#8221; gives &#8220;(4, 3)&#8221; ($PRECISION is used to decide which precision to use)<\/p>\n<p style=\"margin-left:11%;\">poly2(a,b,c)<\/p>\n<p style=\"margin-left:17%;\">Solves the a*x2+b*x+c=0 polynomial: &#8220;poly2(1,0,\u22121)&#8221; gives &#8220;(1, \u22121)&#8221;<\/p>\n<p style=\"margin-left:11%;\">permutations(n,p)<\/p>\n<p style=\"margin-left:17%;\">A(n,p)<\/p>\n<p style=\"margin-left:11%;\">combinaisons(n,p)<\/p>\n<p style=\"margin-left:17%;\">C(n,p)<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">MDK::Common<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  MDK::Common::Math \u2212 miscellaneous math functions <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3540],"class_list":["post-7210","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-mdkcommonmath"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7210"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7210\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}