Python <2.7

"%.15g" % f

Or in Python 3.0:

format(f, ".15g")

Python 2.7+, 3.2+

Just pass the float to Decimal constructor directly, like this:

from decimal import Decimal
Decimal(f)
Answer from jfs on Stack Overflow
๐ŸŒ
VisibleEarth
h-schmidt.net โ€บ FloatConverter โ€บ IEEE754.html
IEEE-754 Floating Point Converter
This page allows you to convert between the decimal representation of a number (like "1.02") and the binary format used by all modern CPUs (a.k.a. "IEEE 754 floating point").
๐ŸŒ
Cornell University
cs.cornell.edu โ€บ ~tomf โ€บ notes โ€บ cps104 โ€บ floating
Floating Point
This document explains the IEEE 754 floating-point standard. It explains the binary representation of these numbers, how to convert to decimal from floating point, how to convert from floating point to decimal, discusses special cases in floating point, and finally ends with some C code to ...
Discussions

floating point - C# float to decimal conversion - Stack Overflow
Any smart way to convert a float like this: float f = 711989.98f; into a decimal (or double) without losing precision? I've tried: decimal d = (decimal)f; decimal d1 = (decimal)(Math.Round(f,2)); More on stackoverflow.com
๐ŸŒ stackoverflow.com
floating point - C# How to convert between Float and Decimal? - Stack Overflow
I want to use a NumberUpDownBox to get and set a float value. All I Know is that this doesn't work: DecimalConverter dec = new DecimalConverter(); ((NumericUpDown)_control).Value = (Decimal)dec. More on stackoverflow.com
๐ŸŒ stackoverflow.com
How do you convert from IEEE 754 Floating Point to decimal without using a calculator?
There arent any decimals in the IEEE 754 standard so you'll have to clarify what you mean. More on reddit.com
๐ŸŒ r/askmath
5
1
May 1, 2019
convert an int to a float while preserving the float's original ending decimal value
You could do something using modff() . Also, your current implementation doesn't work properly when floatTest and intTest have different signs. More on reddit.com
๐ŸŒ r/C_Programming
40
7
July 18, 2017
People also ask

How do I convert a number to floating-point?

To convert a decimal number to a floating-point representation, follow these steps:

  1. Convert the entire number to binary and then normalize it, i.e. write it in scientific notation using base 2.
  2. Truncate the fraction after the decimal point to the allowable fraction length.
  3. Extract the sign, exponent, and fraction segments.

Refer to the IEEE754 standard for more detailed instructions.

๐ŸŒ
omnicalculator.com
omnicalculator.com โ€บ other โ€บ floating-point
Floating-Point Calculator
What is an IEEE754 floating-point number?

In computing, a floating-point number is a data format used to store fractional numbers in a digital machine. A floating-point number is represented by a series of bits (1s and 0s). Computers perform mathematical operations on these bits directly instead of how a human would do the math. When a human wants to read the floating-point number, a complex formula reconstructs the bits into the decimal system.

๐ŸŒ
omnicalculator.com
omnicalculator.com โ€บ other โ€บ floating-point
Floating-Point Calculator
Why do we use floating-point numbers?

The IEEE754 floating-point format standard enables efficient storage and processing of numbers in computers.

  • From a hardware perspective, many simplifications of floating-point operations can be made to significantly speed up arithmetic, thanks to the IEEE754 standard's specifications.

  • For software, floats are very precise and typically lose a few millionths (if not less) per operation, which enables high-precision scientific and engineering applications.

