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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:07:55+00:00 2026-06-06T09:07:55+00:00

I have a Client program by tcp connection that send data to a server.

  • 0

I have a Client program by tcp connection that send data to a server.
In client I need send a normalized decimal number to server for normalization I Multiplier decimal number to 100,000 then send it to server but I get wrong number in server.
for example.

double price;

I set it from Gui to 74.40

cout<<price; ---> 74.40

and when I serial my object I send

#define Normal 100000
int tmp = price*Normal;
oDest<<tmp;

In wireshrk I see that client sent 7439999.

why this happened? how I can pervent this problem?

  • 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-06T09:07:56+00:00Added an answer on June 6, 2026 at 9:07 am

    Don’t store anything as a floating point value. Use a rational number instead, or use a fixed point value. Floating point values (like double) basically “cheat” in order to fix a large range of possible values into a reasonable chunk of memory, and they have to make compromises in order to do so.

    If you are storing a financial value, consider storing pennies or cents or whatever is the smallest denomination.

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

Sidebar

Related Questions

I have a client/server program in TCP written in C, and I would like
In sockets I have written the client server program. First I tried to send
I have a program which monitors a TCP connection for any data and fires
I have a tcp client - server implementation running in the same program, on
I have a small server program that accepts connections on a TCP or local
I have a C/S program. Client use socket to send a file to server,
I have been working on a (relatively) simple tcp client/server chat program for my
I have a client program written in .NET 2.0, that connects to the web
I have a client program that consumes a web service. It works quite well
I have written an ActionScript client program that tries to connect to a local

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.