math function in javascript

technical talkiess
0

 Javascript Math function :- <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Javascript math function </title>

</head>

<body>

   

    <script>

        let m = Math;

        // print the all math function in the console side

        console.log(m);


        // print hte some of the constant value in the math function


        console.log("Printing the pi value" + m.PI)

        // ye us value second parameter ke hisab se multiplee kar seta hai

        console.log("Printing the pow value "+ m.pow(2,2))

        console.log("Printing the pow value "+ m.pow(2,3))

        console.log("Printing the ln2 value "+m.LN2)

        console.log("Printing the ln10 value "+m.LN10)

        console.log("Printing the SQRT1_2 value "+m.SQRT1_2)




        // getting the particular value square root in he javascript


        console.log("Square root of the particular value " + m.sqrt(4))

        console.log("Square root of the particular value " + m.sqrt(36))

        console.log("Square root of the particular value " + m.sqrt(49))

        console.log("Square root of the particular value " + m.sqrt(100))


        // basic math calculation in the javascript

        // floor in given base value .... round is giving .4 is return base value after 5 is return next value

        console.log("Round " + m.round(5.5)) //-- return 6

        console.log("Round " + m.round(5.6)) //-- return 6

        console.log("Round " + m.round(5.4)) //-- return 5



        // Floor is always return base value .... below example always return the 5 value because of the it's base value of the


        console.log("Floor " + m.floor(5.5))

        console.log("Floor " + m.floor(5.6))

        console.log("Floor " + m.floor(5.9))

        console.log("Floor " + m.floor(5.4))


        // print the nearst vaue of the digit

        console.log("Ceil " + m.ceil(5.66))

        // print the base number trunc

        console.log("Trunc " + m.trunc(5,.7))

        //absolute function in the javascript

       

       


        console.log("ABS function return the absolute value " + m.abs(5.11))

        console.log("ABS function return the absolute value " + m.abs(-5.99))


        // sin cos tan values using javascript


        console.log("The value of the sin()" + m.sin(m.PI)/2)

        console.log("The value of the cos()" + m.cos(m.PI)/2)

        console.log("The value of the tan()" + m.tan(m.PI)/2)



        // min aur max function in the javascript


        console.log("The minimum value of the list" + m.min(1,5,3,4))

        console.log("The maximum value of the list" + m.max(1,5,3,4))



        // random value in the javscript


        console.log(m.round(m.random() * 100))

        let t = 1;

        let v= 100;

        math_random = v+(t-v)*m.random();

        console.log(math_random);


        // math log retun the natural alogotrithum


        console.log("Log int the javasscript " + m.log(20))


        // log2 is give the number of sqrt how many multiply te perspective number then its give the number


        console.log("How many multiply the 2 get 8 + =>" + m.log2(8))

        // log 2 means 2 mltiply to get another value

        // log10 is also same


        // frounk return the 32 bit in the number s


        console.log("Math frounk " + m.fround(2.88))

        // acosh nummber in the javascript


        console.log("accorsh number " + m.acos())


document.write(Math.acos(1)) // return 0

        document.write("<br/>")

        document.write(Math.acos(0)) // return pi/2 value

        document.write("<br/>")

        document.write(Math.acos(-1)) //  retrn pi value

         

        document.write("<br/>")

        document.write(Math.asin(-1)) //  retrn -pi/2 value

        document.write("<br/>")

        document.write(Math.asin(0)) //  retrn pi/2 value

        document.write("<br/>")

        document.write(Math.asin(1)) //  retrn pi/2 value


    </script>

</body>

</html>


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)