Member:
/* Field */math. e; // 2.71828182845905math.pi; // 3.14159265358979/* Static Method */math. ABS; // absolute value math. ACOs; // arccosine math. asin; // arcsin math. atan; // returns math. atan2; // arc tangent, two parameters math. bigmul; // int32 * int32 = int64math. ceiling; // take the smallest integer math> =. cos; // cosine math. cosh; // hyperbolic cosine math. divrem; // The operator and remainder math. exp; // evaluate the specified power math of E. floor; // fetch
Exercise:
// Truncate (), floor (), ceiling () protected void button#click (Object sender, eventargs e) {double n1 = math. truncate (math. pi); // 3 double n2 = math. floor (2.5); // 2 double N3 = math. floor (-2.5); //-3 double N4 = math. ceiling (2.5); // 3 double N5 = math. ceiling (-2.5); //-2 textbox1.text = string. concat (N1, "\ n", N2, "\ n", N3, "\ n", N4, "\ n", N5 );} // nearby round (even) protected void button2_click (Object sender, eventargs e) {double n1 = math. round (0.5); // 0 double n2 = math. round (1.5); // 2 double N3 = math. round (2.5); // 2 double N4 = math. round (3.5); // 4 double N5 = math. round (-0.5); // 0 double N6 = math. round (-1.5); //-2 double N7 = math. round (-2.5); //-2 double n8 = math. round (-3.5); //-4 textbox1.text = string. concat (N1, "\ n", N2, "\ n", N3, "\ n", N4, "\ n", N5, "\ n", N6, "\ n", N7, "\ n", n8);} // rounding protected void button3_click (Object sender, eventargs e) {double n1 = math. round (0.5, midpointrounding. awayfromzero); // 1 double n2 = math. round (1.5, midpointrounding. awayfromzero); // 2 double N3 = math. round (2.5, midpointrounding. awayfromzero); // 3 double N4 = math. round (3.5, midpointrounding. awayfromzero); // 4 double N5 = math. round (-0.5, midpointrounding. awayfromzero); //-1 double N6 = math. round (-1.5, midpointrounding. awayfromzero); //-2 double N7 = math. round (-2.5, midpointrounding. awayfromzero); //-3 double n8 = math. round (-3.5, midpointrounding. awayfromzero); //-4 textbox1.text = string. concat (N1, "\ n", N2, "\ n", N3, "\ n", N4, "\ n", N5, "\ n", N6, "\ n", N7, "\ n", n8);} // specify the number of decimal places (0 .. 28) Rounding protected void button4_click (Object sender, eventargs e) {double n1 = math. round (3.126, 2); // 3.13 double n2 = math. round (3.124, 2); // 3.12 double N3 = math. round (3.125, 2); // 3.12 double N4 = math. round (3.135, 2); // 3.14 double N5 = math. round (3.125, 2, midpointrounding. awayfromzero); // 3.13 double N6 = math. round (3.135, 2, midpointrounding. awayfromzero); // 3.14 textbox1.text = string. concat (N1, "\ n", N2, "\ n", N3, "\ n", N4, "\ n", N5, "\ n ", n6 );}