Questions tagged [negate]

81 questions
0
votes
2 answers

How to replace values in df that are NOT fulfilling condition

I am trying to clean my data and can't find a way to replace values that are not according to my conditions like in the following example: df1<- data.frame( A=c("a","b","c"), Ch=c("c1","xyz","c2"), val=paste0("x",1:3), stringsAsFactors =…
antonina
  • 99
  • 7
0
votes
1 answer

Assembly negation in msp430

I have the following versions of negating some integer value (in R12) in assembly in msp430 : inv R12 inc R12 this is according to the manual and I think this will work the same? inv R12 add #1, R12 But will this work and why not? : sub #1,…
0
votes
0 answers

Scheme altering tree values

I receive a tree and suppose to output the same tree with the values negated: 1 becomes -1, -2 becomes 2, #t becomes #f and the opposite way. The tree is flexible - each can have multiple sons, one or none. I'm not allowed to add user-defined helper…
Adam Morad
  • 149
  • 1
  • 7
0
votes
0 answers

How to use negate function with balanced ternary numbers?

I've been trying to convert balanced ternary numbers through the negate function in python def convert_to_balanced_ternary(n): if n == 0: return '0' negative = n < 0 bt = '' while n > 0: r = n % 3 if r == 0: bt = '0' + bt …
Mr Mister
  • 1
  • 1
0
votes
1 answer

Regex to remove all except XML

I need help with a Regex for notepad++ to match all but XML The regex I'm using: (!?\<.*\>) <-- I want the opposite of this (in first three lines) The example code: [20173003] This text is what I want to delete…
ScaZ
  • 39
  • 6
0
votes
1 answer

bitwise negate and bitwise XOR 1 not equivalent?

My discrete math tells me that negate every bit of a binary number is equivalent to XOR it with 1. That is: ~1010 === 0101 1010 XOR 111 = 0101 But this doesn't hold in javascript: ~123 === -124 123 ^ 1 === 122 Why?
Boyang
  • 2,322
  • 5
  • 22
  • 47
0
votes
2 answers

Automating process to multiply values in tab delimited file by -1 to negate them

I've been manually processing a large amount of files in Excel. I've done some searching but haven't found a definitive best practice as to how I can achieve this process in an automated fashion. My manual process is as follows: I have a .tab…
0
votes
4 answers

Is there a difference between -x vs x * -1.0f?

In java, is there a difference between negating a variable vs multiplying a variable by a float minus one, if the variable is also a float?
Marek Krzeminski
  • 904
  • 11
  • 27
0
votes
2 answers

Turn on leftmost bit of a Short

Original question changed. I want to bitwise turn off the left most bit of a Short value (&H8000) and leave the other bits as they are. Dim x = BitConverter.GetBytes(Short.MaxValue Or &H8000) Dim z = BitConverter.ToInt16(x, 0) Isn't there any…
Shimmy Weitzhandler
  • 92,920
  • 119
  • 388
  • 596
0
votes
2 answers

Python text search library

I am looking for a library that would let me do something like the following: matches( user_input="hello world how are you what are you doing", keywords='+world -tigers "how are" -"bye bye"' ) Basically I want it to match strings based on…
ipartola
  • 1,502
  • 3
  • 13
  • 25
0
votes
1 answer

Regex and jquery validate. Negate expression

I'm working on a addition method for the jquery validate plugin which must detect if 3 or more consecutive identical characters are entered, and prompt a message. To do so I need to negate a regex expression. This is my…
Adorablepolak
  • 137
  • 3
  • 15
0
votes
1 answer

In Ruby, how to implement "20 - point" and "point - 20" using coerce()?

In Ruby, the operation of point - 20 # treating it as point - (20,20) 20 - point # treating it as (20,20) - point are to be implemented. But the following code: class Point attr_accessor :x, :y def initialize(x,y) @x, @y = x, y …
nonopolarity
  • 130,775
  • 117
  • 415
  • 675
0
votes
2 answers

Negating Regular Expression for Price

I have a regular expression for matching price where decimals are optional like so, /[0-9]+(\.[0-9]{1,2})?/ Now what I would like to do is get the inverse of the expression, but having trouble doing so. I came up with something simple…
LJS
  • 33
  • 4
0
votes
3 answers

Negate regular expression in Perl

I am splitting a text file into blocks in order to extract those blocks which do not contain a certain line by using a regular expression. The text file looks like this: [Term] id: id1 name: name1 xref: type1:aab xref: type2:cdc [Term] …
atreju
  • 787
  • 4
  • 13
  • 29
0
votes
5 answers

How to negate regex validation string?

I want to replace all the string except the @[anyword] I have string like this: yng nnti dkasih tau :)"@mazayalinda: Yg klo ada cenel busana muslim aku mau ikutan dong "@noviwahyu10: Model ! Pasti gk blh klo k and the @mazayalinda and @noviwahyu10…
nencor
  • 1,451
  • 2
  • 12
  • 15