Questions tagged [operators]

Operators are symbols that occur in nearly all programming and coding languages, used for performing calculations, comparisons, and assignments of data. Use this tag for any questions relating to operators, in any language, including things such as syntax, behaviour and use.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
40 views

Order of evaluation and associativity of ternary operator in C [duplicate]

I know associativity of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses And, ternary operators in C are right to left ...
Ajit Kumar's user avatar
-2 votes
2 answers
80 views

Make easely a sub array from an array

Check this c/c++ code, but just pay atention to the use of "&" operator and the array operations into the function. Its ok to pass an array like that?, will be any invalid access problem ...
Cebo's user avatar
  • 25
0 votes
1 answer
35 views

Using assignment operators in Dart

void main() { var a=10; var b=2; var toplam=a+=b; var fark=a-=b; var carpim=a*=b; var bolme=a/=b; print("$toplam"); print("$fark"); print("$carpim"); ...
Zeynep Baysoy's user avatar
0 votes
0 answers
22 views

How to run shell script from aws ECS operator

I have runcustomscript.sh inside my container (abs path: /opt/scripts/runcustomscript.sh) and I want to execute it through ECS operator: EcsRunTaskOperator( ... overrides={ "...
safa's user avatar
  • 21
0 votes
0 answers
27 views

Operator Associativity Test vs Operand Evaluation Order

I am trying to write a simple code structure that verifies whether the && operator in a language (not a specific language, so I can't get help of truthy/falsy values) is left-associative or ...
pnguib's user avatar
  • 43
1 vote
1 answer
36 views

Dictionary subscript or operator which adds a specified "default" value if key doesn't exist is Swift?

I need to write something like the following: var dict = [SomeEnum: SomeObject]() var someValue: SomeObject! = dict[.case1] if someValue == nil { someValue = someDefaultValue dict[.case1] = ...
Gargo's user avatar
  • 1,179
0 votes
1 answer
42 views

Reading the values out of an expression string, while keeping the formula intact

I have some code with mathematical operations, and I'm trying to make them easier to read and debug. But a very particular case is becoming complex, here's an example: public int val1=1; public int ...
desiredness's user avatar
0 votes
1 answer
58 views

How to create an "=" operator to check if a Structure type is null

I have never had any issues creating an operator before, but this time I am stumped. My goal is to be able to use the = operator to check if my structure type is null. Example: If myStruct = Nothing ...
John89's user avatar
  • 55
1 vote
1 answer
16 views

Why am I unable to start a connection using my operator's port in RapidMiner?

I'm unable to move or open the operators in my process view in RapidMiner. It has this numbers on top which does not happen normally. Can someone please tell me what to do? I have attached an image ...
Sarah's user avatar
  • 11
0 votes
1 answer
33 views

How does the tide-operator start a pd cluster?

I've recently been learning about Kubernetes operators. When deploying an etcd cluster, the etcd-operator uses the following creation method: Bootstrap phase: Start a seed member. In the ...
Phoenix Chao's user avatar
0 votes
1 answer
61 views

I do not understand how {int a=10; a+=++a-5/3+6*a; System.out.print(a);} outputs 86

I do not understand how { int a = 10; a += ++a-5/3+6*a; System.out.print(a); } outputs 86 I know that shorthand notation has lower precedence than any of the operator used here so my ...
Vyagh's user avatar
  • 1
0 votes
2 answers
26 views

I want to know which determines the output like not in this case applies to first condition only or both

x=(not (5==5) and (10<12)) print(x) when executing. not negates the first expression or both? In my opinion "not" should be executed with (5==5) only but my colleague says it will affect ...
sana's user avatar
  • 1
0 votes
0 answers
35 views

SQL without using union or union all

I am trying to write a sql query to get table name and counts of multiple tables under same result columns. Final Table: table_name table_count tbl1 10 tbl2 20 tbl3 40.....
Sam Sandy's user avatar
0 votes
2 answers
76 views

When is the dereferencing operator useful? [duplicate]

I am a newbie c-coder, so this probably has a very simple answer. I understand the function of pointers and the dereferencing operator, but I'm not sure when they're actually useful? Basic example: ...
ScoutRr's user avatar
2 votes
1 answer
132 views

Task Mapping over a task group without using decorator

I have implemented a task group that is expected to be reused across multiple DAGs, in one of which utilizing it in a mapping manner makes more sense. Here is the full code of my task group: from ...
Memphis Meng's user avatar
  • 1,346
-1 votes
1 answer
62 views

perform calculation based on the operator passed as method parameter [closed]

I'm trying to do arithmetic operations based on the operators passed as method parameter. I can perform this in many ways but problem is I've a datatable to be operated upon. I cannot pass particular ...
StackUseR's user avatar
  • 918
-3 votes
1 answer
70 views

Could you please explain below three codes?, why they are giving different results

code 1 list_a = [] list_a += str(1) O/P: ['1'] code 2 list_a = [] list_a += 1 O/P: Type Error code 3 list_a = [] list_a = list_a + str(1) O/P: Type Error I'm expecting that if += operator ...
Bhuvana ravula's user avatar
0 votes
1 answer
60 views

Why the overloaded+ operator cannot be used with a primitive type static_cast to a class?

I'm just starting to dive into the depths of C++. Recently I came across a task to create a bMoney class that will store some monetary value. At the same time, the class must have overloaded operators ...
George's user avatar
  • 3
0 votes
0 answers
39 views

"*/" as a data conversion operator

I am currently reverse engineering a SQL database for in-car communications over a CAN network. Specifically, this is from the internal database of Volvo‘s VIDA diagnostics program. There is a table ...
pnda's user avatar
  • 196
2 votes
0 answers
31 views

Operators precedence/pre-post operators [duplicate]

In running the below code, I got 25 which really puzzles me...any explanation? I was expecting 20 (4 times 5 or 5 times 4) #include <stdio.h> int main() { int a=3; int res=++a*(a++ +1); ...
S23's user avatar
  • 41
0 votes
1 answer
158 views

mongodb-kubernetes-operator - mongodb-agent is never ready

What did you do to encounter the bug? Steps to reproduce the behavior: Deploy manager v0.8.2 then MongoDBCommunity v6.0.5 What did you expect? Mongodb-agent ready and cluster OK What happened instead? ...
Doul's user avatar
  • 31
-1 votes
1 answer
36 views

What does the ? operator do in C#? [duplicate]

I'm looking through this piece of code: https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Runtime/GaussianSplatRenderer.cs and line 65 has, m_CommandBuffer?.Dispose(); Which I don't ...
Ethan's user avatar
  • 167
0 votes
0 answers
35 views

PromQL if else logic

I want to write a recording rule such that: new_uptime = uptime if util <= 100 else uptime - (util - 100) i.e Logic to record new_uptime metric is: new_uptime = uptime when util less than or equal ...
user22801927's user avatar
0 votes
1 answer
37 views

Why I not am getting desired result while using == to compare elements of two SORTED arraylist [duplicate]

I want Make a new Arraylist of the common element from Two SORTED ARRAYLIST list1 and list2 I use "==" operator and got wrong answer the I used ".equals()" operator and got ...
Robot..'s user avatar
1 vote
2 answers
52 views

Parentheses and Unary Operator Precedence in Java

As per the order of precedence of operators, () is evaluated before unary operators like ++ or --. But let us consider the following code:- int x = 1; x = 2 + (x++); If x++ is executed first, the ...
Chinmay Krishna's user avatar
1 vote
0 answers
17 views

Spread/rest operator includes properties from target type that are not on on destination type [duplicate]

I've noticed that when spreading properties from A into B, where A extends B, all of the properties from A are included even though they do not exist on B. For example: interface B { name: string; } ...
devklick's user avatar
  • 2,237
-1 votes
1 answer
93 views

Why is the && operator is acting as || in this c code and vice versa? [duplicate]

I was Writing a program that prints all possible different combinations of two digits and in good formatting: Numbers must be separated by a comma and followed by a space except the last digit it ...
Bemin Dawoud's user avatar
-2 votes
1 answer
82 views

Fonction skip bool and doesn't calculate [duplicate]

Welcome in my misery. I'm a novice/beginner in coding :) I've been trying to write a calculator that detects anomalies in the input provided. My first problem was to neglect any letters and that was ...
TheAX 0198's user avatar
0 votes
1 answer
32 views

meaning of "%" in printing the result of adfuller in Python

There's a % in the following code, which is from ARIMA Model in Python . from statsmodels.tsa.stattools import adfuller from numpy import log result = adfuller(df.value.dropna()) print('ADF Statistic:...
tsx's user avatar
  • 67
0 votes
0 answers
14 views

sqlalchemy operator from variable

I try to pass an operator as variable in a filter query (sqlalchemy), but I don't know how do that: I wrote this: while True: col_value = request.args.get(f'searchBuilder[criteria][{i}][...
user avatar
0 votes
0 answers
107 views

TensorflowLite error: Didn't find op for builtin opcode 'WHERE' version '1'

I would like to run the model that I made on the Arduino BLE 33 board(nRF52840) while uploading to board using ArduinoIDE below massage appeared Didn't find op for builtin opcode 'WHERE' version '1'. ...
Seongjae Lee's user avatar
2 votes
1 answer
46 views

What does `operator () { ... }` do in Dart?

Here is a simple dart class: class MyOperatorClass { int operator () { return 5; } } I noticed today that this compiles without any issues. This led me to wonder, what does operator ()...
Taylor Brown's user avatar
3 votes
4 answers
129 views

How to change 1 to zeros in the binary form in C

I can't figure out how to change any consecutive 1 to zeros in the binary form of x (consecutive 1 means a set of 1 that contains more than one 1). Problem specifications: Allowed operators: ! ~ & ...
jess's user avatar
  • 43
0 votes
1 answer
53 views

Hide Shipping Method conditionally based on Shipping Class, Cart Quantity and Cart Total in WooCommerce

I am encountering some issues with my condition to check for cart total, amongst cart quantity and shipping classes. What I am trying to achieve I am trying to hide a specific shipping method ...
Richard's user avatar
  • 61
1 vote
0 answers
39 views

why is it that you can append to a list with the '+=' operator but not with the '+' operator? [duplicate]

the codes below are attempting to append an item to a list this works well! word = [] word += "e" print (word) this returns error word = [] word = word + "e" print (word) 1st ...
Isaac Semb's user avatar
1 vote
2 answers
108 views

How best to represent logic and relational operations in JSON?

I am trying to create/store some filtering conditions in JSON. I understand JSON is used to represent data and is not a scripting language but i am working with some limitations here. I have a SQL ...
user176047's user avatar
0 votes
0 answers
46 views

How to Implement Complex Logic Conditions (AND, OR combinations) from JSON Request Body in Python?

I am working on a project where I have to evaluate multiple conditions/checks based on user input from a front-end interface. The user can create combinations of these clauses using logical operators ...
Abdullah's user avatar
-1 votes
1 answer
59 views

Confusion regarding precedence of C operators [duplicate]

I"m quite confused about the following block of code: int a = 1, b = 2, c = 3; printf("%d ", c - 3 && b++ > c); printf("%d %d %d", a, b, c); Initially, I thought ...
Anthony's user avatar
0 votes
0 answers
15 views

Basic JavaScript Query [duplicate]

let a = 10; let b = 500; let c = 50; if (a > b > c || a > c > b) { console.log("a is the largest number."); } else if (b > a > c || b > c > a) { console.log(&...
user20563982's user avatar
0 votes
2 answers
84 views

Define ternary inline operator in F#

I want to define an infix operator |>> which works like this: i |>> f1 f2 is the same as (f1 i, f2 i) i.e. it will apply an argument onto two functions and concatenate the results. Best ...
ChomskyEnjoyer's user avatar
1 vote
0 answers
47 views

Can we pass a basic operator "<" as a callable argument? [duplicate]

My low-level routine needs a argument, to specify it should compare data with LessThan(<) or GreatThan(>) operator. Like this: using CompOp_f = std::function<bool( double, double )>; ...
Leon's user avatar
  • 1,661
0 votes
3 answers
189 views

Is there a modulo operator for real variables in gnuplot?

So, gnuplot (I use 5.4 patchlevel 8) does not seem to support the modulo operator for real values: gnuplot> a = 5.0 % 2.0 non-integer operand for % Is there any workaround over this ...
coderodde's user avatar
  • 1,359
0 votes
0 answers
17 views

I can't find out how to get operators to work the way I want them to [duplicate]

I have a bit of code in an if statement that doesn't consistently work. I can't tell why. This is my code: CNSinsertG.CNlogo = true; CNskipG = true; a = CNSinsertG.CNlogo == true || CNSinsertG....
Nooofs1's user avatar
  • 25
0 votes
1 answer
26 views

show status of multiple fields with LIKE and OR

I'm trying to show the status of two variables in mysql $ sudo mysql -e "SHOW STATUS LIKE 'wsrep_local_state_comment' OR LIKE 'wsrep_cluster_size'" ERROR 1064 (42000) at line 1: You have an ...
SebMa's user avatar
  • 4,167
2 votes
1 answer
55 views

Perl numbers don't equal each other but appear the same when printed to STDOUT

I am reading in numbers from two different data files, and doing some basic math on them (adding them together to get a total for one file, and taking the absolute value for the other file). When I ...
Christopher Hayashida's user avatar
0 votes
2 answers
62 views

Convert string to C# Conditional operator [closed]

I'd like convert string to ConditionalOperator, few sample : "and" to && "or" to || "greatherthan" to >= "contains" to .Contains Something like ...
TheBoubou's user avatar
  • 19.6k
0 votes
1 answer
33 views

Find the diagonal of a linear operator in scipy

I have a function, A(x), that I have turned into a linear operator using scipy.sparse.linalg.LinearOperator: A_operator = scipy.sparse.linalg.LinearOperator((ny, nx), matvec=A). I have an Ax=b ...
lrisley's user avatar
0 votes
0 answers
45 views

Trimming outliers in the pandas dataframe, using logical operators >= and <=

I have a dataframe with 50+ (see an example with 2 only) data = { "Blood": [26, 48, 41, 80, 66, 40, 7, 73, 60, 61, 52, 76, 40, 53, 2, 9, 100, 59, 99, 82, 100, 82, 62, 73], "Urine": ...
Anakin Skywalker's user avatar
0 votes
4 answers
113 views

In C#, why does the 'is' operator behave like this in the following situations? [duplicate]

I have the following code in a .Net6 console application. internal class Program { static void Main(string[] args) { var x = new SomethingUser<Something>(); ...
AKJ's user avatar
  • 11
1 vote
1 answer
71 views

operator<< for enum class just doesn't work

I have the following code: logging.hxx #include <iostream> #include <string> #include <sstream> #include "singleton.hxx" #include "utils.hxx" class FGaugeLogger:...
TheEagle's user avatar
  • 5,840

1
2 3 4 5
157