| Home |
|
What Is Euphoria? |
|
Documentation |
|
News |
|
EUforum |
|
Download Euphoria |
|
Donate |
|
||||||
|
|
|
|
|
|
|
|
|||||||||||||
|
|
|||||||||||||||||||
| Recent User Contributions |
|
The Archive |
|
Other Euphoria Web Sites |
|
RDS Development |
|
Related Books & Software |
|
||||
|
|
|
|
|
|
|||||||||
| Search Results | |
| # 1 of 14 ------ lib_e_g.htm --- score: 157 ------ |
------------------------------------<floor>------------------------------------
Syntax: x2 = floor(x1)
Description: Return the greatest integer less than or equal to x1. (Round down
to an integer.)
Comments: This function may be applied to an atom or to all elements of a
sequence.
Example:
y = floor({0.5, -1.6, 9.99, 100})
-- y is {0, -2, 9, 100}
See Also: remainder
|
| # 2 of 14 ------ library.htm --- score: 157 ------ |
------------------------------------<floor>------------------------------------
Syntax: x2 = floor(x1)
Description: Return the greatest integer less than or equal to x1. (Round down
to an integer.)
Comments: This function may be applied to an atom or to all elements of a
sequence.
Example:
y = floor({0.5, -1.6, 9.99, 100})
-- y is {0, -2, 9, 100}
See Also: remainder
|
| # 3 of 14 ------ perform.htm --- score: 130 ------ |
x + 1 -- faster than general x + y
1 + x -- faster than general y + x
x * 2 -- faster than general x * y
2 * x -- faster than general y * x
x / 2 -- faster than general x / y
floor(x/y) -- where x and y are integers, is faster than x/y
floor(x/2) -- faster than floor(x/y)
x below is a simple variable, y is any variable or expression:
|
| # 4 of 14 ------ trouble.htm --- score: 107 ------ |
S: Intel CPU's, and most other CPU's, use binary numbers to represent
fractions. Decimal fractions such as 0.1, 0.01 and similar numbers can't
be represented precisely. For example, 0.1 might be stored internally as
0.0999999999999999. That means that 10 * 0.1 might come out as
0.999999999999999, and floor(10 * 0.1) might be 0, not 1 as you'd expect.
This can be a nuisance when you are dealing with money calculations, but
it's not a Euphoria problem. It's a general problem that you must face in
most programming languages. Always remember: floating-point numbers are
just an approximation to the "real" numbers in mathematics. Assume that
any floating-point calculation might have a tiny bit of error in the
result. Sometimes you can solve the problem by rounding, e.g. x = floor(x
+ 0.5) would round x off to the nearest integer. Storing money values as
an integer number of pennies, rather than a fractional number of dollars
(or similar currency) will help, but some calculations could still cause
problems.
|
| # 5 of 14 ------ library.htm --- score: 78 ------ |
floor - round down to the nearest integer remainder - calculate the remainder when a number is divided by another power - calculate a number raised to a power PI - the mathematical value PI (3.14159...) |
| # 6 of 14 ------ lib_p_r.htm --- score: 78 ------ |
See Also: floor -----------------------------------<repeat>------------------------------------ Syntax: s = repeat(x, a) |
| # 7 of 14 ------ library.htm --- score: 78 ------ |
floor - round down to the nearest integer remainder - calculate the remainder when a number is divided by another power - calculate a number raised to a power PI - the mathematical value PI (3.14159...) |
| # 8 of 14 ------ library.htm --- score: 78 ------ |
See Also: floor -----------------------------------<repeat>------------------------------------ Syntax: s = repeat(x, a) |
| # 9 of 14 ------ refman.htm --- score: 78 ------ |
return x -- trivial case
end if
mid = floor(n/2)
a = merge_sort(x[1..mid]) -- sort first half of x
b = merge_sort(x[mid+1..n]) -- sort second half of x
-- merge the two sorted halves into one
|
| # 10 of 14 ------ refman_1.htm --- score: 78 ------ |
return x -- trivial case
end if
mid = floor(n/2)
a = merge_sort(x[1..mid]) -- sort first half of x
b = merge_sort(x[mid+1..n]) -- sort second half of x
-- merge the two sorted halves into one
|
| # 11 of 14 ------ lib_h_o.htm --- score: 77 ------ |
end if
See Also: atom, sequence, floor
-----------------------------------<length>------------------------------------
Syntax: i = length(s)
|
| # 12 of 14 ------ library.htm --- score: 77 ------ |
end if
See Also: atom, sequence, floor
-----------------------------------<length>------------------------------------
Syntax: i = length(s)
|
| # 13 of 14 ------ refman.htm --- score: 77 ------ |
s[5..$-2]
s[$-5..$]
s[$][1..floor($/2)] -- first half of the last element of s
2.2.7 Concatenation of Sequences and Atoms - The '&' Operator
-------------------------------------------------------------
Any two objects may be concatenated using the & operator. The result is a
|
| # 14 of 14 ------ refman_2.htm --- score: 77 ------ |
s[5..$-2]
s[$-5..$]
s[$][1..floor($/2)] -- first half of the last element of s
2.2.7 Concatenation of Sequences and Atoms - The '&' Operator
-------------------------------------------------------------
Any two objects may be concatenated using the & operator. The result is a
|