Search Results

Search found 6055 results on 243 pages for 'cyclic numbers'.

Page 26/243 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Why does does my stack overflow error occur after 518669 specifically?

    - by David
    I created a java program to count up toward infinity: class up { public static void up (int n) { System.out.println (n) ; up (n+1) ; } public static void main (String[] arg) { up (1) ; } } i didn't actually expect it to get there but the thing that i noticed that was a bit curious was that it stopped at the same number each time: 518669 what is the significance of this number? (or of this number +1 i suppose). (also as a bit of an aside question, I've been told that the way i format my code is bad [indentation and such] what am i doing that isn't desirable?)

    Read the article

  • how IEEE-754 floating point numbers work

    - by hatorade
    Let's say I have this: float i = 1.5 in binary, this float is represented as: 0 01111111 10000000000000000000000 I broke up the binary to represent the 'signed', 'exponent' and 'fraction' chunks. What I don't understand is how this represents 1.5. The exponent is 0 once you subtract the bias (127 - 127), and the fraction part with the implicit leading one is 1.1. How does 1.1 scaled by nothing = 1.5???

    Read the article

  • Division, Remainders and only Real Numbers Allowed

    - by Senica Gonzalez
    Trying to figure out this pseudo code. The following is assumed.... I can only use unsigned and signed integers (or long). Division returns a real number with no remainder. MOD returns a real number. Fractions and decimals are not handled. INT I = 41828; INT C = 15; INT D = 0; D = (I / 65535) * C; How would you handle a fraction (or decimal value) in this situation? Is there a way to use negative value to represent the remainder? In this example I/65535 should be 0.638, however, with the limitations, I get 0 with a MOD of 638. How can I then multiply by C to get the correct answer? Hope that makes sense.

    Read the article

  • How to disable Excel's auto recognition of numbers and text

    - by Yin Zhu
    I used Python to generate a CSV file. But when I open it in Excel, Excel will auto recognize a string into a number if it could be converted. e.g.33E105, which is actually an ID, not a number. How to disable this in Excel while opening a CSV file? Or I need to resort to a excel-python library to output a excel file and specify the format myself? Thanks!

    Read the article

  • Encode complex number as RGB pixel

    - by Vi
    How is it better to encode a complex number into RGB pixel and vice versa? Probably (logarithm of) an absolute value goes to brightness and an argument goes to hue. Desaturated pixes should receive randomized argument in reverse transformation. Something like: 0 - (0,0,0) 1 - (255,0,0) -1 - (0,255,255) 0.5 - (128,0,0) i - (255,255,0) -i - (255,0,255) (0,0,0) - 0 (255,255,255) - e^(i * random) (128,128,128) - 0.5 * e^(i *random) (0,128,128) - -0.5 Are there ready-made formulas for that?

    Read the article

  • PHP crc32() only numbers

    - by B11002
    I have a MD5 hash: 10f86782177490f2ac970b8dc4c51014 http://www.fileformat.info/tool/hash.htm?text=10f86782177490f2ac970b8dc4c51014 Result: c74e16d9 but PHP: crc32('10f86782177490f2ac970b8dc4c51014'); Result: -951183655 I don't understand!

    Read the article

  • converting numbers to different barcodes

    - by Sten
    i have a .txt file that holds a number of various number inside in a list e.g 0000 1111 2222 3333 4444 i am going a package called libdmtx to convert this to barcodes except i can only create one barcode at a time but instead i want to create 5. Can anyone advise me? Thanks

    Read the article

  • range of line numbers in if condition C programming

    - by nour
    Hello, I'm working on a simple C prorgam, and i'ms tuck with an if test: int line_number = 0; if ((line_number >= argv[2]) && (line_number <= argv[4]) ) gcc says: cp.c:25: warning: comparison between pointer and integer cp.c:25: warning: comparison between pointer and integer What can I do to properly write the range of line I want to deal with ? Thank you!

    Read the article

  • Convert a string of numbers to a NSTimeInterval

    - by culov
    I know I must be over-complicating this because it NSTimeInterval is just a double, but I just can't seem to get this done properly since I have had very little exposure to objective c. the scenario is as follows: The data im pulling into the app contains two values, startTime and endTime, which are the epoch times in milliseconds. The variables that I want to hold these values are NSTimeInterval *start; NSTimeInterval *end; I decided to store them as NSTimeIntervals but im thinking that maybe i ought to store them as doubles because theres no need for NSTimeIntervals since comparisons can just be done with a primitive. Either way, I'd like to know what I'm missing in the following step, where I try to convert from string to NSTimeInterval: tempString = [truckArray objectAtIndex:2]; tempDouble = [tempString doubleValue]; Now it's safely stored as a double, but I can't get the value into an NSTimeInterval. How should this be accomplished? Thanks

    Read the article

  • Convert scientific notation to decimal notation

    - by Ankur
    There is a similar question on SO which suggests using NumberFormat which is what I have done. I am using the parse() method of NumberFormat. public static void main(String[] args) throws ParseException{ DecToTime dtt = new DecToTime(); dtt.decToTime("1.930000000000E+02"); } public void decToTime(String angle) throws ParseException{ DecimalFormat dform = new DecimalFormat(); //ParsePosition pp = new ParsePosition(13); Number angleAsNumber = dform.parse(angle); System.out.println(angleAsNumber); } The result I get is 1.93 I didn't really expect this to work because 1.930000000000E+02 is a pretty unusual looking number, do I have to do some string parsing first to remove the zeros? Or is there a quick and elegant way?

    Read the article

  • RegEx, Php, Preg_match, Phone numbers, Oh my!

    - by Kirk
    How do I find phone number of the following format and store them to a variable. It needs to match 3334445555, 333.444.5555, 333-444-5555, 333 444 5555, (333) 444 5555 and all combinations thereof. Here is the frame of it $regex = expression; if (preg_match ('/$regex/', matches)) { $phone = matches[1]; }

    Read the article

  • A solid nickname regexp

    - by iBram
    I want a regular expression to validate a nickname: 6 to 36 characters, it should contain at least one letter. Other allowed characters: 0-9 and underscores. This is what I have now: if(!preg_match('/^.*(?=\d{0,})(?=[a-zA-Z]{1,})(?=[a-zA-Z0-9_]{6,36}).*$/i', $value)){ echo 'bad'; } else{ echo 'good'; } This seems to work, but when a validate this strings for example: 11111111111a is not valid, but it should aaaaaaa!aaaa is valid, but it shouldn't Any ideas to make this regexp better?

    Read the article

  • "Nearly divisible"

    - by bobobobo
    I want to check if a floating point value is "nearly" a multiple of 32. E.g. 64.1 is "nearly" divisible by 32, and so is 63.9. Right now I'm doing this: #define NEARLY_DIVISIBLE 0.1f float offset = fmodf( val, 32.0f ) ; if( offset < NEARLY_DIVISIBLE ) { // its near from above } // if it was 63.9, then the remainder would be large, so add some then and check again else if( fmodf( val + 2*NEARLY_DIVISIBLE, 32.0f ) < NEARLY_DIVISIBLE ) { // its near from below } Got a better way to do this?

    Read the article

  • C++ question on prime numbers.

    - by user278330
    Hello. I am trying to make a program that determines if the number is prime or composite. I have gotten thus far. Could you give me any ideas so that it will work? All primes will , however, because composites have values that are both r0 and r==0, they will always be classified as prime. How can I fix this? int main() { int pNumber, limit, x, r; limit = 0; x = 2; cout << "Please enter any positive integer: " ; cin >> pNumber; if (pNumber < 0) { cout << "Invalid. Negative Number. " << endl; return 0; } else if (pNumber == 0) { cout << "Invalid. Zero has an infinite number of divisors, and therefore neither composite nor prime." << endl; return 0; } else if (pNumber == 1) { cout << "Valid. However, one is neither prime nor composite" << endl; return 0; } else { while (limit < pNumber) { r = pNumber % x; x++; limit++; } if (r == 0) cout << "Your number is composite" << endl; else cout << "Your number is prime" << endl; } return 0; }

    Read the article

  • C++ question on prime numbers.

    - by user278330
    Hello. I am trying to make a program that determines if the number is prime or composite. I have gotten thus far. Could you give me any ideas so that it will work? All primes will , however, because composites have values that are both r0 and r==0, they will always be classified as prime. How can I fix this? int main() { int pNumber, limit, x, r; limit = 0; x = 2; cout << "Please enter any positive integer: " ; cin >> pNumber; if (pNumber < 0) { cout << "Invalid. Negative Number. " << endl; return 0; } else if (pNumber == 0) { cout << "Invalid. Zero has an infinite number of divisors, and therefore neither composite nor prime." << endl; return 0; } else if (pNumber == 1) { cout << "Valid. However, one is neither prime nor composite" << endl; return 0; } else { while (limit < pNumber) { r = pNumber % x; x++; limit++; } if (r == 0) cout << "Your number is composite" << endl; else cout << "Your number is prime" << endl; } return 0; }

    Read the article

  • Getting consecutive version numbers from Hibernate's @Version usage once per transaction

    - by Cheradenine
    We use Hibernate with the following version definition for optimistic locking et. al: <version name="version" access="field" column="VERSION" type="long" unsaved-value="negative"/> This is fine and dandy; however, there is one small problem, which is that the first version for some entities is '0', and for others, it is '1'. Why this is happening, is that for some object graphs, an entity will be subject to both onSave and flushDirty - this is reasonable, such as if two object are circular dependencies. However, the version number gets incremented on both occasions, leading to the above '0' / '1' discrepancy. I'd really like the version number only to ever increment once per transaction. However, I can't see a simple way to do this in the hibernate versioning implementation, without hacking about with an Interceptor (which was how I generated a column value for version before, but I wanted hibernate to do it itself)..

    Read the article

  • HOW TO SElect line number in TextBox Multiline

    - by Alhambra Eidos
    Hi all, I have large text in System.Windows.Forms.TextBox control in my form (winforms), vs 2008. I want find a text, and select the line number where I've found that text. Sample, I have fat big text, and I find "ERROR en línea", and I want select the line number in textbox multiline. string textoLogDeFuenteSQL = @"SQL*Plus: Release 10.1.0.4.2 - Production on Mar Jun 1 14:35:43 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. ** MORE TEXT **** Conectado a: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, Data Mining and Real Application Testing options WHERE LAVECODIGO = 'CO_PREANUL' * ERROR en línea 2: ORA-00904: ""LAVECODIGO"": identificador no v?lido INSERT INTO COM_CODIGOS * ERROR en línea 1: ORA-00001: restricción única (XACO.INX_COM_CODIGOS_PK) violada"; ** MORE TEXT **** Any sample code about it ? thanks in advanced,

    Read the article

  • Tracing spoofed mobile phone numbers

    - by RaDeuX
    I am being harassed by some prank caller that is spoofing his/her number neither T-Mobile nor the police can do anything about it. I have been told from one of my friends that if I set up an Asterisk server, I can accomplish the tracing of the prank caller. I am hardly knowledgeable in terms of networking, so a lot of what they told me was filled with jargon I couldn't really understand. But first things first, I downloaded Asterisk 1.5.0 and was finally able to install it (had issues with partitioning... In the end I just had Asterisk hog the entire HDD space). I tried out Asterisk, and it was slightly complicated for me so I decided to install trixbox 2.8.0.4 instead. It looks very similar to Asterisk... I'm not entirely sure what to do from here. I know I have to get the server up and running, but do I need a PBX card or something to accomplish what I'm trying to do? I'm running trixbox on a laptop to minimize electricity usage. Also, will I have to open any ports for the server? I have limited administrative permissions because of my father who is very uncomfortable with opening ports.

    Read the article

  • Create WPF TextBox that accepts only numbers

    - by Elad
    I would like to create a TextBox that only accepts numeric values, in a specific range. What is the best way to implement such TextBox? I thought about deriving TextBox and to override the validation and coercion of the TextProperty. However, I am not sure how to do this, and I understand that deriving WPF control is generally not recommended. Edit: What I needed was a very basic textbox that filters out all key presses which are not digits. The easiest way to achieve it is to handle the TextBox.PreviewTextInput event: private void textBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { int result; if (!validateStringAsNumber(e.Text,out result,false)) { e.Handled = true; } } (validateStringAsNumber is my function that primarily use Int.TryParse) Some of the suggested solutions are probably better, but for the simple functionality I needed this solution is the easiest and quickest to implement while sufficient for my needs.

    Read the article

  • Sorting List which has object that contains two string members that contains numbers

    - by Lemo
    I want to know the best solution for this my case here is that i am taking values from Excel sheet and pushing them to database field, sometimes that field might contain some strings (thats why I cant make my object members int / double) In my class below size is the variable responsible for showing size of files in bytes public class dataNameValue { public string Name { get; set; } public string Count { get; set; } public string Size { get; set; } } I wanted to sort the list by file Size something like List mylist = new List(); mylist = mylist.OrderByDescending(i = i.Size).ToList(); The problem is that if i sorted it without converting it to "int/double" first -- its not giving right results

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >