Bug 150862 - Float values not displayed correctly in hex and decimal formats
Summary: Float values not displayed correctly in hex and decimal formats
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 3.1   Edit
Hardware: All Windows XP
: P3 normal (vote)
Target Milestone: 4.0 M7   Edit
Assignee: Ken Ryall CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-07-17 16:04 EDT by Warren Paul CLA
Modified: 2008-06-20 11:26 EDT (History)
0 users

See Also:


Attachments
patch file (1.52 KB, patch)
2006-07-17 16:05 EDT, Warren Paul CLA
no flags Details | Diff
should replace existing method (1.23 KB, text/plain)
2007-05-04 18:08 EDT, Warren Paul CLA
bjorn.freeman-benson: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Warren Paul CLA 2006-07-17 16:04:26 EDT
Float values not displayed correctly in hex and decimal formats.

The data itself should not be changed.  If you value is 55.55 and you want to display the decimal or hexidecimal representation of that value it should not just convert it to decimal 55.  It should show the decimal or hex value of the underlying 4 bytes of the float.
Comment 1 Warren Paul CLA 2006-07-17 16:05:31 EDT
Created attachment 46393 [details]
patch file
Comment 2 Warren Paul CLA 2007-04-27 12:16:44 EDT
It looks like view as binary has been added since I created the patch.  Adding the following at the end of getFloatValueString() should do the trick:

		else if ( CVariableFormat.BINARY.equals( format ) ) {
			StringBuffer sb = new StringBuffer( "0b" ); //$NON-NLS-1$
			String stringValue = Long.toBinaryString( longValue );
			sb.append( (stringValue.length() > 32) ? stringValue.substring( stringValue.length() - 32 ) : stringValue );
			return sb.toString();
		}

Comment 3 Ken Ryall CLA 2007-05-04 17:19:37 EDT
Warren, could you generate this patch again against the HEAD sources. It is close but doesn't apply cleanly and I want to make sure I get it right.
Comment 4 Warren Paul CLA 2007-05-04 18:07:10 EDT
Hmm, having trouble creating a patch.  The changes are isolated to one method.  Just replace the getFloatValueString method with the one attached.

Comment 5 Warren Paul CLA 2007-05-04 18:08:07 EDT
Created attachment 65972 [details]
should replace existing method
Comment 6 Ken Ryall CLA 2007-05-05 11:02:10 EDT
Got it, committed patch to HEAD.