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

  • Home
  • SEARCH
  • 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 268203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:39:57+00:00 2026-05-11T23:39:57+00:00

I try to store the PHP floating point value 63.59072952118762 into a double precision

  • 0

I try to store the PHP floating point value 63.59072952118762 into a double precision column in postgres. Postgres stores the value as 63.59073. Does anyone know why? 8 byte should be more than enough for that value. I’ve tried with the data type numeric, which works when specifying the precision, but that shouldn’t really be necessary.

Update: The same problem is present when trying to store 63.5907295, so the suggestion that something happens with the double before it’s getting stored seems realistic.

Update II (partly solved): The line where I assign the double parameter looks like this:

$stmt->bindParam(4, $this->latitude);

The thing I didn’t know is that PDO defaults its param type to string. I changed it to PDO::PARAM INT in lack of a better alternative (PARAM DOUBLE was not an option), and got 10 digits precision in the double stored in postgres (some progress, at least). I’ve checked that the numeric type works well, so it seems that numeric is the way to go when using PDO and doubles that has to have a precision of more than 10 decimals.

Anyways, as someone has mentioned, I don’t know if it’s a must for me to have this kind of precision, but I think the problem in itself deserved to be investigated.

  • 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-11T23:39:58+00:00Added an answer on May 11, 2026 at 11:39 pm
    • How do you determine what PostgreSQL is storing?
    • How do you send the data to PostgreSQL?
    • How do you get the data back again?
    • How do you display it?
    • What type is the column in the database?

    There are many, many places on the path between PHP and PostgreSQL where there could be confusion about how to represent the data.


    It is important to explain how data is inserted into the DBMS. Using a literal value in the INSERT statement leads to a different set of problems from using bound parameters. If you wrote the value out in the SQL:

    INSERT INTO SomeTable(SomeColumn) VALUES(63.xxxxxxxxx);
    

    and the data was truncated, you’d have a problem down in PostgreSQL. If you bind the variable, you have to be sure to understand what PHP and the PDO PostgresSQL modules do with the value – is it sent as a double, or as a string, and which code deals with the conversion, and so on.

    You run into analogous issues with Perl + DBI + DBD::YourDBMS (DBD::Pg in your case).

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

Sidebar

Ask A Question

Stats

  • Questions 141k
  • Answers 141k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's a shallow copy. A deep copy of the data… May 12, 2026 at 8:10 am
  • Editorial Team
    Editorial Team added an answer The problem is that your PhoneNumber.TryParse() call is getting translated… May 12, 2026 at 8:10 am
  • Editorial Team
    Editorial Team added an answer i think you can get around this by updating the… May 12, 2026 at 8:10 am

Related Questions

I am developing a PHP-based login system. Each user has an ID(a number) and
I was asked to implement a random product listing for an osCommerce on-line store.
Need some help about with Memcache. I have created a class and want to
I have an API that is dependent on certain state information between requests. As

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.