• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java - Big Number Support and Algorithms for Mathematical Problems  RSS feed

 
Jijesh T Das
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,

1. If we get a mathematical expression as a string, say "1/(1+(2^2)), how to write a basic program which solves this expression step by step, as it is done in this website http://www.careerbless.com/calculators/ScientificCalculator/ . You can suggest the basic steps and algorithms or pointers in which I need to work to achieve this

2. How to get very big number supports

Please suggest.

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. You'd have to implement a parser to parse such expressions into a suitable data structure, and then write code that can evaluate the expression represented by the data structure.

2. For numbers that don't fit into Java's regular data types, use BigInteger or BigDecimal (look them up in the Java API documentation).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!