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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:16:55+00:00 2026-06-14T13:16:55+00:00

I have a value that I’m passing to a template which is 113.999. When

  • 0

I have a value that I’m passing to a template which is 113.999.

When I do {{ value|floatformat:"-1" }} it outputs 114.0.

View code:
some_var = 113.999

Template code:
{{ some_var|floatformat }}

My understanding of floatformat was that it should round, and then not display the decimal part if it was all zeroes.

Is floatformat wrong, or am I?

  • 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-14T13:16:56+00:00Added an answer on June 14, 2026 at 1:16 pm

    Interesting, by exploring the code, I’ve found that the quantizing happens after the checking of integer. Thus 113.999 is quantized after it is checked against integer and failed.

    IMO, well I’m not an expert of number notation :), 114.0 here represents a rounded-up value and it’s not an originally 114.

    If you really don’t want this behavior, a quick and awkward way is
    {{ value|floatformat|floatformat }}…

    Furthermore, floatformat uses -1 by default, thus {{ value|floatformat }} is enough in your code.

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

Sidebar

Related Questions

Say I have an integer value that I output to a django template say
I have a value that increases by 1 every 5 views. The MySQL table
Problem: I have a value that is set in $record, for instance 1.69. Then
I have an integer value that spans a range so large it is impractical
I have a bool value that I need to display as Yes or No
I have a value __int64 that is a 64-bit FILETIME value. FILETIME has a
I have a TDateTime value (that I get as result from EndOfTheMonth(date) ) to
I'm trying to have a value ( key ) that updates to correspond with
Need some help with DataFormatString in GridView. I have a Double value that needs
I'm creating an abstract class to derive from. I have a Value property that

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.