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
1 answer

Why does NVCC not optimize away ceilf() for literals?

(Followup question for Compile-time ceiling function, for literals, in C?) Considering the following CUDA function: __device__ int foo_f() { return ceilf(1007.1111); } It should be easy to optimize this to produce a device function which simply…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
2 answers

Compile-time ceiling function, for literals, in C?

I have a C program which involves some floating-point literal that's defined by a macro. And - it just so happens that in a performance-critical part of the code, I need the ceiling of that floating-point number, as an integer (say, an int). Now, if…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
1 answer

Math Function to convert Digits in Android - Kotlin

I am hoping for below outcomes : If Input => 25.69 - OutCome should be 25.6 If Input => -0.40 - OutCome should be -0.4 If Input => -0.004 - OutCome should be 0 or 0.0 To achive this I have tries as below : current=25.69 Log.e(">>> ceil ",">>>…
Jaimin Modi
  • 1,530
  • 4
  • 20
  • 72
1
vote
1 answer

How can we achieve excel ceiling function with significance value in SQL Server

How can we apply excel ceiling function with significance value in SQL server ? =Ceiling(10,3) it should return 12, because 12 is roundup nearest to 3 =Ceiling(36,7) it should return 42, because 42 is roundup nearest to 7 More examples:…
Asfan
  • 11
  • 1
1
vote
1 answer

If Perl already links to libm, why aren't any of the functions exposed to the user?

Perl already links to libm. $ ldd $(which perl) ... libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd8ce2ea000) ... So if Perl already links to libm, why aren't often used features like ceil, floor, and pow provided as…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
1
vote
3 answers

Round to the next tens in Python

Is there a way to round always up to the next tens? E.g., 0.000000000003 shall become 0.1. 0.1244593249234 shall become 0.2 and 0.9x shall become 1. Negative numbers are not a thing here. Is there a built in or do I need to come up with something?
newbypyth
  • 91
  • 1
  • 1
  • 8
1
vote
1 answer

JTable how to remove header border

Example: I have problem with table header. How can i remove this white border or change color of it? My code: JTableHeader header = table.getTableHeader(); header.setBackground(new Color(21, 25, 28)); header.setForeground(new Color(255,…
user13131961
1
vote
1 answer

Using PHP, how would I round a large integer to the nearest million

I have a situation where I am calculating the number of ad impressions per month. I found several examples rounding up but they don't work in my case. The sample data I'm working with shows 166,666 impressions per month (166,666 x 12) is being…
1
vote
1 answer

Customize rounding a decimal value in SQL Server

I have a list of values in SQL Server which need some customized rounding. I have tried with inbuilt SQL Server functions but those functions didn't work. I want to round a decimal value to nearest 5 value For example 1.02,1.01,1.03,1.04,1.05 --…
VRaju
  • 21
  • 1
  • 8
1
vote
1 answer

problem with the ceil function in javascript

I keep getting this error when I try to use the ceil function the error says ceil is not a function. Below is a picture I also tried to debug it but I don't see any error! As you can see the cal has a value of 2.8 which should be rounded to 3 so…
1
vote
1 answer

Troubles to compile a C programm

I'm a begginer in C programm and I've tried to do some exercices in order to learn how to programm. I did a lot of small and simple programms, but one of this I had a trouble. I can't compile it. I'm a linux user (linux mint) and I'm using VS Code…
1
vote
1 answer

Is there a function to creating a floor time or ceiling time for a character "time" vector formatted 00:00:00

I am working with a tibble containing call center data, and essentially what I am trying to determine is how many calls come in during a range of hours in 15 minute increments starting from 7:00 am to 7:00 pm. My data set looks like something below.…
72o
  • 43
  • 9
1
vote
1 answer

Trying to understand this bit of Matlab code

A friend of mine has written a Warlords battle odds calculator in Matlab that I would like to replicate in Python 3. I'm not very experienced in Python and don't know Matlab at all, but I can sort of see what's happening in the Matlab code. This one…
ghulseman
  • 125
  • 1
  • 1
  • 7
1
vote
3 answers

Why isn't math.ceiling rounding up my number? java

Trying to write this script that works with inputs that often go up into hundreds of billions. However, Math.ceil won't round upwards? int clayturns = (int)Math.ceil(clayneeded / 7500000000L); System.out.println((int) Math.ceil(clayneeded /…
sergiy
  • 161
  • 1
  • 2
  • 11
1
vote
1 answer

how to use a custom udf implementation to round the column

I have a pyspark dataframe like : +-------------------+ | to_return_day| +-------------------+ | -2.003125| | -20.96738425925926| | -2.332546296296296| | -2.206770833333333| |-2.9733564814814817| | 54.71157407407407| |…
liang xing
  • 17
  • 3