Total Pageviews

Friday, April 25, 2014

math.round

Math.round()
វាជា rounds number ដែលនៅក្បែរ integer បំផុតដែលតាមដោយ JavaScript version
ឧះបើសិនជា fraction portion of number ជាចំនួនលេខ 0.5​ ឬធំជាង។ ដែល argument is rounded ដែលនៅបន្ទាប់ higher integer។ បើសិនជា fractional portion of number is less than 0.5 the argument is rounded to the next lower integer
Syntax: math.round (x)
X(តំរូវការ) វាជាចំនួនលេខដែល Round
សូមមើលកូដះ
print( math.round( 0.1 ) )     -- Output: 0.1  0
print( math.round( 0.5 ) )     -- Output: 0.5  1
print( math.round( 8.9 ) )     -- Output: 8.9  9
print( math.round( -0.1 ) )     -- Output: -0.1 0
print( math.round( -0.5 ) )     -- Output: -0.5 0
print( math.round( -8.9 ) )     -- Output: -8.9 -9


No comments:

Post a Comment