Click here to Skip to main content
15,891,657 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Creating a Status Bar in DialogBased Application Pin
David Crow15-Oct-09 3:09
David Crow15-Oct-09 3:09 
QuestionHow to convert real to binary Pin
Aljaz11114-Oct-09 3:09
Aljaz11114-Oct-09 3:09 
AnswerRe: How to convert real to binary Pin
Iain Clarke, Warrior Programmer14-Oct-09 3:22
Iain Clarke, Warrior Programmer14-Oct-09 3:22 
AnswerRe: How to convert real to binary Pin
Cedric Moonen14-Oct-09 4:18
Cedric Moonen14-Oct-09 4:18 
AnswerRe: How to convert real to binary Pin
CPallini14-Oct-09 5:05
mveCPallini14-Oct-09 5:05 
GeneralRe: How to convert real to binary Pin
Aljaz11114-Oct-09 6:26
Aljaz11114-Oct-09 6:26 
GeneralRe: How to convert real to binary Pin
Ozer Karaagac14-Oct-09 15:54
professionalOzer Karaagac14-Oct-09 15:54 
GeneralRe: How to convert real to binary Pin
Luc Pattyn14-Oct-09 16:18
sitebuilderLuc Pattyn14-Oct-09 16:18 
Hi,

the easiest way probably is like this for converting val to (sign,exp,mant):
0. threat special values separately (mainly zero); for others do:
1. sign=0;
2. if (val<0) {sign=1; val=-val;}
3. exp=0;
4. while (val>=1) {exp++; val/=2;}
5. while (val<0.5) {exp--; val*=2;}
6. now val is in [0.5,1); we assume you want M bits for mantissa, then:
7. val*=1<<m;
8. mant="(int)val;" this="" will="" give="" exactly="" m="" bits

possible="" deviations:
-="" the="" exponent="" may="" be="" biased="" (e.g.="" always="" add="" 0x80)
-="" step="" 8="" perform="" rounding="" instead="" of="" truncation
-="" 7="" and="" act="" as="" if="" is="" one="" more,="" then="" drop="" highest="" bit="" (as="" it="" set)

Smile | :) =""

<div="" class="ForumSig">Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages

Local announcement (Antwerp region): Lange Wapper? Neen!


GeneralRe: How to convert real to binary Pin
Patcher3214-Oct-09 17:59
Patcher3214-Oct-09 17:59 
QuestionOpen an associated file using doubleclick while application is running Pin
Erik14-Oct-09 2:22
Erik14-Oct-09 2:22 
QuestionRe: Open an associated file using doubleclick while application is running Pin
David Crow14-Oct-09 2:27
David Crow14-Oct-09 2:27 
AnswerRe: Open an associated file using doubleclick while application is running Pin
Erik14-Oct-09 18:17
Erik14-Oct-09 18:17 
GeneralRe: Open an associated file using doubleclick while application is running Pin
David Crow15-Oct-09 3:07
David Crow15-Oct-09 3:07 
AnswerRe: Open an associated file using doubleclick while application is running Pin
Iain Clarke, Warrior Programmer14-Oct-09 3:31
Iain Clarke, Warrior Programmer14-Oct-09 3:31 
QuestionDisconnection of LAN cable abruptly Pin
nvshree8714-Oct-09 1:49
nvshree8714-Oct-09 1:49 
AnswerRe: Disconnection of LAN cable abruptly Pin
Moak14-Oct-09 9:56
Moak14-Oct-09 9:56 
QuestionChanging Default Icon in MFC Pin
Hari_1614-Oct-09 1:31
Hari_1614-Oct-09 1:31 
AnswerRe: Changing Default Icon in MFC Pin
Game-point14-Oct-09 1:41
Game-point14-Oct-09 1:41 
GeneralRe: Changing Default Icon in MFC Pin
Hari_1614-Oct-09 1:54
Hari_1614-Oct-09 1:54 
AnswerRe: Changing Default Icon in MFC Pin
CPallini14-Oct-09 1:54
mveCPallini14-Oct-09 1:54 
GeneralRe: Changing Default Icon in MFC Pin
Hari_1614-Oct-09 1:59
Hari_1614-Oct-09 1:59 
GeneralRe: Changing Default Icon in MFC Pin
CPallini14-Oct-09 2:12
mveCPallini14-Oct-09 2:12 
GeneralRe: Changing Default Icon in MFC Pin
Hari_1614-Oct-09 2:08
Hari_1614-Oct-09 2:08 
QuestionNetServerDiskEnum Example Pin
Abinash Mohanty14-Oct-09 1:29
Abinash Mohanty14-Oct-09 1:29 
AnswerRe: NetServerDiskEnum Example Pin
Richard MacCutchan14-Oct-09 2:08
mveRichard MacCutchan14-Oct-09 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.