It is possible to write a function, say fmex, in the programming language in such a way that the function can be called from MATLAB. The function fmex must written so it conforms with what is termed...


It is possible to write a function, say fmex, in the programming language

in such a way that the function can be called from MATLAB. The function fmex must written so it conforms with what is termed the MEX interface and must be compiled using the MATLAB command mex (see Ref. [20]). This interface provides access to the input and output parameters when the function is called from MATLAB. The book software distribution contains the C program outputdouble.c in the subdirectory outputdouble of the software distribution as well as compiled versions. Since machine code is system dependent, there are multiple versions. The following table lists the names of the available compiled code for Windows, OS X, and Linux systems.


Windows 64-bit OS X 64-bit Linux-64 bit


outputdouble.mexw64 outputdouble.mexmaci64 outputdouble.mexa64


If you are using a 32-bit system, execute “mex outputdouble.c”, and MATLAB should generate 32-bit code. On any system, the calling format is


where

is a double variable or a constant. It prints the 64 binary bits of x in IEEE double format, marking the location of the sign bit, the exponent, and the mantissa. The binary bits represent a floating point number of the form

1

2

3

52

e

The leading

is hidden; in other words it is considered present but is not stored, giving 53 bits for the mantissa. The exponent uses excess 1023 format.




Find the binary representation for each number, determine the exponent in decimal, and the mantissa in binary.



















The MATLAB named constants realmax and realmin are the largest and smallest double values. Using outputdouble, determine each number in binary and then determine what each number is in decimal.




May 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here