Questions tagged [negate]
84 questions
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
- 146,324
- 131
- 460
- 740
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
- 965
- 6
- 15
- 36
0
votes
1 answer
Verilog HDL Negate Monitor Variable
I am teaching myself Verilog HDL as of today and attempting to understand. I am trying to display the opposite/negation of a variable in bit form that is passing through a logic diagram example.
module My_Implementation();
reg A,B,C,D;
wire…

Lakeside
- 35
- 1
- 4
0
votes
1 answer
Java - Negate a polynomial
I am trying to negate a polynomial expression so that the following tests are correct with my polynomial expressions being defined as Term(coefficient, exponent). So my public Term negate() throws Overflow method passes these tests.
Term(min,2) ->…

germainelol
- 3,231
- 15
- 46
- 82
0
votes
0 answers
Selective listing (ls) of files
I have a list of files like:
(in general, it's of the format /data/logs/var_YYYYMMDDHHMMSS.log)
/data/logs/var_20121002103531.log
/data/logs/var_20121002104215.log
/data/logs/var_20121002120001.log
I've tried in vain to list all the files which DO…
0
votes
1 answer
Return bit-level equivalent of expression -f for floating point argument f
This is a homework question and I'm completely out of ideas (C programming).
Instructions:
/*
* float_neg - Return bit-level equivalent of expression -f for
* floating point argument f.
* Both the argument and result are passed as unsigned…

Mappan
- 2,537
- 2
- 22
- 27
-1
votes
1 answer
Why ~1 returns -2 rather than 0 in Java?
I'm trying to negate(a.k.a invert) all bits of given int.
Lets say the given number's(given number is 5) binary representation is 101, and its negation (my output) should be 010.
I'm using ~ for each and every bit from least significant bit to most…

sofs1
- 3,834
- 11
- 51
- 89
-2
votes
1 answer
RegEx to not to contain "--"
I want to validate a string with alpha numeric values, but if the string contains -- (double dash) anywhere in the string, it should be…

Sandun Perera
- 541
- 6
- 21