• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:26
CET 05:26
KST 13:26
  • 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
[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy7ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289
Community News
Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool48Weekly Cups (March 9-15): herO, Clem, ByuN win42026 KungFu Cup Announcement6BGE Stara Zagora 2026 cancelled12
StarCraft 2
General
Potential Updates Coming to the SC2 CN Server What mix of new & old maps do you want in the next ladder pool? (SC2) Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Weekly Cups (March 16-22): herO doubles, Cure surprises Weekly Cups (August 25-31): Clem's Last Straw?
Tourneys
WardiTV Mondays Sparkling Tuna Cup - Weekly Open Tournament World University TeamLeague (500$+) | Signups Open RSL Season 4 announced for March-April WardiTV Team League Season 10
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
The PondCast: SC2 News & Results Mutation # 518 Radiation Zone Mutation # 517 Distant Threat Mutation # 516 Specter of Death
Brood War
General
mca64Launcher - New Version with StarCraft: Remast RepMastered™: replay sharing and analyzer site BGH Auto Balance -> http://bghmmr.eu/ Gypsy to Korea Soulkey's decision to leave C9
Tourneys
[ASL21] Ro24 Group B [ASL21] Ro24 Group C Small VOD Thread 2.0 [Megathread] Daily Proleagues
Strategy
What's the deal with APM & what's its true value Fighting Spirit mining rates Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Darkest Dungeon Nintendo Switch Thread Stormgate/Frost Giant Megathread General RTS Discussion Thread Path of Exile
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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
TL Mafia Community Thread Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Canadian Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books Movie Discussion! [Manga] One Piece
Sports
Cricket [SPORT] 2024 - 2026 Football Thread Formula 1 Discussion Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2567 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
Replay Cast
00:00
Korean StarCraft League #87
LiquipediaDiscussion
OSC
18:00
OSC Elite Rising Star #18
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 94
StarCraft: Brood War
GuemChi 5638
Zeus 4761
yabsab 19
Noble 9
ZergMaN 8
Icarus 7
Dota 2
LuMiX1
League of Legends
JimRising 647
Counter-Strike
tarik_tv3437
Stewie2K628
Other Games
summit1g8320
WinterStarcraft407
C9.Mang0299
Organizations
Other Games
BasetradeTV118
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Hupsaiya 78
• practicex 21
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• Scarra846
Upcoming Events
WardiTV Team League
7h 34m
Big Brain Bouts
12h 34m
Fjant vs SortOf
YoungYakov vs Krystianer
Reynor vs HeRoMaRinE
RSL Revival
1d 5h
Cure vs Zoun
herO vs Rogue
WardiTV Team League
1d 7h
Platinum Heroes Events
1d 10h
BSL
1d 15h
RSL Revival
2 days
ByuN vs Maru
MaxPax vs TriGGeR
WardiTV Team League
2 days
BSL
2 days
Replay Cast
2 days
[ Show More ]
Replay Cast
3 days
Afreeca Starleague
3 days
Light vs Calm
Royal vs Mind
Wardi Open
3 days
Monday Night Weeklies
3 days
OSC
3 days
Sparkling Tuna Cup
4 days
Afreeca Starleague
4 days
Rush vs PianO
Flash vs Speed
Replay Cast
5 days
Afreeca Starleague
5 days
BeSt vs Leta
Queen vs Jaedong
Replay Cast
5 days
The PondCast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

KCM Race Survival 2026 Season 1
WardiTV Winter 2026
Underdog Cup #3

Ongoing

BSL Season 22
CSL Elite League 2026
CSL Season 20: Qualifier 1
ASL Season 21
Acropolis #4 - TS6
RSL Revival: Season 4
Nations Cup 2026
NationLESS Cup
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

2026 Changsha Offline CUP
CSL Season 20: Qualifier 2
CSL 2026 SPRING (S20)
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
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.