Why doesn't this division work in python?
>>> numerator = 29 >>> denom = 1009 >>> print str(float(numerator/denom)) 0.0 I just want it to return a decimal... ...
>>> numerator = 29 >>> denom = 1009 >>> print str(float(numerator/denom)) 0.0 I just want it to return a decimal... ...
I have a value in a report that is returned as a number for example 1 - What i am trying to do is whenever 1 is displayed in the report i want it to show text such as Program Live. I am using crystal 9, any help would be appreciated. ...
Let's say I need to save a matrix(each line corresponds one row) that could be loaded from fortran later. What method should I prefer? Is converting everything to string is the only one approach? ...
When I pass in 2009 as a arg to this shell function it returns 0, why? isyear() { case $arg in [0-9][0-9][0-9][0-9]) NUM=1 ;; *) NUM=0 ;; esac echo $arg } ...
This is a table design issue. I have a table that stores IP addresses. The data in the table is queried very heavily. The IPs can have different flags such as "unblocked", "temporarily blocked" and "permanently blocked". 95% - 99% of the IP addresses do not have any type of block on them. Is there a way to limit the # of rows in t...
I'd like to color numbers in a table for better readability: green for positive (+00.00); red for negative (-00.00) and; black for default case (no sign) Many thanks! ...
Hi, Im having trouble matching the format of a string, the format is that of the .srt timing which is "00:00:01,000 --> 00:00:04,000", hour,minutes,seconds,mili seconds. how do I match this in a string? Im trying to add and subtract the time here. ...
What's the shortest regex that can match non-zero floating point numbers with any number of decimal places? It should accept numbers like -1 -5.9652 -7.00002 -0.8 -0.0500 -0.58000 0.01 0.000005 0.9900 5 7.5 7.005 but reject constructions such as . .02 -. -.996 0 -0 0. -0. -0.000 0.00 -- .. + +0 +1 +. +1.26 ,etc I do not need suppo...
Hi, I want to get the BIOS Build number and Identification number. I am already using WMI class Win32_Bios dataclass but I it is not returing the value for Build number and Identification number on any of the windows OS. can any one let me know how should I go to get the above fileds mentioned for bios? ...
Are there any Python libraries that help parse and validate numeric strings beyond what is supported by the built-in float() function? For example, in addition to simple numbers (1234.56) and scientific notation (3.2e15), I would like to be able to parse formats like: Numbers with commas: 2,147,483,647 Named large numbers: 5.5 billion ...
I need to get two factors ( x, y ) of a given number ( n ) such that: x * y <= n x * y should be as close to n as possible x and y should be as close to each other as possible. Examples: n = 16 => x = 4, y = 4 n = 17 => x = 4, y = 4 n = 18 => x = 6, y = 3 n = 20 => x = 5, y = 4 Any language will do but preferably php. EDIT -- CL...
Hi, Im not sure what this type of number is '1.3122278540256E+18' but how can i expand it into an integer? Thanks!! ...
I have a bunch of strings I need to extract numbers from. They're in the format: XXXX001 XXXXXXX004 XX0234X There's a lot of these, and i need to loop over them all and extract all the numbers. So what's the quickest/most efficient way, using ASP.NET 3.5, to find the first instance of a number within a string? Update I should've inc...
The problem seems simple at first: just assign an id and represent that in binary. The issue arises because the user is capable of changing as many 0 bits to a 1 bit. To clarify, the hash could go from 0011 to 0111 or 1111 but never 1010. Each bit has an equal chance of being changed and is independent of other changes. What would you...
Hi I am trying to generate random numbers in MATLAB with a random MEAN value. For example, if I use e = mean(rand(1000,1)) the answer for e will always be close to 0.5. What I want is for the value of e (mean) to be random, so that e can be 0.1, 0.2, 0.3, etc... Is it correct for me to use e = mean( unifrnd(0,1,[1000,1]) ) ? Thanks...
Hopefully something less newbish than my last... Anyhow, I am doing a bit of coding on a small app that simplifies numbers down to primes, mainly to help with small things like homework. However, a particular method is giving me the error mentioned in the title: def get_simps(num) curr = 2 print("Working...") while (curr <...
Basically I have to use a random function that can return a number between 0 and 2^16-1. I am trying to make use of this and generate let's say, 6 intervals between 1 and 6 (thinking of dice poker). Basically use that one number that is randomly generated for me (I can specify range only) and preferably only have to call it once. Then t...
This is in reference to the comments in this question: This code in Java produces 12.100000000000001 and this is using 64-bit doubles which can present 12.1 exactly. – Pyrolistical Is this true? I felt that since a floating point number is represented as a sum of powers of two, you cannot represent 12.1 exactly, no matter how many...
I need to validate serial numbers. For this we use regular expressions in C#, and a certain product, part of the serial number is the "seconds since midnight". There are 86400 seconds in a day, but how can I validate it as a 5-digit number in this string?: 654984051-86400-231324 I can't use this concept: [0-8][0-6][0-4][0-0][0-0] ...
Number n = new Number(5) is illegal, but Number n = 5 isn't. Why? ...