Added some math function tests

This commit is contained in:
ketank-new 2017-01-04 17:25:13 +05:30 committed by GitHub
parent 6bbfa48b93
commit 8b20a0eae2

View File

@ -153,4 +153,24 @@ end
switch("+")
print("********************************************")
print("****************Math Functions *******")
radianVal = math.rad(math.pi / 2)
io.write("RadianVal=" , radianVal,"\n")
io.write("Sin Value=",string.format("%.1f ", math.sin(radianVal)),"\n")
io.write("Cosine Value=",string.format("%.1f ", math.cos(radianVal)),"\n")
io.write("Tan Value=",string.format("%.1f ", math.tan(radianVal)),"\n")
io.write("Cosh Value=",string.format("%.1f ", math.cosh(radianVal)),"\n")
io.write("Math.deg",math.deg(math.pi),"\n")
io.write("Floor of 10.5055 is ", math.floor(10.5055),"\n")
io.write("Ceil of 10.5055 is ", math.ceil(10.5055),"\n")
io.write("Square root of 16 is ",math.sqrt(16),"\n")
--io.write("10 power 2 is ",math.pow(10,2),"\n")
--io.write("100 power 0.5 is ",math.pow(100,0.5),"\n")
io.write("Absolute value of -10 is ",math.abs(-10),"\n")
math.randomseed(os.time())
io.write("Random number between 1 and 100 is ",math.random(),"\n")
io.write("Random number between 1 and 100 is ",math.random(1,100),"\n")
--io.write("Maximum in the input array is ",math.max(1,100,101,99,999),"\n")
--io.write("Minimum in the input array is ",math.min(1,100,101,99,999),"\n")
print("********************************************")