numbers

Parts per 100 return an integer

I'm looking for an algorithm to return the number of parts per 100. For example, if the part is between 1 to 100 then it return 1. If the part is between 101 to 200 then it should return 2. Final example, if the part is 357 it should return 4. A simple division will not work and tried modulo but cannot get it to give me the right answ...

Ada: attribute 'last and 'safe_large

Hi, it's very common in Ada to create a derived type say a new Float type with the last element being Float'Last. I have not yet seen someone using Float'Safe_Large instead of the attribute Float'Last when defining a new Float type. On my 32-bit machine, both Put( Float'Image( Float'Last )); and Put( Float'Image( Float'Safe_large ))...

Scaling Up a Number

How do I scale a number up to the nearest ten, hundred, thousand, etc... Ex. num = 11 round up to 20 num = 15 round up to 20 num = 115 round up to 200 num = 4334 round up to 5000 ...

how to check whether the given input field is String or not in java

hi i have a field called City , this should accepts only Characters but not special characters or numbers can any one help with regix logic thanks in advance thanks Sunny Mate ...

Why does Subversion/TortoiseSVN skip revision numbers if a file has only been changed one time?

I am fairly new to Subversion/TortoiseSVN and I want to know if there is a way to prevent Subversion from skipping revision numbers on files so that I can track the amount of time a file is changed based on it's revision number: Example: I have A.txt, B.txt, and C.txt Revision 1: (added the files to repository) A.txt :1 B.txt :1 ...

Algorithm to iterate through sample space of numbers

I hope this isn't a dupe, but it's hard to boil down the problem into keywords! This is always something that I've wondered about. Let's say you have a black box that takes n integers as an input (where n > 1). Given that there is a bounds on the integer values, how would you go about writing an algorithm that will push the entire sampl...

Javascript: Comparing two float values

I have this JavaScript function: Contrl.prototype.EvaluateStatement = function(acVal, cfVal) { var cv = parseFloat(cfVal).toFixed(2); var av = parseFloat(acVal).toFixed(2); if( av < cv) // do some thing } When i compare float numbers av=7.00 and cv=12.00 the result of 7.00<12.00 is false! Any ideas why? ...

what am I missing in this RegEx?

I'm trying to create a JavaScript Regex to test for: a valid # between 0 and 99.9 (where only a single decimal digit is allowed) e.g. 3.45 is not valid. so, blank is ok, any integer between 0 and 99 is ok, and a decimal value is allowed. I have this so far, but it is allowing values like 3.45 to pass: $^|$[0-9][0-9]?^|$[0-9][0-9]?.[0...

Solaris dev/random

Hallo, Which algorithm implements dev/random of Solaris? Is taht Yarrow-160 or Yarrow-256 or is the algorithm the same as in Linux? Is there documentation / link ? I have already looked a lot, but I couldn't find it. Thanks in advance. ...

International phone number max and min?

What is the max and min digits for an international telephone number? (country code + area code + phone number) ...

Comparing large numbers in php and sql

I need to compare a very large number in php (30 digits long) with 2 numbers in my database. Whats a good way to do this? I tried using floats but its not precise enough and I don't know of a good way to use large numbers in php. ...

How can I count in a different number base in C++?

My 15 year old little brother is starting out programming, and he wrote a neat little program that outputs all combination of letters and numbers that are six digits or less. His code was a sextuple-nested for loop that updated the elements of a six level char array. It looked bad, but was certainly fast! I showed him how to do a simp...

Android Number Picker Dialog

Does anyone have any dialogs that will allow a user to pick a number within a certain range? It seems like this would be a fairly common need, but I can't find a common dialog for it and I'd rather not have to spend the time creating my own. Any help? ...

Automatic three-level list numbering with Javascript? IE7 doesn't support CSS counters :(

Hey! The website I'm currently developing has a three-level menu and each item in the menu must have a number before the title: 1. and 1.1. and 1.1.1. for example. Currently I am using CSS to generate the numbers: #menu ol { counter-reset: item; } #menu li a { counter-increment: item; } #menu li a:before { content: coun...

Is there any General rule for converting between counting systems

If I have a number written in base X, how do I convet it to base Y, or the opposite. And if there is no general rule, is there a special rule for converting to and from decimal? ...

Is there anywhere a Java library available that supports exactly the format strings of Excel?

For a Java application that drags data together from some sources and does some calculation itself, we want to offer users the possibility to use their own format strings, and would prefer the format string syntax they know from Excel (e. g. "$ "#,###.,0) which happens to be the same used in .net and Analysis Services. The closest thing...

XSL QUESTION: alternative method to count the number of lines or newline characters of an xml attribute

I've scoured the internet to discover this method of finding the number of lines in an xml element.: <xsl:if test="string-length(@Example) - string-length(translate(@Example, '&#xa;', '')) &lt; 10"> In the example above, @Example is the element for which the number of lines is counted. I didn't like this code, however, because it aut...

php: number only hash?

In php is there a way to give a unique hash from a string, but that the hash was made up from numbers only? example: return md5(234); // returns 098f6bcd4621d373cade4e832627b4f6 but I need return numhash(234); // returns 00978902923102372190 (20 numbers only) the problem here is that I want the hashing to be short. edit: OK let ...

issues matching number in string with boost regex

I'm trying to determine whether or not a string contains a number. This doesn't seem to be working. static const regex re("([0-9]+)"); cout << regex_match("L5", re); prints 0 Thanks!! ...

Arithmetic Overflow

Why is it that an arithmetic overflow cannot occur when adding an positive and a negative number using two's complement. If you could please provide an example with 8-bit signed integers (bytes). ...