negative

OCaml: Matching with any negative

Is there a way to get pattern matching to match my value with any negative number? It does not matter what the negative number is I just need to match with any negative. I have accomplished what I want with this simple code: let y = if(n < 0) then 0 else n in match y with 0 -> [] | _ -> [x] @ clone x (n - 1) But I want to e...

Inverting image using the Python Image Library module

Good day chaps. I'm interested in learning how to invert (make a negative of) an image using the python image libary module. I cannot however, use the ImageOps function 'invert.' I need another solution, using the RGB values. I've searched and tried to no avail. Thanks for any help :) ...

Array construction and negative numbers

I was implementing a routing algorithm in javascript, but when I assign a negative one variable in the array gives me this error: invalid array length. var node = new Array() node[0] = new Array(6,7) node[1] = new Array(5,-4,8) node[2] = new Array(-2) //Here, invalid array length I do not know how to resolve this error. ...

How to efficiently compare the sign of two floating-point values while handling negative zeros

Given two floating-point numbers, I'm looking for an efficient way to check if they have the same sign, given that if any of the two values is zero (+0.0 or -0.0), they should be considered to have the same sign. For instance, SameSign(1.0, 2.0) should return true SameSign(-1.0, -2.0) should return true SameSign(-1.0, 2.0) should ret...

how to align floats in IE6

Good day! I am having problems displaying floated paragraphs and images in IE6. There was no problem displaying those in Opera and Firefox,though. I have three divs inside a container. Each div has its own paragraph and image either floated to the left or right. In order for me to achieve a desired layout, I set negative margins on mos...

How to read in a negative double with scanf() in C?

I'm learning basics of C and writing a simple first order equation solver. I want the input to be exactly ax+b=c or ax-b=c, where a, b, c are double type. I'm employing scanf() to read in user input and to check if it's of the correct form. However, if I enter a negative double, -4.6 say, as the "a" in the equation, scanf() won't read t...

SOLR date faceting and BC / BCE dates / negative date ranges

Date ranges including BC dates is this possible? I would like to return facets for all years between 11000 BCE (BC) and 9000 BCE (BC) using SOLR. A sample query might be with date ranges converted to ISO 8601: q=*:*&facet.date=myfield_earliestDate&facet.date.end=-92009-01-01T00:00:00&facet.date.gap=%2B1000YEAR&facet.date.other=all&fa...

C++: Unsigned negative primitives?

In C++ we can make primitives unsigned. But they are always positive. Is there also a way to make unsigned negative variables? I know the word unsigned means "without sign", so also not a minus (-) sign. But I think C++ must provide it. ...

Check if Integer is Positive or Negative - Objective C

Hello, How can I tell in objective-c coding if an integer is positive or negative. I'm doing this so that I can write an "if" statement stating that if this integer is positive then do this, and if its negative do this. Thanks, Kevin ...

negative selection SQL Query

I have been tasked with returning a negative selection from our sql database. I'll define the criteria as best i can. Thus far I haven't crafted a query that has worked. Business Table [Bus Name] [Bus ID] Activity Table [Activity ID] [Bus ID] Activity Extension Table [Ext ID] [Activity ID] [Bus ID] I need the Business names for a...

Why biasing towards negative numbers ?

If on my compiler, int is of 16 bits, then it's range is -32768 to 32767(in a 2's complement machine). I want to know why negative numbers have 1 extra no. i.e positive numbers go to 32767 but negative go to one more i.e.-32768. How -32768 is represented on a 2's complement m/c? ...

plotting negative numbers with flot / jquery

I know Im missing something retarded here... All Im trying to do is graph f(x) = 2500 for a range of x from -75 to 75. This should make a horizontal line. Right now, I think its a misunderstanding on my part of some specifics of arrays. It starts at 0 and goes to 75 fine, it does not graph lower than 0. (I get half the line) for(x = -75...

converting uiimage to negative colors 2nd time crashes the app

Hi! I want show an animation with a negative image and a normal image. To start, the getPhoto method is called and the user can get an image from library or take one with the camera. When the animation is running I want to be able to set the image to a new one, but then the app crashes. -(IBAction) getPhoto:(id) sender { UIImagePi...

Negative coordinates in pygame

What would be the best way to use negative coordinates in pygame? At the moment I have a surface that is 1.5 times the original surface then everything that needs to be drawn is shifted up by a certain amount (to ensure the negative coordinates become positive) and drawn. Is there an easier/alternate way of doing this? ...

string Format - how to change negative sign position

how my dear friends: I have a string.Format like this : string Test = string.Format("{0:#,0}", NegativeNumber); how can I change the negative sign position (Direction -> left or right)? thanks in future advance. ...

Negative array indexes in C?

I was just reading some code and found that the person was using arr[-2] to access the 2nd element before the arr, like so: |a|b|c|d|e|f|g| ^------------ arr[0] ^---------- arr[1] ^---------------- arr[-2] Is that allowed? I know that arr[x] is the same as *(arr + x). So arr[-2] is *(arr - 2), which seems ok. What ...

Parse negative numbers from string in perl

How do I parse a negative number from a string in perl? I have this piece of code: print 3 - int("-2"); It gives me 5, but I need to have 3. How do I do it? ...

Javascript negative number

I want to check if a number is negative. I'm searching for the easiest way, so a predefined javascript function would be the best but I didn't found yet anything, here is what I have so far but I don't think that this is a good way: function negative(number) { if (number.match(/^-\d+$/)) { return true; } e...

Random and negative numbers

Hello, I have to generate numbers in range [-100; +2000] in c++. How can I do this with rand if there is only positive numbers available? Are there any fast ways? ...