Home > categories > Construction & Real Estate > Other Flooring > How can I simplify the floor function?
Question:

How can I simplify the floor function?

How I can I simplify the floor function; insted of using the special floor markers or function (e.g. floor (f(x)) I can express x without the use of the special loor marker or function.

Answer:

Can you use the max function? If so then F(x)=max(f(x),a) (where a is the floor value) should do the job
n = floor of x x = any real number = 0 % = modulus (remainder of the division between the two numbers) n = x - x%1 Example: x = 2.3 2.3 - (2.3 % 1) 2.3 - 0.3 2 This won't work for negative numbers, as the floor of -2.3 = -3. This logic will result in -2, which is the ceiling of -2.3. EDIT: I saw Ben's answer, and checked google for what mod of -2.3 would be, and it does say 0.7. My first test was with the windows calculator, and it gave me -0.3 as the mod. So as long as the mod gives a positive number, the mod method would work for all values. If it returns with windows calculator does, it would only work for positive numbers. Thank you M$ for giving us a bugged up calculator :)
i don't recognize the answer, yet i will percentage somewhat. we are able to not do a lot with the rounding-down symbols, so we will ought to locate away to eliminate them. or maybe induction can artwork also. i might want to attempt induction. [ (n + 2) / 2 ] + [ (n + 3) / 4 ] + ... = n + a million Subtract by utilising a million and set it equivalent to n. [ (n + 2) / 2 ] + [ (n + 3) / 4 ] + ... - a million = [ (n + a million) / 2 ] + [ (n + 2) / 4 ] + ... = n So now we may be able to teach that their distinction is 0. ----- some thing to carry close: [ (n + ok) / m ] If n is decrease than ok, the words after which will equivalent 0. ----- EDIT: [ (n + a million) / 2 + a million/2 ] + ... + [ (n + 2^ok) / 2^(ok + a million) + a million/2 ] - a million = [ (n + a million) / 2 ] + ... + [ (n + 2^ok / 2^(ok + a million) ] 2^(ok + a million) n 2^ok and element of the set of integers. We ought to teach: We ought to teach that in uncomplicated words one will round all the way down to be an integer more beneficial than one in all that is coinciding words. this suggests this: [ (n + ok) / m + a million/2 ] = [ (n + ok) / m ] + a million every time period might want to be written as: n / 2^p + a million/2 the subsequent few words might want to be: n / 2^(p + a million) + a million/2, n / 2^(p + 2) + a million/2, n / 2^(p + 2) + a million/2, ... If x + a million/2 ? n / 2^p < x + a million including by utilising a million/2 will deliver it to the subsequent integer. some thing after this can be... x/2 + a million/4 ? n / 2^(p + a million) < x/2 + a million/2 hence you are able to't bypass up after both^p denominator time period... 2x + a million ? n / 2^(p - a million) < 2x + 2 doesn't round up. hence it really is proved. hopefully you understood what I meant.
The short answer: you can't. The longer answer: it depends largely on your function inside the floor function, and how much uglier you're willing to make the function. Certainly floor(constant) is simply a constant, floor(sin(x)) is relatively simple to describe: -1 on intervals (2pi*n-pi, 2pi*n), 0 on intervals [2pi*n, 2pi*n+pi/2) U (2pi*n+pi/2, 2pi*n+pi], and 1 at points 2pi*n+pi/2. You could also perhaps make some limiting procedure, like an infinite-degree polynomial, to describe things. I'm not positive how to go about trying this, but I wouldn't be surprised if it could be worked out somehow. Finally, you could cheat and just say floor(x) = x - fpart(x), where fpart(x) represents the fractional part of x. That's hardly a help though, as fpart isn't nicely defined either. This is essentially what the last answerer was doing with the modulus, although depending on how exactly you define the modulus it shouldn't give you problems with negative values; dividing -2.3 by 1 would actually give you a remainder of .7, and so x-(x&1)= -3, as desired. (Remainders are usually restricted to be between zero and the divisor.)

Share to: