Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6122223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:52:25+00:00 2026-05-23T15:52:25+00:00

I am working on a tool which generated a few thousand ASCII files (constraints),

  • 0

I am working on a tool which generated a few thousand ASCII files (constraints), the contents of which include floating point numbers. I would like to run these constraints for comparison through an similar tool, which cannot handle floating point values with more than 20 decimal places. Testing manually indicates that simple truncation will suffice. So, how can I truncate all floating point values in a file (which are uniquely marked by a period) to no more than 20 decimal places?

Thanks,

Jon

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:52:26+00:00Added an answer on May 23, 2026 at 3:52 pm

    I know for sure in Java and C (and almost certainly in other languages) there are ways to format strings. String.format() and printf() are some good examples. These can be used for case by doing something like:

    printf("%.20f", myFloat); 
    

    I’ll find a website with better instructions in a second.

    edit:

    this should probably be a good enough link to get an idea:

    http://www.cplusplus.com/reference/clibrary/cstdio/printf/

    edit:

    if you would like to use sed, a quick search makes it seem as though sed has a printf function too. the example I found is here:

    http://docstore.mik.ua/orelly/unix/sedawk/ch07_09.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a tool which would need to communitacte: send and recieve files
I'm working on a rapid prototyping tool for which I would like to dynamically
I am currently working on some LaTeX document which embeds C# files generated by
I am working on a tool which is built using jdk 1.5u22. But, I
I'm working on a small memory tool which tracks allocations and deallocations, object sizes,
I'm working on a tool which connects to a SQL Database, gets back a
I'm working a WinForms based C# tool which has an attached MDF file based
I have a pptx file, complete with working links which i would now like
I'm working on an ASP.NET project that contains a few hundreds of ASPX/ASCX files,
I'm working on a project for school, and I'm implementing a tool which can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.