FAQ Database Discussion Community


How to make my cheque generator output exactly what it is instead of “Zero” in C

c,compilation,generator,zero,money
My Cheque generator program has worked flawlessly for any input you give it to make it output the numerals in words. for example if I were to input "1234.56" it will out put "One Thousand Two Hundred Thirty Four Dollars and ... 56 Cents". However whenever I want to output...

c++ gives Segmentation Fault from text file of all 0's

c++,text,zero,fault
I'm writing a really simple code (or so I thought) that requires 2 text files to be read in. One is full of a bunch of data points (of type double) and the other one happens to be a bunch of 0's (this is only SOMETIMES filled with 0's, sometimes...

Why is '-' equal to 0 (zero) in SQL?

sql-server,tsql,zero,dash
When you run the following query in SQL Management studio the result will be 1. SELECT CASE WHEN '-' = 0 THEN 1 ELSE 0 END That scares me a bit, because I have to check for 0 value a numerous number of times and it seems it is vulnerable...

Numpy in what situation will return “Divide by zero error”?

python,numpy,zero,divide
I have an expression as below, where as data is a matrix and theta is a vector, python constantly raise divide by 0 error. But the only denominator is (1+e^x), every element in this matrix cannot be 0 anyway np.sum(-data[:,-1]*np.log(1.0/(1.0+np.exp(-np.dot(data[:,:-1],theta.transpose()))))) Is there any occasion I've ignored that will generate this...

Is MemoryMappedFile.CreateNew(…) guaranteed to create a file with zeroes?

c#,zero,memory-mapped-files
As the title says; Can I rely on MemoryMappedFile to always create a file full of zeroes? I've tested by reading some newly created files but this "testing" seems futile, altough I have yet to see a non-zero byte. Is there any documentation on this that I have missed, or...

Is it possible to differentiate between 0 and -0?

c++,int,zero,negative-number
I know that the integer values 0 and -0 are essentially the same. But, I am wondering if it is possible to differentiate between them. For example, how do I know if a variable was assigned -0? bool IsNegative(int num) { // How ? } int num = -0; int...

java convert string to int and remove trailing zeros

java,string,arraylist,int,zero
Hi everyone I am currently trying to convert a string to an arrayList in reverse and then remove any trailing zeros eg "001203" converts to (3,0.2,1,0,0) and then (3,0,2,1) my code is currently public convert(String nums) { List = new ArrayList<Integer>(); // create arraylist for (int i = nums.length(); i...

Ros Navigation Stack - Issue with zero and negative goal values

zero,turtle-graphics,ros,goal
I’m following the example of http://wiki.ros.org/navigation/Tutorials/SendingSimpleGoals with navigation stack. If I set the goal position with positive values the turtle moves as expected, but If it’s set to zero or negative values the turtle rotates in the same place, and It returns the message: “[ERROR] [1433622909.572352221]: Aborting because a valid...

0 not an [int] in PowerShell?

powershell,integer,zero
My understanding is that (mathematically) 0 is an Int. And yet if (0 -as [int]){"Int"}else{"Not"} returns Not, at least for me in PS 2.0. Is this a bug in v2, or am I misunderstanding things? I have worked around the issue by testing for -as [int] -and -ne 0, but...

How do I add a pipeline to a REQ-REP in ZeroMQ?

zeromq,zero
I am experimenting with ZeroMQ where I want to create a server that does : REQ-PIPELINE-REPLY I want to sequentially receives data query requests, push it through a inproc pipeline to parallelise the data query and the sink merges the data back. After the sink merges the data together, the...

MATLAB imagesc: Use black as mid-color for value 0

matlab,matlab-figure,zero,colormap
I want to use imagesc to plot a quantity where all of positive, negative, and close-to-zero values are important. I want the close-to-zeros to be black, but there is no default colormap that provides such a feature. For example, using colormap(hot) assigns black to the lowest (in this case: negative)...

with height in percentage has 0 height when inside table-cell in FF and IE

html,css,height,zero
I want two vertically stacked empty divs (to display background images) to share exactly 50% of the height of the parent container minus a fixed gap (e.g. 20px). I'm using calc() for this - as Opera Mini doesn't matter in my case. I got this working fine on all browsers:...

Pulling out specific column when sometimes, the array is empty

arrays,matlab,zero
I am trying to pull out a column from inside a cell. However, sometimes, the cell is empty. For example, if in this line, I try to pull out the last column inside PM25_win{i}, it sometimes has an array inside of size nx28. However, sometimes, the array is zero. for...

python 3.4 string manipulation - truncating leading zeros

python,string,python-3.x,zero,truncation
There are a number of existing posts on this topic, but I cannot get this simple piece of code to work correctly. I have tried many many times with no success... per = 5 if per < 10 == True: ms = 'fwd_%sd' % str(per).zfill(2) else: ms = 'fwd_%sd' %...

python fuction finding root( or zero) with minimum distance from real root epsilon

python,function,zero,epsilon
So its and exercises for python i am totally stuck! you have a random Function in [a,b] you already know that the a is negative and b is positive and it has only ONE root. The true root is : -0.94564927392359 and you have to make a def that will...

Displaying a zero

php,output,zero
I'm filling a template with some values being numbers, using str_replace. When a number is 0 (zero), PHP thinks it's false and write nothing. I tried every solution found on SO and the web : intval($myZeroVar) floatval($myZeroVar) strval($myZeroVar) (string)$myZeroVar ''.$myZeroVar random tests using number_format, sprintf, str_pad... NONE of these are...