This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caculating Compounded interest without double values

 
Shirl Diva
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you calculate compound interest without being able to use any double values. There is also a need for an exponential value. How do I accomplish it. Help...anybody...
shirl
 
Bill Liteplo
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't you use doubles? What can you use, then? Ints, floats, perhaps Doubles?
Bill
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shirl,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
Bill Liteplo
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
treat all monetary amounts as integral numbers of pennies then, break
the result into its dollar and cents amount, via division and the modulus operator.

OK. That sounds not too bad.

The integer devision to calculate amountInDollars will always truncate.
The modulus operator ('%') will give the remainder.

Bill
 
Shirl Diva
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I am going to try this % once again. I can't seem to get to work. It had to be in all ints - I can't use Math.pow without a double value. Thanks though
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic