An arithmetic expression is an expression that results in a numeric value. There are two kinds of numeric values, integers (whole numbers), and real or floating point numbers (numbers containing a decimal point).
Questions tagged [arithmetic-expressions]
677 questions
0
votes
1 answer
How do you filter mathematically calculated data in SQL?
This is probably easier than I think it is, but I am stumped. I wrote the following query which sums up all the purchases made by a customer at a particular store, as well as the total amount of returns made by the same customer at the same store,…

Jason Bodak
- 123
- 1
- 2
- 10
0
votes
1 answer
Use sh while-read-line-loop iteration counter outside loop
I am writing git hook and very confused by next code behavior:
#!/bin/sh
exit_code=0
git diff --cached --name-only --diff-filter=ACM | while read line; do
echo "Do something with file: $line"
# some stuff with exit code is equals to 0 or…

Ivan Velichko
- 6,348
- 6
- 44
- 90
0
votes
2 answers
Use variable as operator for calculation C
I'm looking for a way to evaluate arithmetic operation using variable instead of operators.
Here is an example:
char op1 = '+';
char op2 = '/';
int i = 0;
i = 4 op1 5 op2 3;
I've no idea if its possible in C. But, if its possible.. would be…

samaxI92
- 11
- 1
- 4
0
votes
3 answers
Generating invalid inequality combinations
This is a pretty obscure question but I thought I'd try my luck.
I need to generate invalid combinations of inequalities for a set of unknown variables.
For example, given a, b and c, I would like to generate these:
a < b && a ≥ c && b ≤ c
a ⩵ b &&…

Max
- 2,760
- 1
- 28
- 47
0
votes
2 answers
calculating arithmetic expressions in assembly x86
i have an assembly x86 question
INCLUDE Irvine32.inc
.data
day WORD 0
month WORD 0
year WORD 0
count BYTE 0
prompt1 BYTE "enter month: ",0
prompt2 BYTE "enter day: ",0
prompt3 BYTE "enter an year: ",0
prompt4 BYTE " the day of the week is…

bluebk
- 169
- 1
- 6
- 21
0
votes
1 answer
Adding two params of a predicate that aren't static
I'm trying to add two numbers together
add(num1, num2, output) :-
output is num1 + num2.
Let's say X is 1 and Y is 3, but they're not static, just variables.
add(X, Y, out).
I get a error(instantiation_error,(is)/2) error
Any suggestions?

shoconinja
- 195
- 1
- 3
- 11
0
votes
3 answers
Arithmetic Recursion
I'm a beginner to scheme and I'm trying to learn some arithmetic recursion. I can't seem to wrap my head around doing this using scheme and producing the correct results. For my example, I'm trying to produce a integer key for a string by doing…

Sixers17
- 592
- 2
- 5
- 20
0
votes
1 answer
How do you calculate integers overflow?
I try to calculate, based on given parameters, integer overflow.
for example, if I have an integer than is <= 200, but when I insert it to an unsigned int, it will be > 200. What is the actual arithmetic process for that?

buddy123
- 5,679
- 10
- 47
- 73
0
votes
1 answer
Performing Arithmetic Operations On String In C#
Im a C# beginner here,Im taking string from textbox and applying following algo,but the breaking of operands and operator doesnt work..
string cal = "225+699";
char[] all= cal.ToCharArray();
int i=0,j=0;
while (all[i]…

Talha Hasan Zia
- 3
- 4
0
votes
1 answer
How to prevent arithmetic on null values?
Using Oracle11g:
If the column is null, I want to exclude the arithmetic on the column.
In this case, how can I get lag_diff for seqno=1 to be null?
with detail_records as (
select 1 seqno, 10 set_a from dual union all
select 2 seqno, 10…

zundarz
- 1,540
- 3
- 24
- 40
0
votes
3 answers
Bad practice to initialize and calculate in a single variable? Visual C++
Is it bad practice to initialize and do arithmetic within a variable? i.e say I have multiple rooms of different area dimensions that I must find the area of:
(example in feet)
double room_area1 = 9.5 * 6.8;
double room_area2 = 9.1 * 6.2;
double…

wilbomc
- 183
- 3
- 13
0
votes
1 answer
C, rounding problems. UWORD, ints, and doubles
I have a few questions as to what the results of these operations are.
Firstly, if I have two integers and divide them and save the result in a double. Will there be any rounding issues such that 1/2 will equal .5 and not 1.
double ratio =…

AnotherUser
- 1,311
- 1
- 14
- 35
0
votes
1 answer
Implementing an arithmetic parser in Prolog
I have the following Prolog code:
expression-->first,operator,second.
first-->[X].
operator-->['+'];['-'].
second-->[X].
After compilation, the machine responds with "yes" in the command line for the following types of queries:
| ?-…

Luka
- 1,718
- 3
- 19
- 29
0
votes
1 answer
how to assert an arithmetic relation in Prolog database
I'm using forward chaining algorithm proposed by Bratko. How can I enter arithmetic rules in prolog DB. For example I want to enter age is 35. In other words I want to enter the fact(age,35).
Thanks

remo
- 880
- 2
- 14
- 32
0
votes
1 answer
ACM programming - Arithmetica 1.0 - any additional operators?
Has anyone in this forum attempted to solve the ACM programming problem http://acm.mipt.ru/judge/problems.pl?browse=yes&problem=024? It is one of the simpler problems in ACM MIPT and the goal is to evaluate an expression consisting of +, -, * and…

so1
- 58
- 1
- 10