Math Function "CEILING (number, significance)" does not work properly?

Math Function “CEILING (number, significance)” does not work properly?
Example 1: CELING (-1.24)
value is changed to “2” (and should be “-1”)
Example 2: CELING (-1.24, .1)
the value changes to “-1.3” (and should be “-1.2”)
in my opinion
for example, the function “FLOOR (number, significance)” - is working properly. And for negative values - the results of both functions - the same, but must be different.
Example 2: FLOOR (-1.24)
value will be changed to “-2”
Example 3: FLOOR (-1.24, .1)
value will be changed to “-1.3”
What is the reason?
I have checked the performance of the functions in this example:

SU2015 Pro 15.2.685 version of the 64-bit windows7

[quote=“arxutektor, post:1, topic:6269”]
Math Function “CEILING (number, significance)” does not work properly?
Example 1: CELING (-1.24)
value is changed to “2” (and should be “-1”)[/quote]

use Round(number, decimal places)

(though your example, Ceiling(-1.24) should return -2 (which it does for me)

but… Round(-1.24) returns -1

Example 2: CELING (-1.24, .1)
the value changes to “-1.3” (and should be “-1.2”)[/quote]

Round(-1.24, .1) will give -1.2

not sure but that’s the way it works with Ceiling in my spreadsheet application (numbers)… or, in that app, the signs for Ceiling have to match… =Ceiling(-1.56, -.1) gives you -1.6

no mixing of pos&neg… =Ceiling (1.654, -.25)
it will give a syntax error if trying to use that.

I think that the function itself is an “CEILING (number, significance)” - is not working properly.

In other program languages, Ceiling(-1,24) will return -1.
Examples for C#:

     Value          Ceiling          Floor        Round
      7.03                8              7            7
      7.64                8              7            8
      0.12                1              0            0
     -0.12                0             -1            0
      -7.1               -7             -8           -7
      -7.6               -7             -8           -8

Yes I Am. Therefore, I believe that there is a incorrect operation of function.
This is - a mathematical function, and its logic should not differ from other programs to mine.

that’s how python works as well… however, earlier i said “i’m not sure why but this is how it works in my spreadsheet app”… it’s different there.

i don’t have excel to try but using

or trying to use =Ceiling(-1.24, .1) in my spreadsheet app (

so i guess the question becomes… which spreadsheet or programming language should dynamic component’s Ceiling function be consistent with? because there doesn’t seem to be consistency in general with the function as shown above.

generally, spreadsheets have RoundUp and RoundDown functions (which i believe are missing from DC)… but in numbers, i’d have to do something like
if x<0 roundDown(x) else roundUp
in order to get similar functionality as i get with python ceiling…

1 Like

the unfortunate workaround in dynamic components to get similar functionality as python seems to be something like:


…and it’s going to get more confusing when adding significant values amongst all of that :wink:

arxutektor makes a valid point. The “ceiling” function in mathematics is defined differently than the CEILING function in SketchUp DC (which is “The CEILING function rounds a number to the nearest integer or multiple of significance”).

Using Excel 2010, I get the following:

Wikipedia notes:

"Most spreadsheet programs support some form of a ceiling function. Although the details differ between programs, most implementations support a second parameter—a multiple of which the given number is to be rounded to. For example, ceiling(2, 3) rounds 2 up to the nearest multiple of 3, giving 3. The definition of what “round up” means, however, differs from program to program.

Until Excel 2010, Microsoft Excel’s ceiling function was incorrect for negative arguments; ceiling(-4.5) was -5. . This has followed through to the Office Open XML file format. The correct ceiling function can be implemented using “-INT(-value)”. Excel 2010 now follows the standard definition.

The OpenDocument file format, as used by and others, follows the mathematical definition of ceiling for its ceiling function, with an optional parameter for Excel compatibility. For example, CEILING(-4.5) returns −4."

1 Like

yeah, i think he does too.

the point i was making (which is also being said in the wiki) is that Ceiling doesn’t have consistent behavior across applications… some act the same as DC, some are opposite, then googledocs seems to be a mixture of the two…

personally, i think the ones which do ceiling(-1.25) = -1 are the ones that are doing it ‘correctly’…
or- if sketchupDC were to adopt the OpenDocument file format, you’d hear no complaints out of me :wink:

idk, i have 5-6 dynamic components which use the Ceiling function in them but luckily for me, none of them are dealing with negative numbers… i never realized this behavior until arx made this thread.

what do you get in excel if you leave out the second parameter… just Ceiling(-1.24)

Thank you for the clarification. I learning DC, and translate into Russian explanations. Check that how it works. That met the discrepancy. I have found a inconsistencies description set forth here:

but do not even know whether to publish them here.

When I try to use only the value in Excel, I get an error:

“You’ve entered too few arguments for this function.”

Here are some more examples:

Since the mathematical definition only deals with the single numerical value and not the significance, implementation of a function that accepts two values is somewhat arbitrary and may not result in the expected outcome. However, for consistency, any computer function that uses an existing math operator with the same name should implement the code in a manner that is consistent with its namesake (IMHO).

As noted above for other languages, compare to the Ruby math function “ceil”:

(1.24).ceil = 2
(-1.24).ceil = -1

yeah, i don’t disagree with that… the problem however is that there’s no consistency with the namesake as far as i can gather…

here’s another inconsistency… in excel, you’re saying you can’t use =Ceiling(-1.24)…
with excel online, you can (and it gives the results consistent with the programming languages)

It appears that there is another Excel CEILING function that will accept only one parameter:

This appears to implement the mathematical definition correctly.

i personally think that’s the correct way… DCs should probably work like that too.

or better yet, all of programming_land should come together and agree on one method :smile:

until that time however, if you want the proper mathematical definition in sketchup, i think you’ll have to use the formula i posted earlier:


that’s saying:
if it’s a positive number, use Ceiling
if it’s a negative number, get the absolute value of it, then get the floor, then make it negative