Questions tagged [math-expression-eval]
Questions related to the parsing (and possibly the evaluation) of free-form mathematical expressions in strings, lists, or streams
                196 questions
            
            
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                89
            
            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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                202
            
            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 ...
                
            
       
        
            
                4
            
            votes
        
        
            
                2
            
            answers
        
        
            
                288
            
            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, ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                209
            
            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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                136
            
            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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                0
            
            answers
        
        
            
                81
            
            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 ...
                
            
       
        
            
                4
            
            votes
        
        
            
                1
            
            answer
        
        
            
                97
            
            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....
                
            
       
        
            
                6
            
            votes
        
        
            
                1
            
            answer
        
        
            
                714
            
            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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                3
            
            answers
        
        
            
                866
            
            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 ...
                
            
       
        
            
                4
            
            votes
        
        
            
                2
            
            answers
        
        
            
                351
            
            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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                251
            
            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 ...
                
            
       
        
            
                10
            
            votes
        
        
            
                1
            
            answer
        
        
            
                775
            
            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 ...
                
            
       
        
            
                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 ...
                
            
       
        
            
                6
            
            votes
        
        
            
                4
            
            answers
        
        
            
                663
            
            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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                332
            
            views
        
        
            
            
            
        Binary Expression Tree that evaluates Postfix input
                    My code for a Binary Expression Tree that takes postfix input from the user and recursively builds and evaluates the expression. Proper input can be assumed.
...
                
            
       
         
         
         
         
         
         
         
        