Search Results

Search found 2558 results on 103 pages for 'significant digits'.

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

  • Prolog: find all numbers of unique digits that can be formed from a list of digits

    - by animo
    The best thing I could come up with so far is this function: numberFromList([X], X) :- digit(X), !. numberFromList(List, N) :- member(X, List), delete(List, X, LX), numberFromList(LX, NX), N is NX * 10 + X. where digit/1 is a function verifying if an atom is a decimal digit. The numberFromList(List, N) finds all the numbers that can be formed with all digits from List. E.g. [2, 3] -> 23, 32. but I want to get this result: [2, 3] -> 2, 3, 23, 32 I spent a lot of hours thinking about this and I suspect you might use something like append(L, _, List) at some point to get lists of lesser length. I would appreciate any contribution.

    Read the article

  • Python - Number of Significant Digits in results of division

    - by russ
    Newbie here. I have the following code: myADC = 128 maxVoltage = 5.0 maxADC = 255.0 VoltsPerADC = maxVoltage/maxADC myVolts = myADC * VoltsPerADC print "myADC = {0: >3}".format(myADC) print "VoltsPerADC = {0: >7}".format(VoltsPerADC) print VoltsPerADC print "myVolts = {0: >7}".format(myVolts) print myVolts This outputs the following: myADC = 128 VoltsPerADC = 0.0196078 0.0196078431373 myVolts = 2.5098 2.50980392157 I have been searching for an explanation of how the number of significant digits is determined by default, but have had trouble locating an explanation that makes sense to me. This link link text suggests that by default the "print" statement prints numbers to 10 significant figures, but that does not seem to be the case in my results. How are the number of significant digits/precision determined? Can someone shed some light on this for me. Thanks in advance for your time and patience.

    Read the article

  • Formatting numbers with significant figures in C#

    - by Chris Farmer
    I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become 12300 and 0.012345 will become 0.0123. Occasionally it will be 4 or 5. Is there any convenient way to handle this?

    Read the article

  • Fastest way to pad a number in Java to a certain number of digits

    - by Martin
    Am trying to create a well-optimised bit of code to create number of X-digits in length (where X is read from a runtime properties file), based on a DB-generated sequence number (Y), which is then used a folder-name when saving a file. I've come up with three ideas so far, the fastest of which is the last one, but I'd appreciate any advice people may have on this... 1) Instantiate a StringBuilder with initial capacity X. Append Y. While length < X, insert a zero at pos zero. 2) Instantiate a StringBuilder with initial capacity X. While length < X, append a zero. Create a DecimalFormat based on StringBuilder value, and then format the number when it's needed. 3) Create a new int of Math.pow( 10, X ) and add Y. Use String.valueOf() on the new number and then substring(1) it. The second one can obviously be split into outside-loop and inside-loop sections. So, any tips? Using a for-loop of 10,000 iterations, I'm getting similar timings from the first two, and the third method is approximately ten-times faster. Does this seem correct? Full test-method code below... // Setup test variables int numDigits = 9; int testNumber = 724; int numIterations = 10000; String folderHolder = null; DecimalFormat outputFormat = new DecimalFormat( "#,##0" ); // StringBuilder test long before = System.nanoTime(); for ( int i = 0; i < numIterations; i++ ) { StringBuilder sb = new StringBuilder( numDigits ); sb.append( testNumber ); while ( sb.length() < numDigits ) { sb.insert( 0, 0 ); } folderHolder = sb.toString(); } long after = System.nanoTime(); System.out.println( "01: " + outputFormat.format( after - before ) + " nanoseconds" ); System.out.println( "Sanity check: Folder = \"" + folderHolder + "\"" ); // DecimalFormat test before = System.nanoTime(); StringBuilder sb = new StringBuilder( numDigits ); while ( sb.length() < numDigits ) { sb.append( 0 ); } DecimalFormat formatter = new DecimalFormat( sb.toString() ); for ( int i = 0; i < numIterations; i++ ) { folderHolder = formatter.format( testNumber ); } after = System.nanoTime(); System.out.println( "02: " + outputFormat.format( after - before ) + " nanoseconds" ); System.out.println( "Sanity check: Folder = \"" + folderHolder + "\"" ); // Substring test before = System.nanoTime(); int baseNum = (int)Math.pow( 10, numDigits ); for ( int i = 0; i < numIterations; i++ ) { int newNum = baseNum + testNumber; folderHolder = String.valueOf( newNum ).substring( 1 ); } after = System.nanoTime(); System.out.println( "03: " + outputFormat.format( after - before ) + " nanoseconds" ); System.out.println( "Sanity check: Folder = \"" + folderHolder + "\"" );

    Read the article

  • algorithm to print the digits in the correct order

    - by Aga Waw
    I've been trying to write an algorithm that will print separately the digits from an integer. I have to write it in Pseudocode. I know how to write an algorithm that reverse the digits. digi(n): while n != 0: x = n % 10 n = n // 10 print (x) But I don't know how to write an algorithm to print the digits in the correct order. f.eg. the input is integer 123467 and the output is: 1 2 3 4 6 7 The numbers will be input from the user, and we cannot convert them to a string. I just need help gettin started on writing algorithms. Thanks

    Read the article

  • Removing the last digits in string [migrated]

    - by Ruriko
    I have a string that looks like this: [APPLE PIE] Sei Shoujo Sentai Lakers 3 Battle Team Lakers 3 (100% FULL-PIC)_20121104_032834 I want to remove the digits at the end of the string, basically the 16 digits at the end of the string. In the end it should look like this: [APPLE PIE] Sei Shoujo Sentai Lakers 3 Battle Team Lakers 3 (100% FULL-PIC) This is my code that I have written so far var str="[APPLE PIE] Sei Shoujo Sentai Lakers 3 Battle Team Lakers 3 (100% FULL-PIC)_20121104_032834"; var n=str.substr(1,74); document.write(n); The problem is the string will be different so each will have different amount of characters. So how I remove the digits at the end of the string in javascript?

    Read the article

  • PHP: why uniqid returned value is only 13 digits long

    - by Marco Demaio
    uniqid() function returns a 13 digits long hexadecimal number. According to the spec in php.net site, the function uses microtime to generate the unique value. But microtime returns numbers in string format as the following one: "0.70352700 12689396875" which are basically the microseconds and the seconds elapsed since 1970. This is a 9+11 digits decimal number. Converting a 20 decimal number into hex would result in a 16 digits hexadecimal NOT a 13 digits one. I also thought to take out the "0." part that seem to never change, and the last two digits of the microsec part that seem to remain always "00". Doing this the decimal number would be only 9+11-3 digits long, but still a decimal number of 17 digits when converted into hex would result in 14 digits hexadecimal number NOT 13. You probably think I'm crazy in asking such a thing, but I'm concerned about using uniqid, unique values are important to be unique, a duplicated value could screw up an entire application.

    Read the article

  • How to round a number to n decimal places in Java

    - by Alex Spurling
    What I'd like is a method to convert a double to a string which rounds using the half-up method. I.e. if the decimal to be rounded is a 5, it always rounds up the previous number. This is the standard method of rounding most people expect in most situations. I also would like only significant digits to be displayed. That is there should not be any trailing zeroes. I know one method of doing this is to use the String.format method: String.format("%.5g%n", 0.912385); returns: 0.91239 which is great, however it always displays numbers with 5 decimal places even if they are not significant: String.format("%.5g%n", 0.912300); returns: 0.91230 Another method is to use the DecimalFormatter: DecimalFormat df = new DecimalFormat("#.#####"); df.format(0.912385); returns: 0.91238 However as you can see this uses half-even rounding. That is it will round down if the previous digit is even. What I'd like is this: 0.912385 -> 0.91239 0.912300 -> 0.9123 What is the best way to achieve this in Java?

    Read the article

  • BigInteger.ToString() returns more than 50 decimal digits.

    - by brickner
    I'm using .NET 4 System.Numerics.BigInteger Structure and I'm getting results different from the documentation. In the documentation of BigInteger.ToString() Method It says: The ToString() method supports 50 decimal digits of precision. That is, if the BigInteger value has more than 50 digits, only the 50 most significant digits are preserved in the output string; all other digits are replaced with zeros. I have some code that takes a 60 decimal digits BigInteger and converts it to a string. The 60 significant decimal digits string didn't lose any significant digits: const string vString = "123456789012345678901234567890123456789012345678901234567890"; Assert.AreEqual(60, vString.Length); BigInteger v = BigInteger.Parse(vString); Assert.AreEqual(60, v.ToString().Length); Assert.AreEqual('9', v.ToString()[58]); Assert.AreEqual('1', v.ToString()[0]); Assert.AreEqual(vString, v.ToString()); All the asserts pass. What exactly does the quoted part of the documentation mean?

    Read the article

  • Advice on approaching a significant rearrangement/refactoring?

    - by Prog
    I'm working on an application (hobby project, solo programmer, small-medium size), and I have recently redesigned a significant part of it. The program already works in it's current state, but I decided to reimplement things to improve the OO design. I'm about to implement this new design by refactoring a big part of the application. Thing is I'm not sure where to start. Obviously, by the nature of a rearrangement, the moment you change one part of the program several other parts (at least temporarily) break. So it's a little 'scary' to rearrange something in a piece of software that already works. I'm asking for advice or some general guidelines: how should I approach a significant refactoring? When you approach rearranging large parts of your application, where do you start? Note that I'm interested only in re-arranging the high-level structure of the app. I have no intention of rewriting local algorithms.

    Read the article

  • How many significant digits should I use for double literals in Java?

    - by M. Dudley
    How many significant digits should I use when defining a double literal in Java? This is assuming that I am trying to represent a number with more significant figures than a double can hold. In Math.java I see 20 and 21: public static final double E = 2.7182818284590452354; public static final double PI = 3.14159265358979323846; This is more than the 15-17 significant digits provided by IEEE 754. So what's the general rule-of-thumb?

    Read the article

  • JD Edwards Delivers Once Again with Significant Announcements

    Listen to Lenley Hensarling, JD Edwards Group Vice President,talk about the significant JD Edwards announcements made during Oracle OpenWorld 2008.Lenley will highlight how JD Edwards’ customers can benefit from the latest product releases from EnterpriseOne and World,discuss the wave of companies who are upgrading to the most recent JD Edwards releases to take advantage of an array of industry specific enhancements,and elaborate on JD Edwards’ strategy about integrating to other Oracle solutions,bringing continuous value to customers.

    Read the article

  • Significant number of non-HTTP requests hitting my site

    - by Mark Westling
    I'm seeing a significant number of non-HTTP requests hitting a site I just launched. They show up in the server (nginx) logs as non-ASCII and get rejected (correctly) with a 400 status. Here are some lines from the log: 95.132.198.189 - - [09/Jan/2011:13:53:30 -0500] "œ$A\x10õœ²É9J" 400 173 "-" "-" 79.100.145.126 - - [09/Jan/2011:13:57:42 -0500] "#§i²¸oYi á¹„\x13VJ—x·—œ\x04N \x1DÔvbÛè½\x10§¬\x1E0œ_^¼+\x09ÜÅ\x08DÌÃiJeT€¿æ]œr\x1EëîyIÐ/ßýúê5Ǹ" 400 173 "-" "-" 79.100.145.126 - - [09/Jan/2011:13:58:33 -0500] "¯Ú%ø=Œ›D@\x12¼\x1C†ÄÀe\x015mˆàd˜Û%pÛÿ" 400 173 "-" "-" What should I make of this? Is this some sort of scripted attack? Or could these be correct requests that have somehow been garbled? They're not affecting the performance of the site and I'm not seeing any other signs of attacks (e.g., no strange POSTs) so at this point I'm more curious than afraid.

    Read the article

  • Adding more than 15 digits in excel

    - by user111921
    I want to add more than 20 digits in an Excel cell. The current format of the cell is general, it converts the number to an exponential format. I tried with a number format and accounting but when I enter more than 15 digits it gets converted to 0's. Please recommend steps for stopping Excel from converting data to Exponential Format for 20 digits when in the general format. Example: 12345678901234567890 Excel converts it to 1.23457E+19 in general format. with out using ' before value is there any other way to keep value same.

    Read the article

  • Ted Kummert to make significant announcement related to SQL Server

    - by jamiet
    Microsoft have announced a conference call tomorrow with the head of all things SQL Server, Ted Kummert: Normally I wouldn’t take any notice of such things but the mysterious pre-conference-call-announcement (not something that the SQL Server team do regularly as I recall) has me intrigued. Logic says that it will have something to do with SQL Server R2, we shall see! @Jamiet Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • Someone using my website for Email and significant increase in spam

    - by Joy
    Let me give you the background in context so that you know the full story. Last summer my web guy (he put my website together) got in a fight with someone who attempted to register on my site using the name of my company as part of his user name. I was not aware of this at all until it had escalated dramatically. I don't know why my web guy was so unprofessional in his response to this person. I really don't know him - met him via SCORE and have never met in person. He is a vendor. Anyway, this guy who got into it with my web guy then threatened to do all he could to hurt my business and said he was internet savvy, etc. So, nothing seemed to happen for a while then not long ago this guy attempted to send me a friend request on Linkedin. After his behavior I declined it. Shortly afterwards I began seeing a dramatic increase in spammers posting comments on the blog part of my site. Just lately I have been receiving Emails from a variety of names but all with the "@___" that I own - for my business. I had additional security added so now they have to register in order to comment on my blog and I am seeing a lot of registration attempts from the same (and similar) IP addresses with bogus names and weird Email addresses being blocked. So, it is not creating more work as it is all automatic. The Email addresses are of more concern. Is there a way to identify a person through an IP address or a place to report the behavior or the Email usage? This guy lives in South Carolina so he is not overseas. Any help/advice you can provide will be greatly appreciated. Thanks Joy

    Read the article

  • Any significant performance cost to using BlendState.Premultiplied?

    - by Donutz
    Normally I guess you'd use BlendState.AlphaBlend because normally when you load your textures through the pipeline they're already premultiplied. However, if you're loading textures at runtime from PNGs or some such, you have to loop through the pixels and premultiply them, which can take a long time if you've got a lot of textures to load. So it looks (haven't tried it) like using BlendState.Premultiplied instead of BlendState.AlphaBlend should handle non-premultiplied textures and produce the same visual result, without all the startup costs. I have to wonder if there's a non-obvious cost to doing this, like a huge drop in performance or something. Anyone know?

    Read the article

  • Broken Splash boot screen with significant performance and freezing issues

    - by Ghost_ITMachine
    okay heres the story and yes this is important becauses its what was the last thing i did before this madness watched a youtube video which ive now flagged and reported but he basically instructed us to su virtualbox into the system i dont know what i did all i did was follow directions now im plagued with no ubuntu purple boot screen it goes straight to a black screen filled with letters and im experiencing more lag and freezing than i ever have before this is not from an upgrade ive had 14.04 for about a month before this happened im at a loss for what my routes are it was all i could do to remove the superblocks just to get back into my desktop please help

    Read the article

  • Why is it an issue that it takes 2 digits to represent the number 10 in decimal?

    - by Crizly
    So we use hexadecimal which has the advantage of going up to 15 in single digits A-F, but why is it an issue that it takes 2 digits to represent the number 10 in decimal? I was reading up about hexadecimal and I came across these 2 lines: Base 16 suggests the digits 0 to 15, but the problem we face is that it requires 2 digits to represent 10 to 15. Hexadecimal solves this problem by using the letters A to F. My question is, why do we care how many digits it takes to represent 15? What is the importance of this number, and how does denoting it with a single character have any value?

    Read the article

  • Android: RTL support - digits embedded in a right to left sentence (Hebrew)

    - by Rob
    Hi There, My application displays Hebrew text which comes from a Web Service. When a sentence contains digits (in the middle of it), the digits appear in a mirror view: 29 appears as 92, 21:45 appears as 54:12 and 2,000 appears as 000,2. Also, when a sentence starts with digits or English characters, they get thrown to the end of the sentence messing it all up... Does anyone have an idea how can this be solved? Is RTL support in Android still immature? Thanks, Rob

    Read the article

  • android:digits Problem

    - by user244190
    I am using the following xml to limit input to digits only in an EditText widget. The android:digits attribute uses the below array resource. Everything works great except for the fact that I can't enter the number 4 even though its in the array. Any Ideas? <EditText android:id="@+id/mynumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="40dp" android:textStyle="bold" android:gravity="center_horizontal" android:layout_centerHorizontal="true" android:textColor="#aaffaa" android:numeric="integer" android:digits="@array/digits" android:background="#00000000" android:inputType="phone" android:focusable="true" android:singleLine="true" /> <string-array name="digits"> <item>0</item> <item>1</item> <item>2</item> <item>3</item> <item>4</item> <item>5</item> <item>6</item> <item>7</item> <item>8</item> <item>9</item> </string-array> Thanks

    Read the article

  • sed regex to match ['', 'WR' or 'RN'] + 2-4 digits

    - by Karl
    Hi I'm trying to do some conditional text processing on Unix and struggling with the syntax. I want to acheive Find the first 2, 3 or 4 digits in the string if 2 characters before the found digits are 'WR' (could also be lower case) Variable = the string we've found (e.g. WR1234) Type = "work request" else if 2 characters before the found digits are 'RN' (could also be lower case) Variable = the string we've found (e.g. RN1234) Type = "release note" else Variable = "WR" + the string we've found (Prepend 'WR' to the digits) Type = "Work request" fi fi I'm doing this in a Bash shell on Red Hat Enterprise Linux Server release 5.5 (Tikanga) Thanks in advance, Karl

    Read the article

  • Converting digits, generated by weblog service, to Indic or Roman

    - by Sorush Rabiee
    I need to write something in my html code to convert digits of form 0123456789 to ?????????? (Arabic digits). the number of visitors is generated by blog service. and I want to convert its digits to Arabic. Counter: ????? ????????????? : <BlogSky:Weblog Counter /> ??? the Persian part of above code mean 'Number of visitors' and 'Persons' (from left to right). but digits are represented in latin (0123...). Is it possible to write something like a function in html? i want it to be a global one for using in weblogs. Note: I don't know anything about web programming languages. (and don't want to learn!). I'm not sure about language of above code. (html?)

    Read the article

  • How to generate unique number of 12 digits?

    - by DanSogaard
    I'm working on an app that sends raw data to zebra printer and print out barcodes. And since every item has its own unique barcode, I need to define a variable that automatically generates unique number of 12 digits long. see example: printBar prnt = new printBar("123456789012"); Is there anyway to define a double variable and pass it to a function that return uniqely 12 digits number and pass it over again to the printBar class?. But how to make sure everytime you access it returns a unique value?. I also thought of another way, since am using MS Access db, I can create a column of AutoNumber datatype and assign it to Random, but you don't get the exact 12 digits required, sometimes it generates a value of 10 digits sometimes more or less.

    Read the article

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