0% found this document useful (0 votes)
61 views2 pages

Maths Functions

The document outlines a set of mathematical functions available in Delphi, requiring the inclusion of 'System.Math' in the code. Each function is described with its argument types and return types, including operations like square, square root, power, and random number generation. Additional functions cover rounding, absolute values, and constants like Pi.

Uploaded by

kimberlykamisha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views2 pages

Maths Functions

The document outlines a set of mathematical functions available in Delphi, requiring the inclusion of 'System.Math' in the code. Each function is described with its argument types and return types, including operations like square, square root, power, and random number generation. Additional functions cover rounding, absolute values, and constants like Pi.

Uploaded by

kimberlykamisha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Maths Functions

In order to use these functions, “System.Math” must be included under the “Uses” statement at the
top of your form code.
There are many more functions offered by Delphi, but we will focus on a particular set.
Each of the functions is listed below with detail given for the argument and return types:
1. Sqr(x: Float): Float
This function takes a single argument of type Float (which is a floating-point data type) and
returns the square of that value, also as a Float data type.
2. Sqrt(x: Float): Float
This function takes a single argument of type Float and returns the square root of that
value, also as a Float.
3. Power(x, y: Float): Float
This function takes two arguments of type Float and returns the value of the first argument
(x) raised to the power of the second argument (y) as a Float.
4. RandomRange(const a, b: Integer): Integer
This function takes two arguments of type Integer and returns a random integer value
between the first argument (a) is inclusive and the second argument (b), exclusive.
5. Ceil(x: Float): Float
This function takes a single argument of type Float and returns the smallest integer that is
greater than or equal to the argument passed in.
6. Floor(x: Float): Float
This function takes a single argument of type Float and returns the largest integer that is
less than or equal to the argument passed in.
7. Trunc(x: Float): Integer
This function takes a single argument of type Float and returns the integer part of the
argument passed in.
8. Frac(x: Float): Float
This function takes a single argument of type Float and returns the fractional part of the
argument passed in.
9. Round(x: Float): Integer
This function takes a single argument of type Float and rounds it to the nearest integer.
10. Odd(x: Integer): Boolean
This function takes a single argument of type Integer and returns True if the argument
passed in is odd, and False otherwise.
11. Max(x, y: Float): Float
This function takes two arguments of type Float and returns the maximum of the two values
passed in.
12. Min(x, y: Float): Float
This function takes two arguments of type Float and returns the minimum of the two values
passed in.
13. Abs(x: Float): Float
This function takes a single argument of type Float and returns the absolute value of that
argument.
14. Pi() : Float
Pi is a constant function, meaning that it takes no arguments and always returns the same
value, which is an approximation of Pi.
Maths Functions
In order to use these functions, “System.Math” must be included under the “Uses” statement at the
top of your form code.
There are many more functions offered by Delphi, but we will focus on a particular set.
Each of the functions is listed below with detail given for the argument and return types:
15. Sqr(x: Float): Float
This function takes a single argument of type Float (which is a floating-point data type) and
returns the square of that value, also as a Float data type.
16. Sqrt(x: Float): Float
This function takes a single argument of type Float and returns the square root of that
value, also as a Float.
17. Power(x, y: Float): Float
This function takes two arguments of type Float and returns the value of the first argument
(x) raised to the power of the second argument (y) as a Float.
18. RandomRange(const a, b: Integer): Integer
This function takes two arguments of type Integer and returns a random integer value
between the first argument (a) and the second argument (b), inclusive.
19. Ceil(x: Float): Float
This function takes a single argument of type Float and returns the smallest integer that is
greater than or equal to the argument passed in.
20. Floor(x: Float): Float
This function takes a single argument of type Float and returns the largest integer that is
less than or equal to the argument passed in.
21. Trunc(x: Float): Integer
This function takes a single argument of type Float and returns the integer part of the
argument passed in.
22. Frac(x: Float): Float
This function takes a single argument of type Float and returns the fractional part of the
argument passed in.
23. Round(x: Float): Integer
This function takes a single argument of type Float and rounds it to the nearest integer.
24. Odd(x: Integer): Boolean
This function takes a single argument of type Integer and returns True if the argument
passed in is odd, and False otherwise.
25. Max(x, y: Float): Float
This function takes two arguments of type Float and returns the maximum of the two values
passed in.
26. Min(x, y: Float): Float
This function takes two arguments of type Float and returns the minimum of the two values
passed in.
27. Abs(x: Float): Float
This function takes a single argument of type Float and returns the absolute value of that
argument.
28. Pi() : Float
Pi is a constant function, meaning that it takes no arguments and always returns the same
value, which is an approximation of Pi.

You might also like