Search Results

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

Page 2/243 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • how to display numbers without garbage numbers?

    - by Medeti Naveen Kumar
    Hi friends, whenever i press the numbers in text filed upto 9 numbers my textfield has taken right values but i press 10 th number.i have found duplicate number. in my header file i declare a pressnumber is "long long int" -(IBAction)press:(id)sender{ pressNumber = pressNumber*10 + (int)[sender tag]; phonenumber.text = [NSString stringWithFormat:@"%d",currentNumber]; } i want to enter a phone number in my textfiled but it is not taken 10 right numbers. Thanking you,

    Read the article

  • Eidetic memory: What magic numbers you still remember?

    - by Hao
    Long before you practice writing readable code, what "magic numbers" you still remember up to this day? here's some of my list: 72 80 75 77 13 32 27 - up down left right enter space escape 1 2 4 128 - blue green red blink 67h 33h 17h - interrupt for EMS, mouse, printer function AH 9, interrupt 21 alt+219 for block ASCII alt+164 ñ 90 NOP 13 10 carriage return, line feed ascii 1 and 2 face, ascii 3 heart. no not this heart: <3 :-) debug -o72,10 -o71,12 clears the BIOS password. I don't know what those numbers mean, it's like a trade secret that gets shared with each other during college days. ascii 7 sounds a beep P.S. Somehow, remembering some of these magic numbers can help you in some tech problems, your keyboard is broken, the office pal's keyboard doesn't have accented characters. An anecdote, during college, one of my friend asked me how to remove the newlines in his Word document. Not having used Word so much then, I somehow "intuitively" guessed to find ^013 and replace it with blank. Well it works :-)

    Read the article

  • Why don't computers store decimal numbers as a second whole number?

    - by SomeKittens
    Computers have trouble storing fractional numbers where the denominator is something other than a solution to 2^x. This is because the first digit after the decimal is worth 1/2, the second 1/4 (or 1/(2^1) and 1/(2^2)) etc. Why deal with all sorts of rounding errors when the computer could have just stored the decimal part of the number as another whole number (which is therefore accurate?) The only thing I can think of is dealing with repeating decimals (in base 10), but there could have been an edge solution to that (like we currently have with infinity).

    Read the article

  • letters or numbers only in a password with jquery

    - by Greg
    Hi, I found this code for alphanumeric check ("Letters, numbers, spaces or underscores") but I want to change so I will be able to write only letters or numbers. Can anyone tell me how to change this code: function(value, element) { return this.optional(element) || /^\w+$/i.test(value);} Thanks! Greg

    Read the article

  • Big numbers in C

    - by teehoo
    I need help working with very big numbers. According to Windows calc, the exponent 174^55 = 1.6990597648061509725749329578093e+123. How would I store this using C (c99 standard). int main(){ long long int x = 174^55; //result is 153 printf("%lld\n", x); } For those curious, it is for a school project where we are implementing the RSA cryptographic algorithm, which deals with exponentiating large numbers with large powers for encryption/decryption.

    Read the article

  • Problem in displaying numbers in Flex AdvancedDataGrid

    - by user211607
    Hi, I am able to display any data (numbers) in Flex AdvancedDataGrid except data with lot of digits after decimal places (0.000000000029103830456733704) or exponential numbers (293E-17). Grid is displaying -17 instead of 293E-17. Is it happening because of any limit to displaying data range in grid? If yes, what is the limit? Thanks in advance ... Atul

    Read the article

  • Converting numbers to their language, how?

    - by SoLoGHoST
    Ok, I'm using mathematical equations to output numbers, though, I need this to be compatible for all languages. Currently, all language strings are within a php array called $txt, and each key of the array gets called for that language. I'm outputting the following: Column 1, Column 2, Column 3, and so on, as well as Row 1, Row 2, Row 3, and so on. The calculations are done via php and javascript, so I'm wondering on the best approach for how to support all languages for the numbers only. I don't do the translations, someone else does, but I need to be able to point it to, either the php variable $txt of where the language is defined, or, since the calculations are done via javascript also, I need to somehow store this in there. I'm thinking of storing something like this: // This part goes in the php language file. $txt['0'] = '0'; $txt['1'] = '1'; $txt['2'] = '2'; $txt['2'] = '3'; $txt['4'] = '4'; $txt['5'] = '5'; $txt['6'] = '6'; $txt['7'] = '7'; $txt['8'] = '8'; $txt['9'] = '9'; // This part goes in the php file that needs to call the numbers. echo '<script> var numtxts = new Array(); numtxts[0] = \'', $txt['0'], '\'; numtxts[1] = \'', $txt['1'], '\'; numtxts[2] = \'', $txt['2'], '\'; numtxts[3] = \'', $txt['3'], '\'; numtxts[4] = \'', $txt['4'], '\'; numtxts[5] = \'', $txt['5'], '\'; numtxts[6] = \'', $txt['6'], '\'; numtxts[7] = \'', $txt['7'], '\'; numtxts[8] = \'', $txt['8'], '\'; numtxts[9] = \'', $txt['9'], '\'; </script>'; And than in the javascript function it could grab the correct string for each number like so: // Example Number String below. var numString = "10"; var transNum = ""; for(x=0;x<numString.length;x++) { var numChar = numString.charAt(x); transNum += numtxts[parseInt(numChar)]; } return transNum; The problem with this bit of code is that it groups the numbers, not sure if all languages do that, like the english language does...? Perhaps there's a better approach for this? Can anyone help please? Thanks :)

    Read the article

  • Getting N random numbers that the sum is M

    - by marionmaiden
    Hello I want to get N random numbers that the sum of them is a value. For example, let's suppose I want 5 random numbers that their sum is 1 Then, a valid possibility is: 0.2 0.2 0.2 0.2 0.2 Other possibility is: 0.8 0.1 0.03 0.03 0.04 And so on. I need this for the creation of the matrix of belongings of the Fuzzy C-means.

    Read the article

  • How to solve cyclic dependencies in a visitor pattern

    - by Benjamin Rogge
    When programming at work we now and then face a problem with visitors and module/project dependencies. Say you have a class A in a module X. And there are subclasses B and C in module Y. That means that module Y is dependent on module X. If we want to implement a visitor pattern to the class hierarchy, thus introducing an interface with the handle Operations and an abstract accept method in A, we get a dependency from module Y to module X, which we cannot allow for architectural reasons. What we do is, use a direct comparison of the types (i.e. instanceof, since we program in Java), which is not satisfying. My question(s) would be: Do you encounter this kind of problem in your daily work (or do we make poor architectural choices) and if so, how is your approach to solve this?

    Read the article

  • Formatting numbers by tokens with php

    - by Adam D
    I'm looking for a way to format numbers using "tokens". This needs to be conditional (for the first few leading characters). Example: <?php $styles=array('04## ### ###','0# #### ####','13# ###','1800 ### ###'); format_number(0412345678); /*should return '0412 345 678'*/ format_number(0812345678); /*should return '08 1234 5678'*/ format_number(133622); /*should return '133 622'*/ format_number(1800123456); /*should return '1800 123 456'*/ ?> Incase you haven't guessed, my use of this is to format Australian phone numbers, dependent on their 'type'. I have a PHP function that does this, but it is ~114 lines and contains a lot of repeated code. Can anyone help?

    Read the article

  • how to convert big-endian numbers to native numbers delphi

    - by steve0
    hi all i want to know how to convert big endian numbers to native numbers in delphi i am porting some c++ code in that i came accross this part unsigned long blockLength = *blockLengthPtr++ << 24; blockLength |= *blockLengthPtr++ << 16; blockLength |= *blockLengthPtr++ << 8; blockLength |= *blockLengthPtr; unsigned long dataLength = *dataLengthPtr++ << 24; dataLength |= *dataLengthPtr++ << 16; dataLength |= *dataLengthPtr++ << 8; dataLength |= *dataLengthPtr; i am not familiar with c++ ,so i didnt understand what those operators doing can any one help ? regards

    Read the article

  • Recovering portion(s) of file with CRC (cyclic redundancy check) errors in Robocopy

    - by Mark A
    Is it possible to recover portions of files with CRC errors? If so, how? I have a partially damaged hard drive (2.5" SATA) that I have partially recovered using Spinrite 6.0 (took 2 weeks to run!). I have been successful in getting many of the files off of the drive using Robocopy . /V /S /E /COPY:DAT /R:1 /W:0, but some of the files get to +/- 90% in Robocopy and then fail with a CRC Data Error (cyclic redundancy check). I am wondering if it is possible to recover the first 90% of the file and try to recover it in a text editor. 1.0% ... 91.0% 91.1% 2010/06/14 18:21:13 ERROR 23 (0x00000017) Copying File F:\Documents and Settings\user\Local Settings\Application Data\Identities\{GUID}\Microsoft\Outlook Express\Mailbox Folder.dbx Data error (cyclic redundancy check). Thanks in advance!

    Read the article

  • Generating strongly biased radom numbers for tests

    - by nobody
    I want to run tests with randomized inputs and need to generate 'sensible' random numbers, that is, numbers that match good enough to pass the tested function's preconditions, but hopefully wreak havoc deeper inside its code. math.random() (I'm using Lua) produces uniformly distributed random numbers. Scaling these up will give far more big numbers than small numbers, and there will be very few integers. I would like to skew the random numbers (or generate new ones using the old function as a randomness source) in a way that strongly favors 'simple' numbers, but will still cover the whole range, I.e. extending up to positive/negative infinity (or ±1e309 for double). This means: numbers up to, say, ten should be most common, integers should be more common than fractions, numbers ending in 0.5 should be the most common fractions, followed by 0.25 and 0.75; then 0.125, and so on. A different description: Fix a base probability x such that probabilities will sum to one and define the probability of a number n as xk where k is the generation in which n is constructed as a surreal number1. That assigns x to 0, x2 to -1 and +1, x3 to -2, -1/2, +1/2 and +2, and so on. This gives a nice description of something close to what I want (it skews a bit too much), but is near-unusable for computing random numbers. The resulting distribution is nowhere continuous (it's fractal!), I'm not sure how to determine the base probability x (I think for infinite precision it would be zero), and computing numbers based on this by iteration is awfully slow (spending near-infinite time to construct large numbers). Does anyone know of a simple approximation that, given a uniformly distributed randomness source, produces random numbers very roughly distributed as described above? I would like to run thousands of randomized tests, quantity/speed is more important than quality. Still, better numbers mean less inputs get rejected. Lua has a JIT, so performance can't be reasonably predicted. Jumps based on randomness will break every prediction, and many calls to math.random() will be slow, too. This means a closed formula will be better than an iterative or recursive one. 1 Wikipedia has an article on surreal numbers, with a nice picture. A surreal number is a pair of two surreal numbers, i.e. x := {n|m}, and its value is the number in the middle of the pair, i.e. (for finite numbers) {n|m} = (n+m)/2 (as rational). If one side of the pair is empty, that's interpreted as increment (or decrement, if right is empty) by one. If both sides are empty, that's zero. Initially, there are no numbers, so the only number one can build is 0 := { | }. In generation two one can build numbers {0| } =: 1 and { |0} =: -1, in three we get {1| } =: 2, {|1} =: -2, {0|1} =: 1/2 and {-1|0} =: -1/2 (plus some more complex representations of known numbers, e.g. {-1|1} ? 0). Note that e.g. 1/3 is never generated by finite numbers because it is an infinite fraction – the same goes for floats, 1/3 is never represented exactly.

    Read the article

  • A function where small changes in input always result in large changes in output

    - by snowlord
    I would like an algorithm for a function that takes n integers and returns one integer. For small changes in the input, the resulting integer should vary greatly. Even though I've taken a number of courses in math, I have not used that knowledge very much and now I need some help... An important property of this function should be that if it is used with coordinate pairs as input and the result is plotted (as a grayscale value for example) on an image, any repeating patterns should only be visible if the image is very big. I have experimented with various algorithms for pseudo-random numbers with little success and finally it struck me that md5 almost meets my criteria, except that it is not for numbers (at least not from what I know). That resulted in something like this Python prototype (for n = 2, it could easily be changed to take a list of integers of course): import hashlib def uniqnum(x, y): return int(hashlib.md5(str(x) + ',' + str(y)).hexdigest()[-6:], 16) But obviously it feels wrong to go over strings when both input and output are integers. What would be a good replacement for this implementation (in pseudo-code, python, or whatever language)?

    Read the article

  • printing out prime numbers from array

    - by landscape
    I'd like to print out all prime numbers from an array with method. I can do it with one int but don't know how to return certain numbers from array. Thanks for help! public static boolean isPrime(int [] tab) { boolean prime = true; for (int i = 3; i <= Math.sqrt(tab[i]); i += 2) if (tab[i] % i == 0) { prime = false; break; } for(int i=0; i<tab.length; i++) if (( tab[i]%2 !=0 && prime && tab[i] > 2) || tab[i] == 2) { return true; } else { return false; } //return prime; } thanks both of you. Seems like its solved: public static void isPrime(int[] tab) { for (int i = 0; i < tab.length; i++) { if (isPrimeNum(tab[i])) { System.out.println(tab[i]); } } } public static boolean isPrimeNum(int n) { boolean prime = true; for (long i = 3; i <= Math.sqrt(n); i += 2) { if (n % i == 0) { prime = false; break; } } if ((n % 2 != 0 && prime && n > 2) || n == 2) { return true; } else { return false; } }

    Read the article

  • trying to divide complex numbers, division by zero

    - by user553619
    I'm trying the program below to divide complex numbers, it works for complex numbers but not when the denominator is real (i.e, the complex part is zero). Division by zero occurs in this line ratio = b->r / b->i ;, when the complex part b->i is zero (in the case of a real denominator). How do I get around this? and why did the programmer do this, instead of the more straightforward rule for complex division The wikipedia rule seems to be better, and no division by zero error would occur here. Did I miss something? Why did the programmer not use the wikipedia formula?? Thanks /*! @file dcomplex.c * \brief Common arithmetic for complex type * * <pre> * -- SuperLU routine (version 2.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November 15, 1997 * * This file defines common arithmetic operations for complex type. * </pre> */ #include <math.h> #include <stdlib.h> #include <stdio.h> #include "slu_dcomplex.h" /*! \brief Complex Division c = a/b */ void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b) { double ratio, den; double abr, abi, cr, ci; if( (abr = b->r) < 0.) abr = - abr; if( (abi = b->i) < 0.) abi = - abi; if( abr <= abi ) { if (abi == 0) { fprintf(stderr, "z_div.c: division by zero\n"); exit(-1); } ratio = b->r / b->i ; den = b->i * (1 + ratio*ratio); cr = (a->r*ratio + a->i) / den; ci = (a->i*ratio - a->r) / den; } else { ratio = b->i / b->r ; den = b->r * (1 + ratio*ratio); cr = (a->r + a->i*ratio) / den; ci = (a->i - a->r*ratio) / den; } c->r = cr; c->i = ci; }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >