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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:31:15+00:00 2026-06-08T18:31:15+00:00

Hi I have problem with parsing -0.000000e+00 on linux( on windows is working). struct.pack(

  • 0

Hi I have problem with parsing -0.000000e+00 on linux( on windows is working).

struct.pack( "d", -0.000000e+00 )

On linux struct.pack change -0.000000e+00 to 0.000000e+00. When i print value before pack is correct but result of struct.pack is like it was 0.000000e+00.

Is there any solution to solve this problem.

I think i need to add negative number witch is closest to 0. How to do that?

EDIT
struct.pack( "d", -0.000000e+00 ) result ‘\x00\x00\x00\x00\x00\x00\x00\x80’

struct.pack( "!d", -0.000000e+00 )result ‘\x00\x00\x00\x00\x00\x00\x00\x00’

struct.pack( "<d", -0.000000e+00 )result ‘\x00\x00\x00\x00\x00\x00\x00\x00’

struct.pack( ">d", -0.000000e+00 )result ‘\x00\x00\x00\x00\x00\x00\x00\x00’
I want to use “< d” and ” > d”.

EDIT Sry not error.

  • 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-06-08T18:31:16+00:00Added an answer on June 8, 2026 at 6:31 pm

    The struct format string "d" encodes the value in a platform-specific way. Most likely, the platform you decode the bytestring on has a different endianess or length of doubles. Use the ! format character to force a platform-independent encoding:

    >>> struct.pack('!d', -0.)
    b'\x80\x00\x00\x00\x00\x00\x00\x00' # IEEE754 binary64 Big Endian
    >>> struct.unpack('!d', b'\x80\x00\x00\x00\x00\x00\x00\x00')[0]
    -0.0
    

    Also make sure that you use a supported Python version. In cPython<2.5, struct is known to be buggy. Update to a current version, like 2.7 or 3.2.

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

Sidebar

Related Questions

When working through MathLink with slave kernel I have a problem with correct parsing
I have a problem parsing a XML file which contains special characters like ,
I have one problem with parsing *.docx document with OpenXML (C#). So, here's my
Ok, I have a very frustrating problem. I am parsing a webpage and need
I have a problem parsing a stored procedure parameter in the form: declare @S
I have a problem for parsing a rss feed using c#. I used to
I have some problem with JSON parsing. When I hit URL, I've got JSON
I have a very complex parsing problem. Any thoughts would be appreciated here. I
I have a problem related to parsing a SOAP message. This is the message:
I have problem in parsing XML containing gsm packets through my .Net application.I want

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.