ceil Questions

5

Solved

I have two questions regarding ceil() function.. The ceil() function is implemented in C. If I use ceil(3/2), it works fine. But when I use ceil(count/2), if value of count is 3, then it gives co...
Timekeeper asked 9/5, 2010 at 4:52

6

Solved

I'm trying to allow my program to round a number up and down respectively. For example, if the number is 3.6, my program is suppose to round up the nearest number which is 4 and if the number is ...
Karyogamy asked 7/10, 2016 at 20:7

7

Solved

I have a pandas series series. If I want to get the element-wise floor or ceiling, is there a built in method or do I have to write the function and use apply? I ask because the data is big so I ap...
Ellington asked 21/12, 2014 at 18:32

9

I am having trouble rounding a GPA double to 2 decimal places. (ex of a GPA needed to be rounded: 3.67924) I am currently using ceil to round up, but it currently outputs it as a whole number (368)...
Vulgus asked 19/9, 2014 at 2:9

3

Solved

I´m looking for an alternative for the ceil() and floor() functions in C, due to I am not allowed to use these in a project. What I have build so far is a tricky back and forth way by the use of t...
Globate asked 13/12, 2019 at 11:30

6

Solved

I've found the following macro in a utility header in our codebase: #define CEILING(x,y) (((x) + (y) - 1) / (y)) Which (with help from this answer) I've parsed as: // Return the smallest multip...
Kedgeree asked 6/7, 2012 at 13:38

7

Solved

How would I manage to perform math.ceil such that a number is assigned to the next highest power of 10? # 0.04 -> 0.1 # 0.7 -> 1 # 1.1 -> 10 # 90 -> 100 # ... My current solution i...
Woodworth asked 3/4, 2020 at 9:35

7

Solved

How can I round up a CGFloat in Swift? I've tried ceil(CDouble(myCGFloat)) but that only works on iPad Air & iPhone 5S. When running on another simulated device I get an error saying 'NSNumber...
Fractious asked 12/6, 2014 at 10:20

7

Solved

Let's imagine this datetime >>> import datetime >>> dt = datetime.datetime(2012, 10, 25, 17, 32, 16) I'd like to ceil it to the next quarter of hour, in order to get datetime....
Lyndialyndon asked 25/10, 2012 at 14:56

3

Solved

What is the cleanest method to find the ciel and floor of a number in SQLite? Unfortunately SQLite only has ROUND() function.
Erida asked 28/1, 2019 at 10:27

8

Solved

I would say all programming languages have functions with these names to choose the lesser or greater of two values: min() & max() floor() & ceil() / ceiling() And some languages have b...
Bacteroid asked 15/3, 2012 at 17:26

5

Solved

Can somebody explain this ? echo ceil( 20.7 * 100 ); // returns 2070 echo ceil( 2070 ); // returns 2070 all OK and logical, but echo ceil( 40.7 * 100 ); // returns 4071 echo ceil( 4070 ); // re...
Mathieu asked 25/11, 2011 at 14:32

10

Solved

I know that C++ provides us with a ceil function. For practice, I was wondering how can we implement the ceil function in C++. The signature of the method is public static int ceil(float num) Ple...
Perfective asked 4/12, 2011 at 18:5

16

Solved

How would I do something like: ceiling(N/500) N representing a number. But in a linux Bash script
Arty asked 7/3, 2010 at 3:4

4

Solved

I need to floor a float number with an specific number of decimals. So: 2.1235 with 2 decimals --> 2.12 2.1276 with 2 decimals --> 2.12 (round would give 2.13 which is not what I need) The f...
Firm asked 23/9, 2019 at 14:52

6

Solved

I need to mimic the exact functionality of the ceil(), floor() and round() functions on bcmath numbers, I've already found a very similar question but unfortunately the answer provided isn't good e...
Interlanguage asked 29/10, 2009 at 9:53

1

Solved

Why don't ceil() and floor() return an integer? How can I return an integer? a = 10 b = 3 typeof(a/b) ## Float64 c = ceil(a/b) typeof(c) ## Float64 This issue bothered me in the context of calc...
Dulci asked 13/4, 2021 at 2:53

3

Solved

I know about math.ceil and numpy.ceil, but both of them lack of significance parameter. For example in Excel: =Ceiling(210.63, 0.05) -> 210.65 numpy.ceil and math.ceil in other hand: numpy.ceil...
Fanfaronade asked 6/10, 2011 at 8:54

3

Solved

I want to calculate a simple number, and if the number is not an integer I want to round it up. For instance, if after a calculation I get 1.2, I want to change it to 2. If the number is 3.7, I wa...
Dougherty asked 30/8, 2015 at 15:52

4

Solved

So I see this question has a good answer, but I want to round up no matter what, instead of rounding down no matter what. Adding 1 to it before casting int wouldn't work because it would "round" 5....
Skipbomb asked 19/2, 2013 at 22:45

4

Solved

I want to return the least integer value greater than or equal to integer division. So I used math.ceil, but can not get the value I want. package main import ( "fmt" "math" ) func main() { v...
Heard asked 10/11, 2013 at 14:35

15

Solved

Is there any Java function or util class which does rounding this way: func(3/2) = 2 Math.ceil() doesn't help, which by name should have done so. I am aware of BigDecimal, but don't need it.
Behoof asked 2/7, 2009 at 13:6

1

Solved

I'm using Ruby 2.3.1, and here's what I want to be able to do: 1.33333333.ceil(2) -> 1.34 1.33333333.floor(3) -> 1.333 The Float#round method allows me to round, but I need to be able to s...
Sidwell asked 4/4, 2018 at 16:56

3

Solved

I have the following code: int total = 6; int perPage = 5; double pages = total/perPage; double ceilPages = Math.ceil(pages); out.println(ceilPages); Which outputs 1.0. I thought it should outp...
Arathorn asked 5/6, 2014 at 14:9

1

Solved

The PHP docs state the following for the ceil() function: Return Values value rounded up to the next highest integer. The return value of ceil() is still of type float as the value range of f...
Brush asked 5/4, 2016 at 11:24

© 2022 - 2025 — McMap. All rights reserved.