divide two double number

I want to divide two double number and then round up the  result to integer

What is the easiest way ?
cofactorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BlueYonderCommented:
double a1=157;
double a2=32;
int total = (int) Math.ceil(a1/a2)
0
CEHJCommented:
Math.ceil is not the same as rounding ...
0
Rainer JeschorCommented:
Hi,
which programming language?
You added Java and JavaScript topics - but they are totally different languages with different data types and functions.
Thanks.
Rainer
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

cofactorAuthor Commented:
java should be fine.

Although I am using a different  language   but  java  should get this thing done there.  I am using a BPM tool where language similar to java is used.

Here is the actual language  though http://openl-tablets.sourceforge.net/

I am stuck to do this two things  basically :

Isssue 1 :

Double d1
Double d2

Double d3 = (d1/d2)*100  // round up this  result upto 3 digits

Issue 2:

Double d1
Double d2

Double d3 = (d1/d2)*100  // round up the  result to integer

I am looking for a  solution .   provide  me few choices to try with.  Need help at this part.

Thanks
0
CEHJCommented:
Rounding is done in Java at presentation time, since there is usually no reason to diminish accuracy until then

String presentationValue = String.format("%.3f", d1/d2*100);

String presentationValueAsInteger = String.format("%d", Math.round(d1/d2*100));

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cofactorAuthor Commented:
Thanks CHEJ,

I would love to use that ...

But String format is not recognized in this language  http://openl-tablets.sourceforge.net/  

Is there any mathematical solution ?  without  any API method call
0
CEHJCommented:
I don't know the language, so i'm giving you Java, as you asked ;)
Try NumberFormat
0
cofactorAuthor Commented:
Yup...found a work around...thanks.
0
CEHJCommented:
:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.