I encountered a weird behaviour in Perl. The following subtraction should yield zero as result (which it does in Python):
print 7.6178E-01 - 0.76178
-1.11022302462516e-16
Why does it occur and how to avoid it?
P.S. Effect appears on "v5.10.0 built for x86_64-linux-gnu-thread-multi" (Ubuntu 9.04) and "v5.8.9 built for darwin-2level" (...
Can anyone tell me how to compare large numbers in javascript?
Something like
var sla = 1263293940000;
var resp = 1263296389700;
if(sla > resp)
{
//do something
}
...
I have an Int that i want to split into it's individual numbers which ideally would be contained in a list, which i can then process further. So i would like something like this:
split 245
--will then get an list containing [2,4,5]
Is anyone familiar with such a function?
...
LATER EDIT : It was me :( It was a non-nullable column left unfilled. Sorry to everyone I confused..
I am having issues with an INSERT statement generated by NHibernate because it formats the decimal numbers using the regional settings. The generated statement goes something like :
exec sp_executesql N'INSERT INTO [TableName] (
Co...
I often work in command line mysql. A common need is to take a query's results and import them into a Numbers document (similar to an Excel document).
What is the fastest method for doing this?
Method 1: Select into outfile
You can select into an outfile directly from MySQL, but this takes several steps.
export your query with all ...
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell how many have been...
Why 'exactly' does this code loop endlessly if you enter a non number character?
The first question comes about because I want to learn good defensive coding. Does anyone know a good way to check user input? My google-fu failed me. Some people seemed to be of the opinion that if I specify %f in scanf that I am 'demanding' a float; I ver...
I have database records in the form of 10 character long strings, such as 4085551234.
I wish to format these into this format: (408) 555-1234.
I think this is regex related. I'm new to programming and completely self-taught here, so any sort of resource relating to performing text processing would be appreciated as well. Thanks!
...
I have 15,000 numbers ranging between 1000-8000. Each number is assigned to one of six categories and subcategories, in some cases there are overlaps. Sample data:
value cat1 cat2
2333 WHITE A
2334 ORANGE B
2335 ORANGE A
2335 WHITE B
2336 ORANGE A
2336 WHITE B
2336 RED C
2337 RED A
2338 RED A
2...
If two drives in a system - How to get Hard Disk Number? How to get in order (primary & secondary).
...
hi,
I have a very small number and I want to convert it to a String with the full number, not abbreviated in any way. I don't know how small this number can be.
for example, when I run:
double d = 1E-10;
System.out.println(d);
it shows 1.0E-10 instead of 0.000000001.
I've already tried NumberFormat.getNumberInstance() but it format...
I have a program that sometimes is used in locales that use commas for the decimal separator. Its nice how C# handles all that (good for the UI), but when I export to a file, I need to always use a ".", not the locale specific number. Currently, I do:
String.Format("{0:0.####},{1:0.####}", x, y)
Problem is that in some locales, that ...
I am very new to Java Me (first time). I want my program to ask the user for an IP addres. So four numbers that are between 0 and 255. It doesn't need to be difficult, but as I said, I'm new to Java Me.
...
I have a bunch of numbers represented as hexadecimal strings in logfiles that are being parsed by a Perl script, and I'm relatively inexperienced with Perl. Some of these numbers are actually signed negative numbers, ie 0xFFFE == -1 when represented as a 16-bit signed integer. Can somebody please tell me the canonical way of getting the...
Hay, i have a string like this:
v8gn5.8gnr4nggb58gng.g95h58g.n48fn49t.t8t8t57
I want to strip out all the characters leaving just numbers (and .s)
Any ideas how to do this? Is there a function prebuilt?
thanks
...
How can i get the number of rows like mysql_num_rows but without having a mysql resource to work from, because i don't know the future scale of my webapp and it could take an hour just to get the number of rows ;)
thanks!
...
Is there any program that will generate a compliant plist XML structure from a spreadsheet where the first column is the key (for the plist dictionary) and the value is a dictionary made up of the subsequent columns.
...
I'm trying to write a program in C# that takes in an int x and decides if it has exactly 7 digits. Right now I'm using x.toString().Length == 7 to check, but I noticed that if the number starts with 0, it automatically gets omitted and I get an incorrect answer (ie the program thinks the input length is less than 7)
Is there a way to fi...
Looking on SO, I see that the preferred way to currency using RoR is using decimal(8,2) and to output them using number_to_currency();
I can get my numbers out of the DB, but I'm having issues on getting them in.
Inside my update action I have the following line:
if @non_labor_expense.update_attributes(params[:non_labor_expense])
pu...
Does .NET have a constant for the number of seconds in a day (86400)?
...