Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

postgres - precision lost when casting on double precision #63

Description

@donhill

I have a table that is using a type of double precision. I am trying to perform a round(cast(column as numeric),2). When I perform this in psql I get the correct results. So 17.1799913573964 becomes 17.18. When I am using the datamapper postgre driver I get the value 0.1718E2. Any thoughts on this. Here is the psql query.

select id, round(cast(distance as numeric),2) miles, distance from (SELECT id, ( 3959 * acos( cos( radians(42.0926245) ) *cos( radians( lat ) ) * cos( radians( lng ) - radians(-88.1152973) ) + sin( radians(42.0926245) ) * sin(radians( lat ) ) ) ) AS distance FROM operator_positions ) position where distance < 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions