⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sflop.m

📁 SFLOP simulates a floating point operation x op y where op = +, -, *, /
💻 M
字号:
%  PURPOSE:%  SFLOP  simulates a floating point operation% %       x   op   y      where  op = +, -, *, / % %  In chopping or rounding arithmetic using an%  m  digit mantissa, base 10, and an unrestricted %  exponent range. (sflop: Simulate FLOating Point %  operation.) For more details on the how the floating%  point representation of a number is computed see%  the function  sfl.% % %  CALLING SEQUENCE:%   %  function [res] = sflop( x, y, m, arith, op )%%  INPUT:% %  x      real %         argument in the floating point operation% %  y      real%         argument in the floating point operation% %  m      integer%         mantissa length% %  arith  string%         arith = 'c'   chopped arithmetic%         arith = 'r'   rounded arithmetic% %  op     string%         type of floating point operation%         op    = '+'  or  '-'  or  '*'  or  '/'% % %  OUTPUT:% %  res    real%         result of the floating point operation% %%%%  Matthias Heinkenschloss%  Department of Computational and Applied Mathematics%  Rice University%  Feb 12, 2001%%      function [res] = sflop( x, y, m, arith, op )%  compute floating point represenation of x  and  y xfl = sfl( x, m, arith);yfl = sfl( y, m, arith);%  perform operation to 'full' accuracyif( op == '+' )    z = xfl + yfl;endif( op == '-' )    z = xfl - yfl;endif( op == '*' )    z = xfl .* yfl;endif( op == '/' )      z = xfl ./ yfl;end%  round/chopp the resultres = sfl( z, m, arith); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -