Questions tagged [ceil]

A function common to many programming languages that returns the next integer value by rounding the value up if necessary.

Returns the next highest integer value by rounding up value if necessary. php.net

Examples

echo ceil(1.3);    // returns   2
echo ceil(10.9);   // returns  11
echo ceil(-3.14);  // returns  -3
301 questions
1
vote
2 answers

IF formula not working - Trying to calculate correct shipping costs on items (Excel)

I'm having problems trying to do this formula and it just doesn't work. Can anyone help…
Mayur
  • 13
  • 3
1
vote
3 answers

Facing issue while rounidng up a value in python

I have following code import math a = (4, 31) b = (0, 29) c = (1, 31) print(int(math.ceil(sum(a) / 7))) print(int(math.ceil(sum(b) / 7))) print(int(math.ceil(sum(c) / 7))) I am getting output as 5,4,4 Ideally I should get 5, 5, 5 I am not sure…
user5844145
1
vote
2 answers

How do I round up/down a decimal place of a float value? C++

I know that you can use setprecision(x) to limit the amount of decimals displayed in the cout method. I was wondering how do I round a single decimal place up/down? For example: I have the number: 0.073 I want to round 7 upwards even though the…
Tommy Saechao
  • 1,099
  • 4
  • 17
  • 28
1
vote
3 answers

OpenNI human tracking from the ceiling with Asus Xtion Pro

I would like to track humans' path with an (later with many) Asus Xtion looking down from the ceiling. OpenNI's sample program called UserTracker (which uses the User Generator node) would be perfect, if it recognized bodies from top view, but it…
Tsirke
  • 13
  • 5
1
vote
1 answer

How can I always round a float number up?

I have a float number of 1.000001f I want to round it up to the next integer. In this case to 2. How can I do that? I tried Math.Floor, Math.Ceiling, Math.Round. Nothing works.
Johnny
  • 612
  • 3
  • 13
  • 32
1
vote
0 answers

Is there a name for "denominator minus one" part in division with rounding up?

This is the formula for integer division (for dividing x by y) with rounding up (from here): q = (x + y - 1) / y; y is called the denominator. Is there any widely accepted term for y - 1 in this formula?
sharptooth
  • 167,383
  • 100
  • 513
  • 979
1
vote
1 answer

Angular = getting invalid array length

I have the following function in my controller... $scope.pagerPages = function (n) { var i = Math.ceil(n); return new Array(i); } the n comes from an expression on the view, and can sometimes be a fraction. Which is why I've done Math.ceil…
Stuart
  • 1,544
  • 5
  • 29
  • 45
1
vote
3 answers

How to call ceil function in c++ from my classes's ceil function

I need to delegate 'ceil' function. My class has method 'ceil', which need to return cpp's native method 'ceil'. How to call it? double ceil() { return ceil(); } - this is a recursion
Shpytyack Artem
  • 306
  • 2
  • 15
1
vote
1 answer

Using the ceil() function more advanced

I am aware of what the ceil function does, it rounds numbers up. So; 1.3 to 2.0 and 5.9 to 6.0. But I want it to round up with steps of 0.5. So; 1.3 to 1.5 and 5.9 to 6.0. Is this possible? Thanks!!!
Vince
  • 648
  • 1
  • 7
  • 17
1
vote
3 answers

SAS ceil/floor issues using big numbers and wanting to ceil/floor to the nearest 10,000

I have one number which I need to find the ceiling and the floor value of (203,400) in order to use this number to create a weighted average. From this number I want: 200,000 and 210,000 so the code I was using that doesn't work is: S1CovA_ceil =…
Sarah Reinke
  • 57
  • 3
  • 9
1
vote
2 answers

Why is the ceil() function in LESS CSS failing for font calcuation?

I am trying to calculate font size based on ceil() and other. But ceil works first time but fails second time which is next to it after few lines of LESS. I tried with unit() as well. But nothing working easily. Two instances of similar code give…
Satya Prakash
  • 3,372
  • 3
  • 31
  • 47
1
vote
2 answers

Adding specific every N rows in MySQL

I'm trying to figure out how to select from this sample table and sum first 2 records, next two records, etc…. I have been trying to use rank and ceil but i'm clearly not managing to achieve success so thanks in advance to the human out there that…
1
vote
1 answer

Javascript using the ceiling function for value less than 1

So, I have a list of items and I want to check how many pages I would need if I want to show , say, 10 items per page ie 220 should give me 22 pages 134 should give me 14 pages I am using the ceiling function to get the number of pages var pages =…
littledevils326
  • 689
  • 3
  • 11
  • 19
1
vote
2 answers

Python: math.ceil trouble

Here is the issue: >>> 16/float(1184000) returns: 1.3513513513513513e-05 if I try to run math.ceil on this number, i get "1" instead of "2" >>>math.ceil(16/float(1184000)) returns: 1.0 This seems odd, any ideas how to address this?
downbySF
  • 141
  • 1
  • 1
  • 11
1
vote
2 answers

glob2rx in R to get all cells whose last decimal is 5?

I have a matrix that looks lke this: wun2 308.0 111.0 72.0 64.0 wupA 8177.0 3933.0 2235.0 2057.0 wus 5.0 0.0 9.0 …
Carmen Sandoval
  • 2,266
  • 5
  • 30
  • 46