Questions tagged [zero]

Zero is a unique number and along with 1 is one of the two binary numbers. Zero plays an important role in Mathematics and Computing. This Tag is for discussions of zero within various programming languages.

Zero is a unique number and along with 1 is one of the two binary numbers. Zero plays an important role in Mathematics and Computing. This Tag is for discussions of zero within various programming languages.

1060 questions
17
votes
2 answers

Not plotting 'zero' in matplotlib or change zero to None [Python]

I have the code below and I would like to convert all zero's in the data to None's (as I do not want to plot the data here in matplotlib). However, the code is notworking and 0. is still being printed sd_rel_track_sum=np.sum(sd_rel_track,…
Ashleigh Clayton
  • 1,443
  • 8
  • 23
  • 32
16
votes
2 answers

Exclude zero values from a ggplot barplot?

does anyone know if it is possible to exclude zero values from a barplot in ggplot? I have a dataset that contains proportions as follows: X5employf prop X5employff 1 increase 0.02272727 2 increase 0.59090909 1 3 …
marty_c
  • 5,779
  • 5
  • 24
  • 27
14
votes
3 answers

range countdown to zero

I am taking a beginner Python class and the instructor has asked us to countdown to zero without using recursion. I am trying to use a for loop and range to do so, but he says we must include the zero. I searched on the internet and on this…
Pashta
  • 143
  • 1
  • 1
  • 7
14
votes
3 answers

How can i detect if (float)0 == 0 or null in PHP

If variable value is 0 (float) it will pass all these tests: $test = round(0, 2); //$test=(float)0 if($test == null) echo "var is null"; if($test == 0) echo "var is 0"; if($test == false) echo "var is…
mrfazolka
  • 780
  • 1
  • 7
  • 24
14
votes
4 answers

Mysql count return Zero if no record found

I have a two tables. cities - id_city, city_name properties - id_property, id_city, property_name I want to display cities.city_name and next to it [properties.count(id_city)] How do I make a query that still returns zero if no records are found…
David King
  • 2,010
  • 5
  • 19
  • 23
14
votes
4 answers

How to retain leading zeros of int variables?

Below is a section of code which is part of a functional decryption and encryption program. while checkvar < maxvar: # is set to < as maxvar is 1 to high for the index of var #output.append("%02d" % number) i =ord(var[checkvar]) - 64 # Gets…
Dan1676
  • 1,685
  • 8
  • 24
  • 35
13
votes
2 answers

Extract contours from ContourPlot in Mathematica

I have a function f(x,y) of two variables, of which I need to know the location of the curves at which it crosses zero. ContourPlot does that very efficiently (that is: it uses clever multi-grid methods, not just a brute force fine-grained scan) but…
Kasper Peeters
  • 1,580
  • 2
  • 18
  • 37
13
votes
3 answers

Is comparing to zero faster than comparing to any other number?

Is if(!test) faster than if(test==-1) I can produce assembly but there is too much assembly produced and I can never locate the particulars I'm after. I was hoping someone just knows the answer. I would guess they are the same unless most CPU…
deanresin
  • 1,466
  • 2
  • 16
  • 31
13
votes
4 answers

How to create a Guid with all zero elements?

How to create a Guid that all of its elements are zero. i.e. {00000000-0000-0000-0000-000000000000}. I could use: Guid.Parse("{00000000-0000-0000-0000-000000000000}") But is there any easier method for that ?
Ehsan88
  • 3,569
  • 5
  • 29
  • 52
12
votes
8 answers

Can an MD5-hash begin with a zero?

Can an MD5-hash begin with a zero? What about SHA-1?
user217782
12
votes
2 answers

Gradle - Copying / Renaming file - making 0 file size / bytes for all files

I'm using Gradle build to compile Java. During the build, I get successful build deliverables BUT I want to add some extra files which are just the copy or rename of some files which exist within the built ".war" file by Gradle build. The following…
AKS
  • 16,482
  • 43
  • 166
  • 258
12
votes
8 answers

What is the difference between null, 0 and nothing?

What is the difference between null, 0 and nothing? I cannot find a question addressing all three of these. For example: If I am getting input from a string and parsing it to int. return Integer.parseInt(sc.nextLine()); Or if I am asking if a…
user3956566
12
votes
3 answers

How does ruby handle zero division?

I am trying to find out how ruby handles zero division. Ruby returns different results based on the class. This is what I tried 0/0 # => ZeroDivisionError: divided by 0 1/0 # => ZeroDivisionError: divided by 0 1.0/0 # =>…
ZX12R
  • 4,760
  • 8
  • 38
  • 53
11
votes
3 answers

Why doesn't Scala's BigDecimal have a ZERO?

It's easy enough to create: object zero extends BigDecimal(java.math.BigDecimal.ZERO) I'm just wondering whether this was an oversight, or if there was a conscious decision to not add this and, if so, are there reasons why I should avoid the code…
pr1001
  • 21,727
  • 17
  • 79
  • 125
11
votes
3 answers

MySQL monthly Sale of last 12 months including months with no Sale

SELECT DATE_FORMAT(date, "%b") AS month, SUM(total_price) as total FROM cart WHERE date <= NOW() and date >= Date_add(Now(),interval - 12 month) GROUP BY DATE_FORMAT(date, "%m-%Y") This query displaying result for only existing month. I need all 12…
Wasim A.
  • 9,660
  • 22
  • 90
  • 120