๐ŸŒ
omnicalculator.com
omnicalculator.com โ€บ other โ€บ floating-point
Floating-Point Calculator
๐ŸŒ
Numeral-systems
numeral-systems.com โ€บ ieee-754-converter
IEEE-754 floating point numbers converter
A binary floating point number in IEEE-754 format can be converted to a decimal number using the following steps:
๐ŸŒ
Baseconvert
baseconvert.com โ€บ ieee-754-floating-point
IEEE 754 Floating Point Converter - Base Convert
Online number base converter for binary, hexadecimal, octal, decimal, roman numerals, balanced ternary, negabinary, factorial, bijective, and any radix. Supports high precision and fractional values.
Find elsewhere
๐ŸŒ
Modbuskit
modbuskit.com โ€บ en โ€บ data-converter
Hex Converter: Hex to Decimal & IEEE 754 | ModbusKit
Convert 16-, 32- and 64-bit numbers, inspect IEEE 754 float bytes, and compare Modbus register byte orders.
๐ŸŒ
YouTube
youtube.com โ€บ ee prof lady
How to Convert Floating Point Binary Numbers to Decimal - YouTube
Learn how to convert fractional (floating point) numbers like 23.454 to decimal from the Digital Design course
Published: August 27, 2020
Views: 3K
๐ŸŒ
YouTube
youtube.com โ€บ abishalini sivaraman
IEEE 754 Floating Point Representation to its Decimal Equivalent - YouTube
This is a video for ECEN 350 - Computer Architecture at Texas A&M University.
Published: December 4, 2016
Views: 218K
๐ŸŒ
Omni Calculator
omnicalculator.com โ€บ other โ€บ floating-point
Floating-Point Calculator
February 22, 2022 - If you want to convert the binary encoding of a floating-point number to the decimal number it represents, select floating-point to number at the top of the calculator.
๐ŸŒ
Christophervickery
christophervickery.com โ€บ IEEE-754 โ€บ IEEE-754.old โ€บ 32bit.html
IEEE-754 Floating-Point Conversion from 32-bit Hexadecimal to Floating-Point
From 32-bit Hexadecimal Representation To Decimal Floating-Point Along with the Equivalent 64-bit Hexadecimal and Binary Patterns ยท [ Convert IEEE-754 64-bit Hexadecimal Representations to Decimal Floating-Point Numbers. ] [ Convert Decimal Floating-Point Numbers to IEEE-754 Hexadecimal ...
๐ŸŒ
Stanford University
web.stanford.edu โ€บ class โ€บ cs107 โ€บ float
CS107 Floating point converter
This web page converts between binary and decimal numbers. For example, it will convert a binary number in the form of yyy.xxxxxxxxxxxxxxxxxxxxxxx to its decimal equivalent.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-convert-a-single-precision-binary-float-to-decimal
How to convert a single-precision binary float to decimal
A single-precision binary float is represented using 32-bits. These bits are divided into three sections to represent the sign, exponent, and fractional parts of a decimal number (according to the IEEE 754 standard).
๐ŸŒ
Binary Convert
binaryconvert.com โ€บ convert_float.html
Float (IEEE754 Single precision 32-bit) Converter
Online binary converter. Supports all types of variables, including single and double precision IEEE754 numbers
๐ŸŒ
Exploring Binary
exploringbinary.com โ€บ home โ€บ decimal to floating-point converter
Decimal to Floating-Point Converter - Exploring Binary
June 1, 2018 - Essentially, you can enter what a computer program accepts as a floating-point literal, except without any suffix (like โ€˜fโ€™). Check the boxes for the IEEE precision you want; choose Double, Single, or both. (Double is the default.) Double means a 53-bit significand (less if subnormal) with an 11-bit exponent; Single means a 24-bit significand (less if subnormal) with an 8-bit exponent. Check the boxes for any output format you want; choose one or all ten. (Decimal is the default.) Click โ€˜Convertโ€™ to convert.
๐ŸŒ
Schneider Electric
se.com โ€บ support โ€บ search faqs โ€บ fa311427
How to convert the Float 32 Format to decimal. | Schneider Electric USA
December 11, 2024 - So, to start with convert the values separately in both the registers to Hexadecimal. Now, use the below link and use the value in the registers in ascending next to each โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ ยท https://www.h-schmidt.net/FloatConverter/IEEE754.html Below is an example of the process: For Registers, 3000 - 5EF3 3001 - 4323 Input the hexadecimal box of the link as 5EF34323 to get the exact decimal values.