In flash, the math class is a very common class. Through mathematical computation, we can achieve a lot of wonderful results. Here we will start from the most basic learning and add a math knowledge.
Let's take a look at the math class provided in
These three functions may be confusing for beginners. Now I am learning them and I will make a detailed record.
Math. Round () literally knows what it means. How can we get a number around a double or float number? The answer is rounding.
For
First, let's take a look at The definition of three functions in JavaScript: The Definitive Guide, 4th Edition.
Math. ceil (): roundNumber up
Arguments: Any numeric value or expression
Returns: The closest integer greater than or equalX.
Bytes ------
This article briefly introduces Date (Date object) and Math object in JavaScript. For more information, see
Date object
1. What is a Date object?
A date object can store any date, and can be precise to the number of milliseconds (1/1000 seconds
Math. Round (11.5) and so on? Math. Round (-11.5) and so on?
The math class provides three methods related to rounding: Ceil, floor, and round. The functions of these methods correspond to the meanings of their English names. For example, the
Floor returns the maximum integer not greaterRound is the calculation of 4 homes and 5 homes, and the input is an integer greater than it (when-1.5 is displayed, the result obtained after rounding is not what we expect, the solution is to first take
JavaScript Math. floor (rounded down to the value), math. floor rounded down
JavaScript Math. floor MethodThe Math. floor method is used to round down a value to obtain the maximum integer that is less than or equal to the value. Syntax:
Math.
1. discard the fractional part and keep the integer part parseInt (5/2) 2. rounded up. If there is a decimal number, add 1Math to the integer. ceil (5/2) 3, rounded down. math. round (5/2) 4, round down Math. floor (5/2) Math object method FF:
1. Discard the fractional part and retain the integer part.Parseint (5/2)
2. rounded up. If there is a decimal number, add 1 to the integer part.
Math. Ceil (5/2)
3. rounding.
Math. Round (5/2)
4. Round down
Math. Floor (5/2)
Math object MethodFF:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.