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 6161819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:32:33+00:00 2026-05-23T21:32:33+00:00

I have a very strange issue with GZIPOutputStream when compressing an array of doubles.

  • 0

I have a very strange issue with GZIPOutputStream when compressing an array of doubles. At the 57th element, I get a small discrepancy when I reload the data:

57 > 3.003727492141554E7 3.0037273913440887E7
1900: false
57 > -6.110783629228158E7 -6.110783629076558E7
2000: false

1900 and 2000 are two different set of doubles. The left value is the original value.

When I use a simple FileOutputStream without GZIP, I don’t get the issue. Why? Is GZIP output stream known to loose information?

EDIT

Here is how I read and write the data:

public static final double[] coefficients = new double[1161289];

...

public static void dump(File f) throws FileNotFoundException, IOException {

    OutputStream os = FileUtils.zipContent(f);

    byte[] ba = new byte[8];
    ByteBuffer BF = ByteBuffer.wrap(ba);
    BF.order(ByteOrder.BIG_ENDIAN);

    for (int i=0;i<coefficients.length;i++) {
        BF.putDouble(0, coefficients[i]);
        os.write(ba,0,8);
    }

    os.close();

}

public static void load(File f) throws FileNotFoundException, IOException {

    InputStream is = FileUtils.readZippedContent(f);

    byte[] ba = new byte[8];
    final ByteBuffer BF = ByteBuffer.wrap(ba);
    BF.order(ByteOrder.BIG_ENDIAN);

    for (int i=0;i<coefficients.length;i++) {
        is.read(ba,0,8);
        coefficients[i] = BF.getDouble(0);
    }

}

...

public static GZIPOutputStream zipContent(File f)
        throws FileNotFoundException, IOException {

    return new GZIPOutputStream(new FileOutputStream(f));

}

public static GZIPInputStream readZippedContent(File f)
        throws FileNotFoundException, IOException {

    return new GZIPInputStream(new FileInputStream(f));

}
  • 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-23T21:32:34+00:00Added an answer on May 23, 2026 at 9:32 pm

    gzip is lossless compression. any missing data would have to be accounted for by some other problem.

    if the 57th element is the final element, I’d suspect failure to close the output file before re-opening for reading.

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

Sidebar

Related Questions

I have a very strange issue on my hands. I have two IIS websites
I have a very strange issue that I'm hoping someone can help me with.
I have this very strange issue with my MVC 2 project. Often times, I'll
I have encountered a very strange issue. Whenever I use the .NET membership provider
I have come across a very strange issue in python. (Using python 2.4.x) In
I have ran into a very strange issue with Google Maps in Chrome 5.0.375.99:
Very strange issue... I have something like this in my Controller: public ActionResult Initialize(IEnumerable<MyModel>
Having a very strange issue regarding postback in ASP.NET. I have page dynamically populating
I have a very strange issue with Daylight Savings Time (DST) in my app.
I have very strange issue. In my WP7 app I have a pivot control

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.