Ask Your Question
0

Rounding a number down to the nearest integer [closed]

asked 2012-11-29 21:21:48 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I need to round numbers down to the nearest integer from a macro. The int function does not appear to work and I'm not sure how to call the floor function from a macro. Any suggestions?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-19 02:39:43.950129

2 Answers

Sort by » oldest newest most voted
0

answered 2012-11-30 00:47:29 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Sorry for the post. I just checked and int is working. I usually try everything before posting a question so again I apologize.

edit flag offensive delete link more
0

answered 2012-11-30 00:43:31 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I think the INT function may work. What may be tripping you up is that arguments to a built-in function call from basic need to be arrays. See this link... http://ask.libreoffice.org/question/6341/eastersunday-in-librebasic-calc/

Try this:

function tofloor(num)
svc=createUnoService("com.sun.star.sheet.FunctionAccess")
arg=array(num)
tofloor=svc.callFunction("INT",arg)
end function

You could also call the FLOOR function, but it is more involved.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-29 21:21:48 +0200

Seen: 4,013 times

Last updated: Nov 30 '12