This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.

I need to perform the following formula 1-(1+i)(power)-n I know that i need to use the Math. class but im not sure on which one, i have tired maths.Floor and it didnt work (got a negative number) any help would be great as always .

I'd say you're looking for the static method Math.pow(). It works with positive or negative numbers. ...Assuming 'i' in your formula above isn't a reference to complex numbers, that is --Tim

I need to perform the following formula 1-(1+i)(power)-n This doesn't look like a mathematical expression that I can parse, but I think you have a compounded interest in mind: 1 - (1 + i)^(-n) If so, the corresponding Java code would be:

For more information, see the javadocs for the pow() method of the Math class

Peter Shipway
Ranch Hand

Joined: Mar 25, 2004
Posts: 71

posted

0

Yup im thinking compound interest, sorry shoulda said that, ah so its .pow i thought i couldnt use that because i was using ints not doubles lol, well looks like im still n00b rock on d0de!

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com