ieee754_32.m ( File view )

Description: The
  • By Bluffer 2013-09-30
  • View(s):41
  • Download(s):0
  • Point(s): 1
			function [sign] = ieee754_32(in)
% val = ieee754_32(in) returns 32 bit value.

if ~isreal(in) || numel(in) > 1 || ~isa(in,'double')
  error('Input Format not Supported')
end
val_hex = num2hex(single(in));  % 8 bit hex value
val_dec = hex2dec(val_hex');     
val_bin = dec2bin(val_dec,4);    
val_bitstr = reshape(val_bin',[1 32]);  % 32 bit value

% Sign Exp Man
if nargout<2    %Check
  sign = val_bitstr;      
else
  sign = val_bitstr(1);
  expo = bitstr(2:9);
  frac = bitstr(10:32);
  if nargin > 1 && isequal(lower(fmt),'dec')
    sign = bin2dec(sign);  expo = bin2dec(expo);  frac = bin2dec(frac);
  end
end			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
ieee754_32.m635.00 B07-09-13 19:33
<Single-precision>0.00 BWikipedia, the
<IEEE>0.00 BWikipedia, the
...
Sponsored links

ieee754_32.m (471.34 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D