Top "Arithmetic-expressions" questions

An arithmetic expression is an expression that results in a numeric value.

Arithmetic with array elements in bash

I'm using bash and trying to add all elements of an array that was created from a file. while read …

arrays bash math arithmetic-expressions
How do promotion rules work when the signedness on either side of a binary operator differ?

Consider the following programs: // http://ideone.com/4I0dT #include <limits> #include <iostream> int main() { int …

c++ overflow arithmetic-expressions integer-promotion
In T-SQL how can I get a column of 2-decimal points(or percentages)?

In SQL Server 2008, I am running a report where I need to divide two columns (called Completes and Prescreens, whole …

sql-server sql-server-2008 tsql math arithmetic-expressions
How to multiply/divide/add/subtract numbers of different types?

I'm working through the second edition of the Rust handbook, and decided to try and make the classic Celsius-to-Fahrenheit converter: …

math rust arithmetic-expressions
BASH: Percentage change - how to calculate it? How to get absolute value without bc?

I need to count a percentage change between two values. The code I have here: echo $time1 echo $time2 pc=$(( (($…

bash math arithmetic-expressions
What does the compiler do here: int a = b * (c * d * + e)?

I had a strange bug in my program, and after a few hours of debugging, I found the following very …

c++ arithmetic-expressions
Storing basic arithmetic operators in variables

How can I store a basic arithmetic operator in a variable? I'd like to do something like this in c++: …

c++ operators switch-statement arithmetic-expressions
bash: $[<arithmetic-expression>] vs. $((<arithmetic-expression>))

I have just stumbled upon the bash syntax: foo=42 bar=$[foo+1] # evaluates an arithmetic expression When I Googled for this, …

bash syntax operators legacy arithmetic-expressions