What's the best way to round a double to 12 decimals?

What's the best way to do it? The math functions don't seem quite right...

I'm doing three different algoritms that are mathematically identical. I'm working with precisions from 2 to 12 significants digits (working with a function I got from a book), but the results are no exctly what I expect... For example, the one with 12 significant digits is 97.45322134230000001, or something like that... I'm making a method that receiving a double and an n makes a string with the correct number of significant digits... However, rounding the double beforehand would come in handy.

Similar Messages

  • What is the best way to do a double page spread for a magazine?

    I'm in the process of putting together a magazine and would like to do some double-page spreads in it, but my printer has requested that the magazine be sent to him as single pages.  If I set it up as 'facing pages' and then change it to single pages when I've finished, will this upset my double page layouts??

    Set it up as facing pages, then when you make the pdf DO NOT CLICK SPREADS.
    When  you click Spreads you are asking InDesign to produce a PDF where page 2-3 are joined, and 3-4 are joined etc.
    When you don't have Spreads selected then Indesign produces Single Page pdf.
    A single page is what is required by a printers with the pages running in reading order from page 1 - finish (for example).
    Do not attempt to impose the document yourself.
    Remember to include your crop marks and your bleed.
    Sidenote on crop marks and bleed:
    Crop marks are needed to trim the page to size when printed. As printers can't  print right to edge of a sheet, and that it's near impossible to trim a  sheet of paper right to the edge of a colour - the colour needs to  extend past the crop line, this is called  bleed.
    When you bleed the document, i.e., extend any item that is tucked right  against the foredge (the edges opposite the spine), then you need to  extend this object off the page into a "bleed" area.
    This allows for human error when trimming the paper, as each sheet is  not trimmed individually (that would take forever!) they are stacked on  top of each other and trimmed in stacks. It would be impossible to stack  all the sheets exactly even, and there is movement on the press, so  compensating for the movement and the fact they can never be stacked  exactly even - for this reason you need objects to extend past the edge  of the page.
    The crop marks tell the guillotine operator where to trim the sheet. Once they have  the measurements in their guillotine machine it's a simple matter of  rinse and repeat with as many stacks of paper there are.
    And printers can sometimes fold and trim a print job folding machine,  and since it's a machine and you have to account for mechanical errors  and human error, you need bleed too.
    Bleed is important - If you don't add bleed then the object stops at the  foredge of the paper. And if the blade trims/crops close to the object  but misses by a sliver - then you have a sliver of white on the printed  piece, which is highly undesirable.
    So you need crop marks so the printers know where exactly to cut the paper, and to cut into  the bleed so that you don't have slivers of white.
    And yes you need crop marks even if you don't have bleed, if you  don't have any bleed it's likely that the edges of the paper are just  white, so there are no markings where to cut to give the correct size  that you want. So crop marks need to be included no matter what.
    And the placement of crop marks is important. As I said earlier, crop marks are  for letting the guillotine operator know where to trim the page so that  it cuts into the bleed area. The bleed area to allow for mechanical,  physical and human error. And seen as the bleed can sometimes be  included in a final printed piece it is not desirable to have anything  other than bleed objects in the bleed area.
    For this reason you offset your crop marks to be outside the bleed area. As I'm in  Europe I work mainly in millimeters, so I would set my Bleed Area to be 3-5  mm (check with your printers for what bleed you should allow) and I would set my crop marks to Offset by 1 mm more than the Bleed (i.e., 4 - 6mm).
    This ensures that the crop marks do not encroach the bleed area. If your crop marks do  encroach the bleed area you run the risk of the crop marks appearing on a final printed  piece.
    So in Summary
    Make sure you have bleed where necessary on your document.
    Add the desired amount of bleed - in my case 3-5 mm.
    Offset the crop marks so they don't encroach the bleed area - in my case 4-6mm.
    (bleed depends on the printers requirements - then make sure you offset your crop marks to be outside the bleed area).
    Message was edited by: Eugene Tyson
    Correction to mm in Summary

  • What's the best way to deal with floating point errors?

    What's the best way to deal with the decimal number errors in Flex?
    Lets say I have:
    var number1:Number = 1.1;
    var number2:Number = 1;
    var result:Number = number1 - number2;
    trace(result);
    I get "0.10000000000000009".
    What's the best way to deal with this so that i get the right result?
    Using the trick: result = Math.round( result * Math.pow(10,13) ) / Math.pow(10,13); is not useful as such when using big numbers.
    For example, If number1 = 100000000001.1, and number2 = 0.2, I get "100000000000.90001" as result. The previous rounding fixes rounding errors after 13th decimal, but here the first rounding errors come after 4 digits.
    The toPrecision method in Number and NumberFormatter dont seem be of use by themselves because of the same reason.
    So I'd have to check how big the number is, and then round the number based on that.
    So far I've constructed a method that does that with logarithms like this:
    public function floatFix(number:Number):Number{
          var precision:int = 14-Math.floor(Math.log(Math.abs(number))*Math.LOG10E);
          var precisionFactor:Number = Math.pow(10, precision);
          return Math.round(Number(number*precisionFactor))/precisionFactor;
    It just seems rather odd that one would have to create and use something like that to just count 1.1-1; There's a lot of calculating in that method, and i'm guessing that having to use that in a loop could slow down a program quite a bit.
    I think there really should be a pre-built method in flex for something like this, but I can't find any.
    Anyone know any better/faster ways?

    Use the application server database pooling services to create a datasource that can be access using JNDI.
    Move the database access code to a Servlet so that a JSP submits a form to the Servlet that does the database access and packages the data into a bean which is passed to another JSP to be displayed.

  • What is the best way to clean up your mac and make it faster and run to an optimum level?

    Hi Everyone, Hope all is well
    Iv been running my mac pro for a long time now, its a Mac pro, 2x 2.26 GHz Quad Core Intel Xeon. 12 GB 1066 MHz DDR3 Ram
    Over time now it has become slower, at the moment its still running fine but im sure over time it has probabally collected unwanted data etc. i just dont want it to become a problem as its only going to be used more and more... i now notice that some of the regular programs which i open do take a little while longer to open and i sometimes see that little round Mac loading the sign (the round multicolor wheel).., is there a way to clean the mac up? so that it can run more smoothly and just a better over all feel.,,, the machine is still running beautifully but its time i give it more care and revive it a little more..
    What are the best ways to do this, i dont trust any of these non apple based products which claim they can clean ur Mac etc.
    Any solutaion and advice that u guys can give would be great and i would be very thankful
    Thanks in advance

    For immediate speed improvements, upgrade to a Solid State Drive and upgrade your conventional hard drives to new ones, because the newer ones are faster at reading and writing than the ones from 5 years ago.
    By Re-installing your OS onto a solid state drive, the system will boot much faster, and your programs will launch much faster.
    I use a small SSD (only 60GB) which contains only OS X and all my apps.  All of my personal files are on the large mechanical hard drive.  If you still use the drive that shipped with the Mac, then it might be a good idea to replace it.
    Depending on what kind of work you do, then additional RAM will help.  Swapping CPUs should only be done if you are really in need of the improvements they would bring. 
    You appear to have the 2009 dual-CPU Mac Pro, which is the most challenging model to swap CPUs into.

  • What is the best way to cancel the related update from aboutToUpdate ?

    What is the best way to cancel the related update from DescriptorEventAdapter.aboutToUpdate ?
    Anyway to manipulate descriptorEvent.getQuery() so that it doesn't generate anything?
    In our specific case, TopLink 11 - EclipseLink 2.0.2 generates useless update, so we want to silence them to avoid DB round trip.

    Mustafa,
    Thats the way to kill the Job, But We are not Authorized for SM50.
    At present we will raise a request to the Basis to do that. Speaking from user point of view is there any better way to handle it.
    Tony

  • What is the best way of recording bass

    Hi Peeps
    What is the best way to record a bass guitar in Logic. I'm going through a Fast Track Pro Audio Interface. The songs we are recording a disco cover, like get down on it and freak out, so need quite a warm rounded tone to them with a solid level.
    Thanks
    Matt

    Hi Peeps
    What is the best way to record a bass guitar in Logic. I'm going through a Fast Track Pro Audio Interface. The songs we are recording a disco cover, like get down on it and freak out, so need quite a warm rounded tone to them with a solid level.
    Thanks
    Matt

  • What is the best way to set up iTunes on our home network so all family members have access to all of our itunes library, even music we don't have on the cloud?

    I have five different people using 10 different apple devices on one itunes account in our family.  We have had trouble sharing.  What is the best way to set up itunes on our home network?  We have purchased music that sits on icloud, but we also have music we have imported from our previous cd library.  Our itunes program keeps crashing and dumping everyone's playlists.  So far we have all been using just the one desktop computer to sync to because we can't figure out how to share the same librarly and playlists on multiple computers in our home so devices can be synced at any location as well as playlists and purchases be made. 

    What is the best way to set up itunes on our home network? 
    One iTunes library per person.  One iTunes account per person.
    If people wish to share songs, they can make copies.
    When the inevitable day comes when the kids get older, you will not have to come back here and post asking how all that stuff can get separated!

  • HT1349 I lost/had my iPhone stolen. Tried using Find My iPhone and it's offline. It was set up. What do I do now? Do I report it stolen? What is the best way in getting back my iPhone if any? Thank you in advance.

    Tried using Find My iPhone and it's offline. It (Find my iPhone) was set up. What do I do now? Do I report it stolen? What is the best way in getting back my iPhone if any? Thank you in advance.

    Find My iPhone is good for misplaced iPhone but not good for thief and it was never meant to be.
    You chance of getting it back is very small.
    There are a few things you can try.
    Try remote lock/wipe your iPhone through Find My iPhone.
    https://www.icloud.com
    You can report to the police, cell carrier (expensive cell charges for international calls, roaming etc)
    Change all the passwords used in iPhone: Apple ID, E-mail, Bank Account ....
    http://support.apple.com/kb/HT2526

  • What is the best way to read and manipulate large data in excel files and show them in Sharepoint

    Hi ,
    I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day.
    What is the best way to read the data form the excel file in fastest and most efficient way.
    2 nd Problem,
    I have one excel file that has many rows each row contain some data that has certain keywords.
    What I want is  to segregate the data of rows into respective sheets(tabs ) in the workbook.
    for example in rows have following data 
    1. Alfa
    2beta
    3 gama
    4beta
    5gama
    6gama
    7alfa
    in excel
    I want there to be 3 tabs now with each of the key words alfa beta and gamma.

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Custom Report : What is the best way ?

    Hi!
    My customer doesn't like native TestStand 's report layout. He would prefer something like the example enclosed to this post.
    What is the best way to achieve this ?
    XSL customizing (seems heavy work) ?
    Using the report generation toolkit  and a Word template ?
    Any other idea ?
    Attachments:
    Report Style.JPG ‏115 KB

    Have you examined all of the examples found in the TestStand help:

  • I have an old 30" apple cinema display (2005) I want to use as a 2nd monitor to a new iMac (2012).  I don't just want mirror image of iMac; what's the best way to do this?

    I have not bought the iMac yet but will do so very soon and just want to make sure I have what I need to get everything setup including adding the old faithful 2005 30" cinema display.  Currently I am driving the old 30" cinema display with a macbook pro also purchased 2005 and happy to say I got a lot of good miles out of this rig.  What's the best way to connect the old 30" monitor as a second display for the new generation iMacs?
    Other Questions
    I can find online new in unopened box a 2012 iMac 27" i7 with 1T Fusion Drive for $1899 no sales tax.  This seems like a pretty good deal since I notice the same is available from Apple refurbished for $100 more plus sales tax.  I know that they say the Fusion drive is a lot faster on 2013 models but some of the speed tests I reviewed online showed the 2012 i7 and 2013 i7 very close on speed for both storage and processing.  Any thoughts?
    I don't like changing batteries so I would buy a separate Apple keyboard with numeric pad since it only comes with wireless keyboard.  I'm a trackpad enthusiast having been using my macbook pro trackpad with current set up; and I am prepared to buy the Apple trackpad and replace batteries every 2 months but I would greatly prefer USB connection and rechargeable trackpact.  I know Logitech makes one so if anyone is using and knows how it compares to Apple's I'm all ears. 

    <http://support.apple.com/kb/HT5891>
    You can use USB for the Apple trackpad.
    <http://www.mobeetechnology.com/the-power-bar.html>

  • I am trying to rebuild my iPhoto library and noticed my backup contains aliases (pointers?) and not the actual file. What's the best way to rebuild my library?

    I am trying to rebuild my iPhoto library and noticed my backup contains aliases (pointers?) and not the actual file. What's the best way to rebuild my library?
    Facts:
    In moving to a new iMac, I copied the iPhoto library to an external HDD assuming that I would point the new iMac to the backed up iPhoto Library
    All worked fine when I pointed the new library but noticed that some folders contained aliases and not the original file. So when I attempt to open that photo it can't find it because the alias is pointing to another drive.
    I do have all original photos from a couple of external HDDs. In the folders titled, "Originals" (from older versions of iPhoto) and "Masters" (from current iPhoto)
    I'm thinking I can create a new folder and drop the original files and make that my new iPhoto library. Is there a better way to rebuild my library? I do not want to create any future aliases.
    Thanks in advance for any help!

    do you have a strongly recommended default "managed" library (the iPhoto preference to "copy imported items to the iPhoto library is in its checked state) or a referenced library - you have unchecked that option?
    It sounds like you have a referenced library and are now experiancing one of the very siginificant drawbacks of a referenced library and one of the many reasons they are strongly not recommended
    Also note that iPhoto '11 may use alises in the originals folder as part of the upgrade
    It is important that we understand exactly what you have and what is not sorking - what error messages you are getting
    You must NEVER make any changes of any sort to the structure of content of the iPhoto library - there are no user servicable parts in it  --  and you can not rebuild yoru librtary - only iPhoto ir iPhoto Library Manager - http://www.fatcatsoftware.com/iplm/ -  can rebuild a library unless you are a SQL programmer and understand the structure that iPhoto uses
    LN

  • What is the best way to open emails and attachments without using wifi?

    For I-phone and I-pad, what is the best way to open emails and attachments without using wifi?  I turned off wifi in my settings but my boss thinks there may be another way and a better way to use something else instead of wifi.  Any help would be appreciated!  Thank you!

    Thanks!  That is a very good question you post.  My boss asked me that and I am assuming that he is having issues with using wifi wherever he is at.  My boss is the kind of person that when he asks something you look into it and ask him no questions...he's the only one asking questions!  But thank you for your response I will tell him the information you told me and hopefully that will help!

  • What is the best way to open a HTTPS connection?

    What is the best way to open a HTTPS connection and retrieve the content as XML? This is how most of the online API is done nowadays, how can this be done on the iphone SDK?
    Thanks

    Have a look at the SeismicXML example that comes with the iPhone SDK. It uses http instead of https but it may work for you.
    You can also look at the NSURLRequest and NSURLConnection classes.
    Enjoy.

  • What is the best way to work with Word documents in The InDesign CS4???

    I work in Microsoft Word 2007 and all my documents have *.doc format.
    What is the best way to work with Word documents in InDesign CS4???
    David Blatner says to avoid copying and pasting text from Word instead of placing it (Ctrl+D).
    How about pasting RTF or Text Document???
    I want to make book's layout in ID CS4 and its main feature is that there is the left page with text and the right - with graphics.
    So, as I understand to place the text on each page I must create for example 70 Word documents and place each item on 70 left pages???
    It loks like wasting time. I sthere another way of making such layout???  What kind????

    It's best to place any text.
    You can have all of your text in one file and use auto-flow to add threaded text frames and pages as required (Hold down the Shift key when you click the loaded text cursor), but it's a little non-standard to have the thread only on one side of the spread from the auto-flow perspective, so you'll have to set up properly.
    This is one case where a master text frame will work to your advantage. On your master page spread, add a text frame to the left page, but not to the right (or at least not threaded to one on the right -- for some other project you might actually want two independent text threads). Hold the loaded cursor over a frame on the left side of a document page and auto-flow. ID will add new spreads as necessary, but only put the text on the left side.
    Peter

Maybe you are looking for

  • How do i get my screen size of web sites back to normal size.

    how do i get my screen size of web sites back to normal size.

  • Non-Blocking Server closes his socketChannels on his own (10 dukes)

    Hi, I have created a server using the new nio package. Clients can connect and disconnect as they wish : the client has a GUI with a button "connect" and a button "disconnect". When the client engages a new connection with the server, the ServerSocke

  • Unreadable file error when downloading from Iphone

    I recently updated my Macbook Pro to Mountain Lion OS and iPhoto 11.  Now when I try to import any video or pics I get the "unreadable file" error.  I think it may have to with my system preferences or something because when I try to back up my phone

  • Ovi vers. 3.0.0.284 dosen't locate any of my windo...

    Ovi vers. 3.0.0.284 dosen't locate any of my windows 7 calenders The program says that it need Outlook calender or Windows own calender to work in Ovi so what to do? I have 2 calenders Microsoft Work Calender and Microsoft Windows live calender. I do

  • Why won't certain apps connect?

    Hey everyone, I am unable to install Java on OSX 10.7. I launch the java app under utilities and try to install but it says that there is no connection to the internet and opens network diagnostics. Ichat has the same problem. Safari and most other a