• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:29
CET 18:29
KST 02:29
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
ByuL: The Forgotten Master of ZvT29Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
BSL Season 223Vitality ends partnership with ONSYDE20Team Liquid Map Contest - Preparation Notice6Weekly Cups (Feb 23-Mar 1): herO doubles, 2v2 bonanza2Weekly Cups (Feb 16-22): MaxPax doubles0
StarCraft 2
General
Weekly Cups (Feb 23-Mar 1): herO doubles, 2v2 bonanza GSL CK - new tournament Vitality ends partnership with ONSYDE How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Team Liquid Map Contest - Preparation Notice
Tourneys
RSL Season 4 announced for March-April Sparkling Tuna Cup - Weekly Open Tournament PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) $5,000 WardiTV Winter Championship 2026 Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 516 Specter of Death Mutation # 515 Together Forever Mutation # 514 Ulnar New Year
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ battle.net problems ASL21 General Discussion BSL Season 22 BSL 22 Map Contest — Submissions OPEN to March 10
Tourneys
[Megathread] Daily Proleagues ASL Season 21 Qualifiers March 7-8 BWCL Season 64 Announcement [BSL22] Open Qualifier #1 - Sunday 21:00 CET
Strategy
Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Simple Questions, Simple Answers Zealot bombing is no longer popular?
Other Games
General Games
Nintendo Switch Thread PC Games Sales Thread Path of Exile No Man's Sky (PS4 and PC) Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Mexico's Drug War Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Anime Discussion Thread
Sports
2024 - 2026 Football Thread Cricket [SPORT] Formula 1 Discussion TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Gaming-Related Deaths
TrAiDoS
ONE GREAT AMERICAN MARINE…
XenOsky
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2424 users

Ah! Floating point help!!

Blogs > Raithed
Post a Reply
Raithed
Profile Blog Joined May 2007
China7078 Posts
Last Edited: 2007-11-14 03:42:28
November 14 2007 03:42 GMT
#1
anyone have ideas on floating points? i missed class today and found out i had homework. i googled floating points and read through it, and i dont quite understand it. even though the homework gives answer, i want to know how the answer is derived from it?

3.14 for example.

the floating point would be 3? i know how to convert that to binary, and that to hex, but i have no idea how floating point works, someone give me a clue?


something like this, thats one of the sites the homework gave. http://babbage.cs.qc.edu/IEEE-754/Decimal.html but i want to know how it works.

"convert 3.14159265 to 32bit FP"


Help?!

Meta
Profile Blog Joined June 2003
United States6225 Posts
November 14 2007 04:51 GMT
#2
umm i was in the understanding that floating point numbers are numbers with decimal places. the float of 3.14 is 3.14. if you convert that to an integer, then you'd get 3. i'm not sure how to convert floating points into binary/hex though.
good vibes only
HeadBangaa
Profile Blog Joined July 2004
United States6512 Posts
Last Edited: 2007-11-14 05:51:01
November 14 2007 05:07 GMT
#3
Floating point numbers are stored in a special way in binary. The implementation is dependent on the CPU, but the most common is IEEE 754. Your class is probably only gonna make you handle single-precision floats, which are 32-bits in length.

Oooh, I found this for ya. Really good:
http://en.wikipedia.org/wiki/IEEE_754

Skip to the "Single Precision" section and start reading.
Do some sample problems using the algorithm detailed there. Use this website to cross-check your answers:
http://www.h-schmidt.net/FloatApplet/IEEE754.html

Once you get the bit representation, you convert to hex/octal/whatever in the usual way.
Also, most FP numbers can't be represented in just 32-bits, so the rounding of the mantissa is conventionally performed (this is why you get rounding-warnings from your compiler when you're not careful with numerical types/casts).
People who fail to distinguish Socratic Method from malicious trolling are sadly stupid and not worth a response.
Raithed
Profile Blog Joined May 2007
China7078 Posts
November 14 2007 05:36 GMT
#4
Oh man, this is intense, INTENSE, alrighty. >_<
HeadBangaa
Profile Blog Joined July 2004
United States6512 Posts
Last Edited: 2007-11-14 07:26:59
November 14 2007 07:22 GMT
#5
Per PM request:

OK, so there's 3 sections:

The (s)ign = 1-bit
THe (e)xponent = 8-bits
The (m)antissa = 23-bits

total = 32-bits

v = 3.14159265
where:
v = s * 2^e * m

OK, let's rock:

-The sign bit is easy: 0 (because positive number)
-Now write out the number in UNSIGNED, NON-TWOS COMPLEMENT:
11.001001xxxx


The "11." part is easy; it's just '3' in binary, and the decimal sign tagged on the end.
FOr the righthand part, I use the result in each step for 2 things:
a) the MSB of the result is the next-bit you write down
b) the fraction of the result (behind the decimal) is used in the next step.

Start with original number's fractional part:

0.14159265 x 2 = 0.2831853 (fraction-bit #1 = 0)
0.2831853 x 2 = 0.5663706 (fraction-bit #2 = 0)
0.5663706 x 2 = 1.1327412 ("" = 1)
0.1327412 x 2 = 0.2654824 ("" = 0)
0.2654824 x 2 = 0.5309648 ("" = 0)
0.5309648 x 2 = 1.0619296 ("" = 1)
(keep going until you get all zeros in the decimal, or until you've populated 23-bits).


And that's how I get: .001001xxxx (tediously 23-bits long, you finish it) and together, we have 11.001001xxxx

Now you "normalize" your result by moving the decimal such that only a single "1" is to its left:
11.001001xxxx = 1.1001001xxxx * 2^1 (shift amount = 1)

OK, now add the bias to the shift-amount:
1 + 127 = 128 = 10000000

Now mash everything together:
[s][exponent][mantissa] = 1 10000000 1001001xxxx

ba-zing!
People who fail to distinguish Socratic Method from malicious trolling are sadly stupid and not worth a response.
Deleted User 31996
Profile Blog Joined October 2007
843 Posts
November 21 2007 00:11 GMT
#6
haha i remeber FP conversions back when i did microcontrollers, learning the conversion is the kind of thing you learn once before the exam, then forget for the rest of your life
Raithed
Profile Blog Joined May 2007
China7078 Posts
November 21 2007 05:32 GMT
#7
Yeah! We're using them for microcontrollers/MP's.
Please log in or register to reply.
Live Events Refresh
Monday Night Weeklies
17:00
#43
TKL 191
BRAT_OK 63
IndyStarCraft 40
SteadfastSC1
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 254
TKL 191
BRAT_OK 63
IndyStarCraft 40
MaxPax 8
SteadfastSC 1
JuggernautJason1
StarCraft: Brood War
Sea 35402
Calm 3379
Horang2 523
Dewaltoss 173
Free 158
Rock 35
Barracks 22
Killer 20
Shine 14
Hm[arnc] 14
Dota 2
Gorgc7239
qojqva1955
monkeys_forever106
Counter-Strike
fl0m3337
olofmeister2664
pashabiceps55
adren_tv32
Heroes of the Storm
MindelVK15
Other Games
singsing1918
FrodaN1297
B2W.Neo995
Grubby852
Liquid`RaSZi529
Liquid`VortiX194
Beastyqt184
ArmadaUGS125
Hui .100
QueenE86
Trikslyr54
C9.Mang032
Organizations
Dota 2
PGL Dota 2 - Main Stream13970
PGL Dota 2 - Secondary Stream5456
Other Games
gamesdonequick1804
BasetradeTV164
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis4592
• TFBlade942
• Shiphtur214
Other Games
• imaqtpie461
Upcoming Events
OSC
6h 31m
Wardi Open
18h 31m
PiGosaur Monday
1d 6h
WardiTV Team League
1d 18h
Replay Cast
2 days
The PondCast
2 days
WardiTV Team League
2 days
Replay Cast
3 days
Replay Cast
4 days
CranKy Ducklings
4 days
[ Show More ]
WardiTV Team League
4 days
Replay Cast
5 days
Sparkling Tuna Cup
5 days
WardiTV Team League
5 days
Replay Cast
6 days
Replay Cast
6 days
Wardi Open
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

ASL Season 21: Qualifier #2
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
Spring Cup 2026
BSL Season 22
RSL Revival: Season 4
Nations Cup 2026
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

ASL Season 21
Acropolis #4 - TS6
Acropolis #4
IPSL Spring 2026
CSLAN 4
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
NationLESS Cup
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.