Questions tagged [addition]

Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign (+).

Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign (+).

It is commutative, meaning that order does not matter, and it is associative, meaning that when one adds more than two numbers, order in which addition is performed does not matter.

(Wikipedia)

5629 questions
89
votes
7 answers

What is the syntax for adding an element to a scala.collection.mutable.Map?

What is the syntax for adding an element to a scala.collection.mutable.Map ? Here are some failed attempts: val map = scala.collection.mutable.Map map("mykey") = "myval" map += "mykey" -> "myval" map.put("mykey","myval")
Koala3
  • 2,203
  • 4
  • 20
  • 15
88
votes
7 answers

Datetime in C# add days

I want to add days in some date. I have a code like this: DateTime endDate = Convert.ToDateTime(this.txtStartDate.Text); Int64 addedDays = Convert.ToInt64(txtDaysSupp.Text); endDate.AddDays(addedDays); DateTime end = endDate;…
Nomi Ali
  • 2,165
  • 3
  • 27
  • 48
81
votes
5 answers

Why does adding two decimals in Javascript produce a wrong result?

Possible Duplicate: Is JavaScript’s Math broken? Why does JS screw up this simple math? console.log(.1 + .2) // 0.3000000000000004 console.log(.3 + .6) // 0.8999999999999999 The first example is greater than the correct result, while the…
Greg Perham
  • 1,835
  • 1
  • 17
  • 26
80
votes
1 answer

C addition using modulus

I came across an intriguing C code that prints A + B, but I have trouble understanding it. Input Format: A B where A, B are integers between 0 and 10 separated by a single space. Code: main( n ) { gets( &n ); printf("%d", n % 85 -…
William Lee
  • 590
  • 4
  • 8
78
votes
16 answers

git add . -> still "nothing to commit" with new files

I am struggling with Git, I can't seem to add my files. I ran ls to show that the files are in the current directory, then ran git add . then git status which showed "nothing to commit". JJ-Computer:first_app JJ$ git init Reinitialized existing…
RandyMy
  • 1,013
  • 1
  • 8
  • 9
76
votes
8 answers

Add to python path mac os x

I thought import sys sys.path.append("/home/me/mydir") is appending a dir to my pythonpath if I print sys.path my dir is in there. Then I open a new command and it is not there anymore. But somehow Python cant import modules I saved in that…
MacPython
  • 17,901
  • 10
  • 42
  • 48
74
votes
3 answers

How to force addition instead of concatenation in javascript

I'm trying to add all of the calorie contents in my javascript like this: $(function() { var data = []; $( "#draggable1" ).draggable(); $( "#draggable2" ).draggable(); $( "#draggable3" ).draggable(); …
Maureen Moore
  • 1,049
  • 2
  • 9
  • 21
68
votes
10 answers

git: How do you add an external directory to the repository?

I want to add an external directory to an existing repository. External Dir: /home/some/directory Working Dir: /htdocs/.git If I attempt the following command from the /htdocs dir: git add /home/some/directory I get an error: fatal:…
Sly
62
votes
9 answers

Add jQuery function to specific elements

I know that you can add new jQuery functions by $.fn.someFunction = function() However, I want to add functions to specific elements only. I tried this syntax and it doesn't work $('.someElements').fn.someFunction = function() I want to do this so…
user2385136
62
votes
6 answers

Adjust Single Value within Tensor -- TensorFlow

I feel embarrassed asking this, but how do you adjust a single value within a tensor? Suppose you want to add '1' to only one value within your tensor? Doing it by indexing doesn't work: TypeError: 'Tensor' object does not support item…
LeavesBreathe
  • 1,010
  • 2
  • 9
  • 17
61
votes
12 answers

Is integer multiplication really done at the same speed as addition on a modern CPU?

I hear this statement quite often, that multiplication on modern hardware is so optimized that it actually is at the same speed as addition. Is that true? I never can get any authoritative confirmation. My own research only adds questions. The speed…
exebook
  • 32,014
  • 33
  • 141
  • 226
61
votes
6 answers

How to add text to an existing div with jquery

I want to add text to an existing div, when I click the Button with the id #add. But this is not working. Here my code: $(function () { $('#Add').click(function () { $('

Text

').appendTo('#Content'); }); });
JSt
  • 799
  • 2
  • 10
  • 21
58
votes
2 answers

R inconsistency: why add=T sometimes works and sometimes not in the plot() function?

Why is R inconsistent with the add parameter in the plot() function? It sometimes works and sometimes doesn't! In this example, it takes the parameter add=TRUE with no problem: plot(0:10, 0:10*3) plot(identity, add=TRUE, xlim=c(0,10)) plot(function…
Tomas
  • 57,621
  • 49
  • 238
  • 373
58
votes
6 answers

Adding any current directory './' to the search path in Linux

How do you add any current directory './' to the search path for executables in Linux?
Brian Mckinlay
  • 581
  • 1
  • 4
  • 3
54
votes
2 answers

Add text to textarea - Jquery

How can I add text from a DIV to a textarea? I have this now: $('.oquote').click(function() { $('#replyBox').slideDown('slow', function() { var quote = $('.container').text(); …
Oliver 'Oli' Jensen
  • 2,631
  • 9
  • 26
  • 40