Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue - Mailing list pgsql-jdbc

From Andreas Joseph Krogh
Subject Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
Date
Msg-id VisenaEmail.91.1593ba84a90d02a5.17547533c82@tc7-visena
Whole thread Raw
In response to Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
List pgsql-jdbc
På tirsdag 20. oktober 2020 kl. 19:17:54, skrev Tom Lane <tgl@sss.pgh.pa.us>:
Andreas Joseph Krogh <andreas@visena.com> writes:
>  How can this be sane?

If you're expecting exact results from float calculations, you need
a refresher course in what floating-point arithmetic is all about.
 
From a programming perspective - yes, from a DB-client perspective, and in general, no way. In general - "Users" expect "reals" to be just "decimal-numbers", so with this behaviour of float in PG so close to "C-float" there should, IMO, be a big fat warning "Don't use the float datatype, at all" somewhere. Try to tell an accountant that doing calculations with floating-point numbers is crazy, and you should expect the computer to give you wrong answers...
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
Next
From: "David G. Johnston"
Date:
Subject: Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue