Talk:Floor and ceiling functions

Latest comment: 4 months ago by JayBeeEll in topic Possible Problem in "Equivalences" Section

Please better representation

edit

See better ceil(x) at https://www.maplesoft.com/support/help/content/1939/image84.png as better "filled color" (red in this case). The line is also filled, like a bolded line. The addiction of the "empty point" representation of the line function needs to be bold. — Preceding unsigned comment added by Krauss (talkcontribs) 01:52, 7 June 2018 (UTC)Reply

that would be great but I get access denied — Preceding unsigned comment added by Spitzak (talkcontribs) 23:12, 26 July 2022 (UTC)Reply

Relation to directional rounding to integer

edit

"Not quite rounding. See Floor and ceiling functions#Rounding."

Can someone please explain this? From what I can tell, rounding up to the nearest integer should be equivalent to ceiling, and similarly for rounding down equaling floor. The section referenced and the definitions of floor and ceiling are all incredibly technical and thus useless to anyone that has not gotten a degree in mathematics. --Bastian 51234 (talk) 23:27, 8 December 2019 (UTC)Reply

Rounding is to the nearest integer—not necessarily to the nearest greater integer or nearest least integer. For example,
1.4 rounded is 1,
the floor of 1.4 is 1,
the ceiling of 1.4 is 2.
1.6 rounded is 2,
the floor of 1.6 is 1,
the ceiling of 1.6 is 2.
So the floor of a fraction is always down; the ceiling of a fraction is always up; rounding can be up or down depending upon whether the fraction is less than one half. —Anita5192 (talk) 00:09, 9 December 2019 (UTC)Reply
I think I agree with Bastian 51234 on two points here: first, that the current first description is bizarrely technical, and second, that the floor and ceiling functions are particular rounding functions. In particular, there are lots of rounding rules (see Rounding), and these two functions correspond to the rounding rules "round down" and "round up". It would be good if the first sentence were less technical, and mentioning rounding somewhere in the lead would also be reasonable. --JBL (talk) 02:54, 10 December 2019 (UTC)Reply
I also agree, in lay use the term "round down" and "round up" are equivalent floor and ceiling for positive numbers. Perhaps they are technically incorrect by using the word "round" but not returning the closest integer, but the terms are certainly used this way right or wrong.Spitzak (talk) 20:25, 10 December 2019 (UTC)Reply
If a word/phrase is used to mean a certain thing, it takes that definition no matter the original meaning(see the words "awful" and "awesome" for example). On top of this, without the common definitions of the terms "round up" and "round down", the terms are,to my knowledge, meaningless in math. Because of these two things, I feel adding them would increase the average person's understanding without degrading the expert's understanding, especially if the clarification that this would be a simplified version of the definition. Bastian 51234 (talk) 05:54, 11 December 2019 (UTC)Reply

Real numbers or floating point numbers?

edit

These functions are usually used with floating point numbers, an approximation of the real number system that has some important differences. Using them with real numbers gives some results that may be unexpected: floor(0.99999...) = 1 because 0.9 repeating is equal to 1. floor( max(0,1) ) = 0 using the range notation for all numbers between 0 and 1 exclusive.

Also, Reference 1 cites this wikipedia page. It is a circular reference. Subcelestial (talk) 14:33, 4 November 2020 (UTC)Reply

"These functions are usually used with floating point numbers" -- not true, they are also used in mathematics.
"floor(0.99999...) = 1 because 0.9 repeating is equal to 1." -- this is a fact about the rounding of 0.999..., not about the floor function; if floor(0.999...) returns 1, it means that the argument was actually 1.0.
"floor( max(0,1) ) = 0 using the range notation for all numbers between 0 and 1 exclusive." -- max(0,1) is not a standard notation for "all number between 0 and 1 exclusive".
So I don't think any changes are called for. --Macrakis (talk) 16:29, 4 November 2020 (UTC)Reply
(edit conflict) I have removed this reference, and two others per WP:ELNO. Such web citing may be acceptable when there no reliably published references, but this is not the case here.
These functions are defined for real numbers, not only for floating point numbers, which all are rational numbers. Using approximations for computing may always lead to wrong results. For example, using floating-point, (3. * (2.^10 * (1. / 3.))) / 2.^10 does not normally results into 1 (some clever compilers may produce 1., by rearranging the order of operations). Here the floor function is specific because it is not continuous, which means that one cannot get a good approximation of the correct result by increasing the accuracy (size of the mantissa). D.Lazard (talk) 16:58, 4 November 2020 (UTC)Reply

Integral part

edit

In the recent edits, it is asserted that, as Legendre used "partie entière inférieure", the function that he denoted   was the floor function. This is not convincing, because, I belive that he was interested only in positive values of x. So, it must be checked in Legendre's work whether he defined his function for negative x, and if he did, which was his definition. D.Lazard (talk) 20:43, 4 November 2020 (UTC)Reply

I agree that this seems dubious without a very good citation, but I also think it was removed again (perhaps, by me)? --JBL (talk) 21:51, 4 November 2020 (UTC)Reply
I saw that in a StackOverflow question when searching for whether [x] means floor or round-toward-zero, but no reliabla reference. I agree it is possible this is in error, and in fact [x] does not define the behavior for negative numbers. That would at least make it not conflict with the use of [x] for round-toward-zero which is used in the opening section (but I cannot find any references showing that use is common).Spitzak (talk) 22:24, 4 November 2020 (UTC)Reply
@DVdm:The section currently reads:
"In words, this is the integer that has the largest absolute value less than or equal to the absolute value of x."
I agree with the IP who previously edited this, that it is ambiguous. For example, if x = –3.9, then |x| = 3.9, the largest integer less than or equal to |x| is 3, and the integer that has the largest absolute value less than or equal to the absolute value of x could be –3 or 3. — Anita5192 (talk) 15:33, 10 June 2021 (UTC)Reply
I agree that the current wording is problematic, but I haven't come up with a concise alternative that is clearer. Maybe just drop the "in words" part? --Macrakis (talk) 16:47, 10 June 2021 (UTC)Reply
I agree: drop the entire "in words" sentence. This edit seemed to correct the verbal explanation, but it was still difficult to follow. I think the simple definition is intuitively obvious and needs no further explanation. — Anita5192 (talk) 17:17, 10 June 2021 (UTC)Reply
  DoneAnita5192 (talk) 17:21, 10 June 2021 (UTC)Reply
@Anita5192: concur. Thx. Tricky   - DVdm (talk) 19:04, 10 June 2021 (UTC)Reply

Different definition of integer part in different countries

edit

I think it would be useful to say somewhere that the definition of "integer part" given in the introduction is only valid in some countries. In France for example, this is equal to the floor function : see the french page "partie entière" of wikipedia.

This maybe answers the previous question ? --89.95.99.135 (talk) 18:33, 27 January 2021 (UTC)Reply

I wonder if this is strictly an issue of language -- in which case it doesn't belong in the English WP -- or if different authors have different definitions, in which case we should mention that. --Macrakis (talk) 19:13, 16 June 2021 (UTC)Reply
A quick literature search shows that definitions vary even in English, so I have mentioned that in the lead. Thanks for pointing that out. --Macrakis (talk) 21:27, 16 June 2021 (UTC)Reply
I think a common name for the "integral part" function is "truncation". Certainly in computer science it is called that. May want to mention it. Also it sure looks like [x] does not mean this truncation function all the time, or even the majority of the time. Can't find any modern examples of it's use, and older texts treated it as floor.Spitzak (talk) 01:47, 17 June 2021 (UTC)Reply
We had a section on truncation in this article, but there's actually a full article on it. I added a mention to the lead with a link and removed the unnecessary section. --Macrakis (talk) 14:23, 17 June 2021 (UTC)Reply
Since this function and notation is very specific, is only mentioned briefly in the lead and the Notation section, and, as far as I know, rarely used, I think this should be moved in its entirety back into the Applications section.—Anita5192 (talk) 14:57, 17 June 2021 (UTC)Reply
It is rare in mathematics, but common in programming. The full article on it should have any necessary details. --Macrakis (talk) 15:38, 17 June 2021 (UTC)Reply
I have only seen the function described as "trunc(x)" or "int(x)". I would like to see some reference that anybody uses "[x]" for truncation. I am worried that this is a wikipedia-made-up "fact".Spitzak (talk) 17:51, 17 June 2021 (UTC)Reply
The wording in the article doesn't say that [x] is used for truncation. It just says that "the operation of truncation generalizes this [sc. the integer part] to a specified number of digits". --Macrakis (talk) 19:45, 17 June 2021 (UTC)Reply
The article says "the integer part is often represented as [x]". That is the statement I am unsure is true.Spitzak (talk) 20:57, 17 June 2021 (UTC)Reply
Ah, I think I see what you're saying.
Both the name "integer part" and the notation [x] are, I think, ambiguous between the "floor" definition and the "truncate towards zero" definition. We can certainly rewrite the lead (with sources) to clarify all that. I don't have the time to do that right now, but I encourage you to do so yourself. --Macrakis (talk) 21:24, 17 June 2021 (UTC)Reply
I am a bit baffled by the statement, "truncation to zero significant digits is the same as the integer part". In my mind, truncation of a value to zero significant digits is the same as introducing complete ambiguity in its magnitude. I was tempted to change the text to "truncation to zero fractional digits is the same as the integer part," but that seems like such a fundamental statement that there must be some sort of unstated axiom in play -- whatever the case, that should be either rewritten as I proposed or somebody should have some sort of explanation or reference to what is really meant by a number with no significant digits. — Preceding unsigned comment added by Dodecagon12 (talkcontribs) 20:23, 28 January 2022 (UTC)Reply

"Greatest integer" listed at Redirects for discussion

edit

  An editor has identified a potential problem with the redirect Greatest integer and has thus listed it for discussion. This discussion will occur at Wikipedia:Redirects for discussion/Log/2022 May 19#Greatest integer until a consensus is reached, and readers of this page are welcome to contribute to the discussion. D.Lazard (talk) 10:59, 19 May 2022 (UTC)Reply

Definition of "integral part"

edit

The article defines [·] such that [−2.4] = −2, that is, as truncation towards zero. Some texts define the integral part of a number as "the part to the left of the decimal point".[1][2][3] It is not clear, though, that the authors meant this to be applicable to negative real numbers. More recent sources define "integral part" as equivalent (or even explicitly as equal) to the floor function.[4][5][6] The statement in the latter source that [−2.5] = −3 clearly contradicts the present definition in our article.  --Lambiam 06:19, 23 May 2022 (UTC)Reply

I very much suspect the idea that [x]] means round-towards-zero and not floor is a made-up "fact" by wikipedia.Spitzak (talk) 17:18, 23 May 2022 (UTC)Reply
I concur. The standard convention in mathematics is that   and   denote the same thing (unless   means something completely different, such as the Iverson bracket).—Emil J. 11:33, 20 December 2022 (UTC)Reply

Add history section

edit

Apparently this notation (and names) was invented by the APL programming language designers in the 1960s. To do: Find a reliable source. Previous (and different) notations go back to Gauss. — Preceding unsigned comment added by 79.147.146.38 (talk)

Smallest

edit

I'm concerned that at least some people think -1 is "smaller" than -2, and the use of the word "smallest" in the opening paragraphs is incorrect. I tried changing it to "lowest" but that got reverted. Any opinions on this? Spitzak (talk) 19:48, 6 December 2023 (UTC)Reply

Both "smaller" and "lower" involve an implicit agreement between reader and author about how bigness (whether in the language of size or height) works for negative numbers. We could make explicit that the order relation in question is the usual total order on the real numbers, but I don't believe this will help the (in my estimation, very small) percentage of people who believe both that -1 is smaller than -2 and that -2 is lower than -1. But, I would also be happy to hear the views of other editors. --JBL (talk) 19:55, 6 December 2023 (UTC)Reply

Possible Problem in "Equivalences" Section

edit

The "Equivalences" section currently states that the following inequalities are always true:

 

One of the two inequalities in each of these two "chains" must be strict, otherwise we would end up with the following contradictions:

 

Either relation in each "chain" can be an equality. Let's examine the floor case.

Since   and  , the first inequality need not be strict:

 

Noting that since  , and observing that   implies  , the second inequality need not be strict:

 

So I think it would make sense to update the article's text to clarify that while each inequality need not be strict, they can't simultaneously be equal. That is, for any given   and  , one or the other must be strict.

I'm not sure how to best word this, though. Ilikefood (talk) 18:27, 15 June 2024 (UTC)Reply

Maybe put a footnote? This doesn't seem that important to belabor. –jacobolus (t) 18:47, 15 June 2024 (UTC)Reply
When writing the inequality   for  , no one feels it necessary to specify that   cannot be simultaneously equal to both 1 and −1. This situation seems completely analogous. --JBL (talk) 20:42, 16 June 2024 (UTC)Reply