numbers

Is it possible to predict if a mathematical operation would result in an overflow?

Say you have 2 numbers, for each typical mathematical operation is it possible to predict (without significant overhead) whether those operations would result in an overflow of the type which those numbers are currently represented as? ...

set app badge number by rows in table view with core data

Hi all, I'm developing an app that uses Core Data for save and retrieve data. Now I would like to add a badge number on app's icon in the home screen but I have some problems... I tried this code: NSInteger section = [self.tableView numberOfSections]; id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController se...

How to convert byte string into Number?

Hi all, I have a string encoded in Little Endian format (least-significant-byte first), and I want to decode it into a Number. For the encoder, the first bit of the last byte reflects whether the number is positive or negitive. Does anyone know how to do this? Here's my decoder: decode:function(str,type){ var num=0; va...

Convert css width string to regular number

While trying to compute the width of an hidden element I found that jquery.width() returns 0 for that elements' width. I found out that using jquery.css('width') would return the correct width by using the declared style width (even if that value is different from the initial stylesheet). The problem is that the css('width') method re...

Ruby: identify four-digit numbers and cut a text

so i'm dealing with a text (in string) containing many year numbers (four-digit), i'm trying to divide the text into segments each of which begins and ends with a year number (doesn't matter if the year number is included in the segment). basically year numbers just act like a signal for the code to 'cut'. any ideas how i can do that? h...

trunc the integer number from real number using matlab

please, any one help me to trunct the integer number from real number without any round to nearest integers in matlab ,e.g: if i have 255/64=3.98 I need just 3 not 4. I used fix in my program but not work. my cod is: S=imread('image0286.jpg')/64; disp(fix(S); this give me the output after rounds the elements of S to the nearest...

Regex which controls phone numbers

Hello, i'm new to regex, and i only need one statement. I want that my statement accepts these numbertyps: 06643823423 could be longer or 0664 3843455 or +43664 4356999 and it's important that these is only one statement. can anyone help me? thanks mike ...

How to avoid type conversion in flex from string to number ?

I am returning 12345678910111213171819 from java to flex, with in xml tags using http serivce. The result format is object. but when I display the text it automatically converted or treated as number so it displays like 1.234567891011121317181 x e^21 .... How to avoid this? Thanks in advance. Regards, Sankara narayanan Ekambaranathan....

How to represent tally/five-bar-gate in unicode?

Are there Unicode characters to represent bundles (and partial bundles) of 5 in the style of the tally/five-bar-gate? If not, what would be the most standard/semantic/accessible solution to this problem? Things I've tried but don't like: Using the numbers 1-5 - easily confusing (3 bundles of 5 looks like 555) 1-4 pipes with strike-th...

how to get the localized label of the phone types?

When changing the custom locale the label of the phone types change to the appropriate language. Does anybody know how to get the localized label of the phone types? I pick a contact in my app to get its phone number and if there is more then one number I use an AlertDialog to let the user select the currect one. In this pick list, I w...

Max file number can php upload at same time

Hello I am using the tag for uploading multiple files with php. I notice that if i choose more than 20 files php uploads only the first 20 files.Is there a way to expand this limit? ...

How do I choose a good magic number for my file format?

Hi, I am designing a binary file format from scratch, and I would like to include some magic bytes at the beginning so that it can be identified easily. How do I go about choosing which bytes? I am not aware of any central registry of magic numbers, so is it just a matter of picking something fairly random that isn't already identified ...

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...

What's a good way to filter data based on values that match the right of the decimal place?

Let's say I have the following data in a decimal (18,9) identity column in a database table: ID ======== 1000.00 1001.23 1002.00 1003.23 I want to write a SQL query that returns only those records that have .230000000 for the right side of the decimal place, such that only the following are returned: 1001.23 1003.23 I know I could ...

regex excel: how do i remove ALL numbers from a cell?

i cells that look like this: one per line: Duffy,John: 'Heritage: Civilization and the Jews'- Fanfare & Chorale,Symphonic Dances + Orchestral Suite. Bernstein,'On the Town' Dance Episodes. Royal Phil./R.Williams Lilien,Ignace 1897-1963: Songs,1920-1935. Anja van Wijk,mezzo & Frans van Ruth,piano Hindemith,Trauermusik. Purcell,'Fairy Que...

How do I validate a Medicare number?

I'm developing an online form in which user-entered Medicare numbers will need to be validated. (My specific problem concerns Australian Medicare numbers, but I'm happy for answers regarding American ones too. This question is about Medicare numbers in general.) So how should I do it? (It would be good to have the answer in Javascript...

how to convert numbers with comma inside from character to numeric in R?

I have some numbers with comma inside, like this: 1,200.00 R cannot convert this into numeric using as.numeric, I guess it is due to the comma, how can I fix it? Thanks! ...

PHP minimum precision on a number

I have a list of numbers coming from a database that range from 0.001 to 10 and I need to display them with a minimum precision of 2 decimal places but no maximum precision. Example numbers and expected conversion: 1 -> 1.00 0.1 -> 0.10 0.01 -> 0.01 0.001 -> 0.001 1.234 -> 1.234 0.035 -> 0.035 25.5 -> 25.50 Any Ideas? ...

Adjust Python Regex to not include a single digit in the findall results

I am trying to capture / extract numeric values from some strings. Here is a sample string: s='The shipping company had 93,999,888.5685 gallons of fuel on hand' I want to pull the 93,999,888.5685 value I have gotten my regex to this > mine=re.compile("(\d{1,3}([,\d{3}])*[.\d+]*)") However, when I do a findall I get the following...

JavaScript: remove insignificant trailing zeros from a number?

Have I missed a standard API call that removes trailing insignificant zeros from a number? Ex. var x = 1.234000 // to become 1.234; var y = 1.234001; // stays 1.234001 Number.toFixed() and Number.toPrecision() are not quite what I'm looking for. ...