<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck" -->

---
title: All Your GUCs in a Row: extra_float_digits | daily.dev
description: PostgreSQL's `extra_float_digits` GUC parameter controls how floating-point values are rendered as text. Before PostgreSQL 12, users had to choose between...
canonical: https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: All Your GUCs in a Row: extra_float_digits | daily.dev
og:description: PostgreSQL's `extra_float_digits` GUC parameter controls how floating-point values are rendered as text. Before PostgreSQL 12, users had to choose between...
og:url: https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck
og:image: https://api.daily.dev/og/posts/xFMHD6Yck.png
og:image:alt: All Your GUCs in a Row: extra_float_digits
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# All Your GUCs in a Row: extra_float_digits

**[Planet PostgreSQL](https://daily.dev/sources/planet-postgresql)** · 3 min read · 6 upvotes · 1 comments

## Summary

PostgreSQL's `extra_float_digits` GUC parameter controls how floating-point values are rendered as text. Before PostgreSQL 12, users had to choose between readable output and bit-exact round-tripping by setting the parameter to 3. Since PostgreSQL 12, the default value of 1 uses a shortest-decimal algorithm that is both human-readable and exactly round-trips — so `0.1` prints as `0.1` and reads back to the identical binary value. Values 1, 2, and 3 are now equivalent; 0 restores the old rounded behavior. The old advice to set it to 3 is now a compatibility habit, not a requirement. Importantly, this parameter only affects rendering, not storage precision — for exact decimal arithmetic (e.g., money), use the `numeric` type instead.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://postgr.es/p/9q1>

## Questions this post answers

### What does the extra_float_digits setting do in PostgreSQL and what should I set it to?

It controls how many digits PostgreSQL prints for float4 and float8 values, and the default of 1 (since PostgreSQL 12) should generally be left alone. PostgreSQL 12 rewrote float output to always compute the shortest decimal string that round-trips exactly to the stored binary value, so values of 1, 2, and 3 now all produce identical, exact output. Only set it to 0 for old rounded output, or 3 when matching pre-12 server behavior.

_Track PostgreSQL configuration changes like this on daily.dev before they surprise you in production._

### Why does pg_dump still explicitly set extra_float_digits to 3?

pg_dump sets extra_float_digits to 3 to guarantee restores reproduce floating-point values to the exact bit, regardless of what the server's configured default is. Since PostgreSQL 12, this value behaves identically to the default of 1 because both now produce the shortest round-tripping decimal string, but pg_dump keeps the explicit setting for exactness across all server versions.

_daily.dev helps engineers keep dump and restore behavior straight across PostgreSQL versions._

### Why does increasing extra_float_digits not fix rounding errors in money calculations stored as double precision?

Because extra_float_digits only changes how a float is printed, not how it is stored or computed; a double precision value simply cannot represent 0.1 exactly no matter how many digits are displayed. Exact decimal arithmetic, such as for money, requires the numeric type, which stores values exactly and computes on them exactly at the cost of speed.

_daily.dev surfaces practical guidance like this for developers choosing numeric types for financial data._

## Similar posts on daily.dev

- [All Your GUCs in a Row: integer\_datetimes](https://daily.dev/posts/all-your-gucs-in-a-row-integer-datetimes-nobisozqu) · Planet PostgreSQL · 1 upvotes · 1 comments
- [All Your GUCs in a Row: cursor\_tuple\_fraction](https://daily.dev/posts/all-your-gucs-in-a-row-cursor-tuple-fraction-3ucl8qhmc) · Planet PostgreSQL · 0 upvotes · 0 comments
- [Simplifying Schema Design with DECFLOAT: One Numeric Type to Rule Them All](https://daily.dev/posts/simplifying-schema-design-with-decfloat-one-numeric-type-to-rule-them-all-0ur2odeqk) · Snowflake Community · 0 upvotes · 0 comments
- [Why Ruby’s Issue Tracker Still Links to a 1991 Paper About Floating-Point Numbers](https://daily.dev/posts/why-ruby-s-issue-tracker-still-links-to-a-1991-paper-about-floating-point-numbers-vijgzx189) · RUBYLAND · 1 upvotes · 1 comments
- [All Your GUCs in a Row: gin\_fuzzy\_search\_limit](https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr) · Planet PostgreSQL · 1 upvotes · 2 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"All Your GUCs in a Row: extra_float_digits","url":"https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck"},"datePublished":"2026-07-20T01:01:37.754Z","dateModified":"2026-09-14T06:13:16.433Z","description":"PostgreSQL's `extra_float_digits` GUC parameter controls how floating-point values are rendered as text. Before PostgreSQL 12, users had to choose between...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1d11c3faf161b97b4319fb0b16a62e43?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1d11c3faf161b97b4319fb0b16a62e43?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet PostgreSQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet PostgreSQL","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/planet-postgresql"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":6},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"general-programming,postgresql","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet PostgreSQL","item":"https://daily.dev/sources/planet-postgresql"},{"@type":"ListItem","position":3,"name":"All Your GUCs in a Row: extra_float_digits"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/all-your-gucs-in-a-row-extra-float-digits-xfmhd6yck#faq","mainEntity":[{"@type":"Question","name":"What does the extra_float_digits setting do in PostgreSQL and what should I set it to?","acceptedAnswer":{"@type":"Answer","text":"It controls how many digits PostgreSQL prints for float4 and float8 values, and the default of 1 (since PostgreSQL 12) should generally be left alone. PostgreSQL 12 rewrote float output to always compute the shortest decimal string that round-trips exactly to the stored binary value, so values of 1, 2, and 3 now all produce identical, exact output. Only set it to 0 for old rounded output, or 3 when matching pre-12 server behavior. Track PostgreSQL configuration changes like this on daily.dev before they surprise you in production."}},{"@type":"Question","name":"Why does pg_dump still explicitly set extra_float_digits to 3?","acceptedAnswer":{"@type":"Answer","text":"pg_dump sets extra_float_digits to 3 to guarantee restores reproduce floating-point values to the exact bit, regardless of what the server's configured default is. Since PostgreSQL 12, this value behaves identically to the default of 1 because both now produce the shortest round-tripping decimal string, but pg_dump keeps the explicit setting for exactness across all server versions. daily.dev helps engineers keep dump and restore behavior straight across PostgreSQL versions."}},{"@type":"Question","name":"Why does increasing extra_float_digits not fix rounding errors in money calculations stored as double precision?","acceptedAnswer":{"@type":"Answer","text":"Because extra_float_digits only changes how a float is printed, not how it is stored or computed; a double precision value simply cannot represent 0.1 exactly no matter how many digits are displayed. Exact decimal arithmetic, such as for money, requires the numeric type, which stores values exactly and computes on them exactly at the cost of speed. daily.dev surfaces practical guidance like this for developers choosing numeric types for financial data."}}]}
```

