Skip to main content

Questions tagged [math-expression-eval]

Questions related to the parsing (and possibly the evaluation) of free-form mathematical expressions in strings, lists, or streams

3 votes
1 answer
55 views

Advanced String Calculator with asin, acos, atan Functions in C++

This is a follow-up question for Advanced String Calculator in C++. Considering the suggestions mentioned in MrBean Bremen's answer, I am trying to update the implementation as below. The experimental ...
JimmyHu's user avatar
  • 5,392
3 votes
1 answer
159 views

Advanced String Calculator in C++

This is a follow-up question for String Calculator in C++. Considering the suggestions mentioned in MrBean Bremen's answer and Martin York's answer. I am trying to modify the code and trying to ...
JimmyHu's user avatar
  • 5,392
4 votes
2 answers
142 views

String Calculator in C++

As a coding exercise, I am trying to implement a calculator which takes string as input, with addition (+), subtraction (-), multiplication (*), division (/) and power (^) functions. For example, ...
JimmyHu's user avatar
  • 5,392
2 votes
1 answer
181 views

Evaluate a prefix expression

The algorithm involves using two stacks. One stack (call it token_stack) holds the operators (like +, - etc) and operands (like 3,4 etc) and the other stack (call it count_stack) holds the number of ...
Harith's user avatar
  • 9,462
2 votes
2 answers
103 views

Evaluating Polish Prefix Notation and Polish Postfix Notation

In Polish postfix notation, the operators follow their operands. For example, to add 3 and 4 together, the expression is 3 4 + rather than 3 + 4. The conventional notation expression 3 − 4 + 5 becomes ...
Harith's user avatar
  • 9,462
2 votes
0 answers
41 views

2nd Update Per Feedback - C++ Binary Mathematics Class

Per feedback from here, below is the updated bitvector class. The class was renamed from binary_register to ...
StormCrow's user avatar
  • 369
4 votes
1 answer
61 views

Updated Per Feedback - C++ Binary Mathematics Class

Below is the updated binary mathematics class from the feedback provided here. It was decided that the project should simply be written with an expectation of using C++20 as the minimum version to use....
StormCrow's user avatar
  • 369
6 votes
1 answer
667 views

C++ Binary Mathematics Class

I am working on an arbitrary math lib. Below is a class I use to handle the binary mathematics needed for the library. The class is quite simple. All it does is wrap around a vector of any unsigned ...
StormCrow's user avatar
  • 369
3 votes
3 answers
686 views

Command line calculator in C

This code is an arithmetic parser as is the code in a previous question of mine. However this parser handles floating point arguments and mathematical functions, and handles them without needing to ...
CPlus's user avatar
  • 938
4 votes
2 answers
300 views

Designing a basic Binary Expression Tree structure

Preface I need to generate some algebraic expressions for math testing in elementary school. The test should generate a list of expressions compiled according to certain rules and check the ...
chptr-one's user avatar
  • 495
2 votes
1 answer
233 views

Modelling mathematical expressions in Rust

I've been trying so hard to come up with a data model that works for mathematical expressions (like x^2 + 2x - y * 4, no equals sign) in Rust. It's very different to other languages I'm most familiar ...
minseong's user avatar
  • 749
1 vote
0 answers
130 views

Arithmetic expression evaluation class used in a React component

How can I refactor the calculation() function I have used react class-based component for example extracting to separate individual function such as: ...
JS King's user avatar
  • 21
10 votes
1 answer
710 views

Mathematical expression evaluator (C++) Using Flex and Yacc

Based on this question, I thought I should show how to implement an expression evaluator using Flex and Bison. Updated: Here Currently it does not handle releasing the expressions (I only spent an ...
Loki Astari's user avatar
  • 95.4k
8 votes
1 answer
2k views

Mathematical expression evaluator (C++)

I'm new to C++ and I decided to experiment with the language, by writing a mathematical expression evaluator, using the Shunting-Yard algorithm. A design choice that may stand out as weird is the fact ...
CubeyTheCube's user avatar
6 votes
4 answers
584 views

K&R Exercise 5-10. reverse Polish calculator

I have been learning C with K&R Book 2nd Ed. And well, so far I've gotten to chapter five, and I've been dealing with pointers/command line arguments. I came up with the following solution for the ...
jr.çhåvez__07's user avatar

15 30 50 per page
1
2 3 4 5
14