Questions tagged [calculation]

Mathematical operation or series of operations which takes some input and gives an output.

A calculation is at the simplest level the execution of some mathematical equation. Based upon the composition of this equation, including variables, operators or more complex functions implementing user-defined logic, a particular calculation can be very crucial to the correct operation of an overall system.

In software there are many different mathematical operators which may make up an equation a calculation executes:

  • Addition (+)
  • Subtraction (-)
  • Multiplication (x)
  • Division (/)
  • Bitwise AND (&)
  • Bitwise OR (|)
  • Bitwise XOR (^)
  • Bitwise NOR (~)
  • Bitwise LSHIFT (<<)
  • Bitwise RSHIFT (>>)
1579 questions
2
votes
2 answers

Arithmetic operators

As you know there are arithmetic operators like + or -. Is there a way to create my own operator which can execute a specific task between two variables? For example: a, b = 2, 5 a '+' b == 7 What I would like to do: a 'my own operator' b ==…
Florian
  • 43
  • 1
  • 1
  • 5
2
votes
1 answer

is there a good way to calculate sum of product in Rust?

I'm new to Rust, and I'm looking for a good way to calculate the sum of products in Rust. I mean if there is a Vector like [3, 4, 5], I wanna calculate (3 * 4) + (3 * 5) + (4 * 5). this is my method, fn main() { let a = [3, 4, 5]; …
kubosuke
  • 45
  • 5
2
votes
3 answers

How to calculate with rows in a column in R

I am trying to do calculations with rows in a column: I have the following data for one product: Day Price 1 3$ 2 12$ 3 4$ 4 2$ 5 4$ I want to divide the price change of a day by the day before so, for example for Day…
upflow
  • 35
  • 4
2
votes
3 answers

Divide numbers into equally-spaced intervals ranging between 0-1

Suppose I have this series of numbers in a vector: vec <- c(1,2,3,4,5) # just an example, numbers could be far higher How can I programmatically divide these numbers into equally-spaced intervals ranging between 0-1, such that I…
Chris Ruehlemann
  • 20,321
  • 4
  • 12
  • 34
2
votes
1 answer

Magento 2 / Prices and subtotals with 4 decimals But VAT and Totals on 2 decimals

I had to change prices to 4 decimals and it's OK. However, i have sometimes rounded cent in totals which is wrong. The explanation is that all calculations (subtotal, VAT and total) are on 4 decimals then rounded to 2 decimals. With rounding,…
Aurel
  • 338
  • 2
  • 13
2
votes
1 answer

Cesium JS ellipsoid tangent plane calculation

Problem I am a bit confused on how Cesium calculates geodetic and geocentric surface normal. Planes, generated from calculated normal do not actually tangent to ellipsoid surface in a given point, more then, the plane created from geodetic surface…
2
votes
1 answer

Is there a way to calculate progress rate without total process count?

I think this is difficult thing. In general I know that I need total and current count for gaining rate to something. But in this case, I cannot get total count. For example, there are two jobs, A and B. Their total process will be always set…
miniar
  • 127
  • 1
  • 8
2
votes
1 answer

Two Separate Ranges of Business Hours (Like Shifts) Between Date Ranges

I've run into a dilemma that I thought I would overcome easily but ended in getting different results. So I've been using the following…
Major Aly
  • 2,570
  • 3
  • 16
  • 19
2
votes
2 answers

Calculating table quantity and multiplication

Table_exaple Hello, I need some help. My problem is that I can't figure out how to do this. The whole point of my simple project is to create a table only with input text boxes where only integers will be added, and I need to sum columns only. As…
2
votes
1 answer

How can I numerically (and efficiently) integrate and plot my function?

I want to do a plot of this equation below: Problem 1: You see... since my function is a function of ν I have to calculate my integral to each ν in my domain. My question is: what is the best way to do that? I thought about using scipy to do the…
kplt
  • 59
  • 6
2
votes
0 answers

Calculating with a numeric entry value

I am writing a GUI with tkinter, and I try to use an entry widget. Users should enter a numeric value within the entry box. Within the code I wrote a function which uses the entered numeric value in a calculation, using the .get() method to receive…
2
votes
2 answers

How to devide some fixed amount of reward points to players of a racing game in a fair way depending on their finishing time

I'm in need of some kind of algorithm I can't figure out on my own sadly. My biggest problem is that I have no good way to describe the problem... :/ I will try like this: Imagine you have a racing game where everyone can try to be the fastest on a…
2
votes
1 answer

Calculate and display total of input field when changing in Angular material table

I have a angular material table with input fields in it. Need to calculate the total (without button) and display at the bottom. Also when change the input number , should recalculate and display. It calculates and displays sum of what is in the ts…
2
votes
1 answer

How may I Limit decimal to two

Hello everyone and I hope you can help me. I have 'value' => $amount_to_pay and I want $amount_to_pay to me multiplied by 0.11 but the output to be limited to only 2 decimals. It is for PayPal. I used 'value' => $amount_to_pay*0.11 but what comes…
OUALID
  • 25
  • 3
2
votes
1 answer

algorithm to calculate the difficulty of randomly generated minesweeper map with fixed number of mines

I'm making a minesweeper game in minecraft (never mind). I created a code that randomly places mines, displays the number of bombs around each block, detects clear and fail of the game. Even if the same number of mines were placed on a map of the…
recu
  • 31
  • 3