Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7e5d6f76ee
Fetching contributors…

Cannot retrieve contributors at this time

428 lines (245 sloc) 16.817 kb
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Class: DPT9_Float</title>
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
<script src="./js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="./js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="./js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="./js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>
<body class="class">
<div id="metadata">
<div id="home-metadata">
<div id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./index.html#classes">Classes</a>
<a href="./index.html#methods">Methods</a>
</h3>
</div>
</div>
<div id="file-metadata">
<div id="file-list-section" class="section">
<h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
<li><a href="./knx/dpt/tests/test_dpt9_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="knx/dpt/tests/test_dpt9.rb">knx/dpt/tests/test_dpt9.rb</a></li>
</ul>
</div>
</div>
</div>
<div id="class-metadata">
<!-- Parent Class -->
<div id="parent-class-section" class="section">
<h3 class="section-header">Parent</h3>
<p class="link">BinData::Primitive</p>
</div>
<!-- Namespace Contents -->
<!-- Method Quickref -->
<div id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-i-get">#get</a></li>
<li><a href="#method-i-set">#set</a></li>
</ul>
</div>
<!-- Included Modules -->
</div>
<div id="project-metadata">
<div id="fileindex-section" class="section project-section">
<h3 class="section-header">Files</h3>
<ul>
<li class="file"><a href="./README.html">README</a></li>
<li class="file"><a href="./license/LICENSE.html">LICENSE</a></li>
<li class="file"><a href="./license/gpl_txt.html">gpl.txt</a></li>
<li class="file"><a href="./license/lgpl_txt.html">lgpl.txt</a></li>
<li class="file"><a href="./monit/monitrc-ansible.html">monitrc-ansible</a></li>
</ul>
</div>
<div id="classindex-section" class="section project-section">
<h3 class="section-header">Class Index
<span class="search-toggle"><img src="./images/find.png"
height="16" width="16" alt="[+]"
title="show/hide quicksearch" /></span></h3>
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
<fieldset>
<legend>Quicksearch</legend>
<input type="text" name="quicksearch" value=""
class="quicksearch-field" />
</fieldset>
</form>
<ul class="link-list">
<li><a href="./Ansible.html">Ansible</a></li>
<li><a href="./Ansible/AnsibleCallback.html">Ansible::AnsibleCallback</a></li>
<li><a href="./Ansible/AnsibleValue.html">Ansible::AnsibleValue</a></li>
<li><a href="./Ansible/Device.html">Ansible::Device</a></li>
<li><a href="./Ansible/Dimmer.html">Ansible::Dimmer</a></li>
<li><a href="./Ansible/KNX.html">Ansible::KNX</a></li>
<li><a href="./Ansible/KNX/Canonical_1bit.html">Ansible::KNX::Canonical_1bit</a></li>
<li><a href="./Ansible/KNX/DPT1.html">Ansible::KNX::DPT1</a></li>
<li><a href="./Ansible/KNX/DPT10.html">Ansible::KNX::DPT10</a></li>
<li><a href="./Ansible/KNX/DPT10/DPT10_Frame.html">Ansible::KNX::DPT10::DPT10_Frame</a></li>
<li><a href="./Ansible/KNX/DPT11.html">Ansible::KNX::DPT11</a></li>
<li><a href="./Ansible/KNX/DPT11/DPT11_Frame.html">Ansible::KNX::DPT11::DPT11_Frame</a></li>
<li><a href="./Ansible/KNX/DPT12.html">Ansible::KNX::DPT12</a></li>
<li><a href="./Ansible/KNX/DPT12/DPT12_Frame.html">Ansible::KNX::DPT12::DPT12_Frame</a></li>
<li><a href="./Ansible/KNX/DPT13.html">Ansible::KNX::DPT13</a></li>
<li><a href="./Ansible/KNX/DPT13/DPT13_Frame.html">Ansible::KNX::DPT13::DPT13_Frame</a></li>
<li><a href="./Ansible/KNX/DPT14.html">Ansible::KNX::DPT14</a></li>
<li><a href="./Ansible/KNX/DPT14/DPT14_Float.html">Ansible::KNX::DPT14::DPT14_Float</a></li>
<li><a href="./Ansible/KNX/DPT14/DPT14_Frame.html">Ansible::KNX::DPT14::DPT14_Frame</a></li>
<li><a href="./Ansible/KNX/DPT15.html">Ansible::KNX::DPT15</a></li>
<li><a href="./Ansible/KNX/DPT15/DPT15_Frame.html">Ansible::KNX::DPT15::DPT15_Frame</a></li>
<li><a href="./Ansible/KNX/DPT16.html">Ansible::KNX::DPT16</a></li>
<li><a href="./Ansible/KNX/DPT16/DPT16_Frame.html">Ansible::KNX::DPT16::DPT16_Frame</a></li>
<li><a href="./Ansible/KNX/DPT17.html">Ansible::KNX::DPT17</a></li>
<li><a href="./Ansible/KNX/DPT17/DPT17_Frame.html">Ansible::KNX::DPT17::DPT17_Frame</a></li>
<li><a href="./Ansible/KNX/DPT18.html">Ansible::KNX::DPT18</a></li>
<li><a href="./Ansible/KNX/DPT18/DPT18_Frame.html">Ansible::KNX::DPT18::DPT18_Frame</a></li>
<li><a href="./Ansible/KNX/DPT19.html">Ansible::KNX::DPT19</a></li>
<li><a href="./Ansible/KNX/DPT19/DPT19_Frame.html">Ansible::KNX::DPT19::DPT19_Frame</a></li>
<li><a href="./Ansible/KNX/DPT1/DPT1_Frame.html">Ansible::KNX::DPT1::DPT1_Frame</a></li>
<li><a href="./Ansible/KNX/DPT2.html">Ansible::KNX::DPT2</a></li>
<li><a href="./Ansible/KNX/DPT2/DPT2_Frame.html">Ansible::KNX::DPT2::DPT2_Frame</a></li>
<li><a href="./Ansible/KNX/DPT3.html">Ansible::KNX::DPT3</a></li>
<li><a href="./Ansible/KNX/DPT3/DPT3_Frame.html">Ansible::KNX::DPT3::DPT3_Frame</a></li>
<li><a href="./Ansible/KNX/DPT4.html">Ansible::KNX::DPT4</a></li>
<li><a href="./Ansible/KNX/DPT4/DPT4_Frame.html">Ansible::KNX::DPT4::DPT4_Frame</a></li>
<li><a href="./Ansible/KNX/DPT5.html">Ansible::KNX::DPT5</a></li>
<li><a href="./Ansible/KNX/DPT5/DPT5_Frame.html">Ansible::KNX::DPT5::DPT5_Frame</a></li>
<li><a href="./Ansible/KNX/DPT6.html">Ansible::KNX::DPT6</a></li>
<li><a href="./Ansible/KNX/DPT6/DPT6_Frame.html">Ansible::KNX::DPT6::DPT6_Frame</a></li>
<li><a href="./Ansible/KNX/DPT7.html">Ansible::KNX::DPT7</a></li>
<li><a href="./Ansible/KNX/DPT7/DPT7_Frame.html">Ansible::KNX::DPT7::DPT7_Frame</a></li>
<li><a href="./Ansible/KNX/DPT8.html">Ansible::KNX::DPT8</a></li>
<li><a href="./Ansible/KNX/DPT8/DPT8_Frame.html">Ansible::KNX::DPT8::DPT8_Frame</a></li>
<li><a href="./Ansible/KNX/DPT9.html">Ansible::KNX::DPT9</a></li>
<li><a href="./Ansible/KNX/DPT9/DPT9_Float.html">Ansible::KNX::DPT9::DPT9_Float</a></li>
<li><a href="./Ansible/KNX/DPT9/DPT9_Frame.html">Ansible::KNX::DPT9::DPT9_Frame</a></li>
<li><a href="./Ansible/KNX/DPTFrame.html">Ansible::KNX::DPTFrame</a></li>
<li><a href="./Ansible/KNX/Dimmer.html">Ansible::KNX::Dimmer</a></li>
<li><a href="./Ansible/KNX/EISType.html">Ansible::KNX::EISType</a></li>
<li><a href="./Ansible/KNX/KNXValue.html">Ansible::KNX::KNXValue</a></li>
<li><a href="./Ansible/KNX/KNX_Transceiver.html">Ansible::KNX::KNX_Transceiver</a></li>
<li><a href="./Ansible/KNX/KNX_Transceiver/NormalExit.html">Ansible::KNX::KNX_Transceiver::NormalExit</a></li>
<li><a href="./Ansible/KNX/L_DATA_Frame.html">Ansible::KNX::L_DATA_Frame</a></li>
<li><a href="./Ansible/KNX/ScalarValue.html">Ansible::KNX::ScalarValue</a></li>
<li><a href="./Ansible/KNX/Scene.html">Ansible::KNX::Scene</a></li>
<li><a href="./Ansible/KNX/TP_ControlField.html">Ansible::KNX::TP_ControlField</a></li>
<li><a href="./Ansible/PLC.html">Ansible::PLC</a></li>
<li><a href="./Ansible/Switch.html">Ansible::Switch</a></li>
<li><a href="./Ansible/Transceiver.html">Ansible::Transceiver</a></li>
<li><a href="./Ansible/ZWave.html">Ansible::ZWave</a></li>
<li><a href="./Ansible/ZWave/Dimmer.html">Ansible::ZWave::Dimmer</a></li>
<li><a href="./Ansible/ZWave/ValueID.html">Ansible::ZWave::ValueID</a></li>
<li><a href="./Ansible/ZWave/ValueType_Bool.html">Ansible::ZWave::ValueType_Bool</a></li>
<li><a href="./Ansible/ZWave/ValueType_Button.html">Ansible::ZWave::ValueType_Button</a></li>
<li><a href="./Ansible/ZWave/ValueType_Byte.html">Ansible::ZWave::ValueType_Byte</a></li>
<li><a href="./Ansible/ZWave/ValueType_Decimal.html">Ansible::ZWave::ValueType_Decimal</a></li>
<li><a href="./Ansible/ZWave/ValueType_Int.html">Ansible::ZWave::ValueType_Int</a></li>
<li><a href="./Ansible/ZWave/ValueType_List.html">Ansible::ZWave::ValueType_List</a></li>
<li><a href="./Ansible/ZWave/ValueType_Short.html">Ansible::ZWave::ValueType_Short</a></li>
<li><a href="./Ansible/ZWave/ValueType_String.html">Ansible::ZWave::ValueType_String</a></li>
<li><a href="./Ansible/ZWave/ZWave_Transceiver.html">Ansible::ZWave::ZWave_Transceiver</a></li>
<li><a href="./AutoReload.html">AutoReload</a></li>
<li><a href="./DPT10.html">DPT10</a></li>
<li><a href="./DPT9.html">DPT9</a></li>
<li><a href="./DPT9_Float.html">DPT9_Float</a></li>
<li><a href="./EIBAddr.html">EIBAddr</a></li>
<li><a href="./EIBBuffer.html">EIBBuffer</a></li>
<li><a href="./EIBConnection.html">EIBConnection</a></li>
<li><a href="./EIBInt16.html">EIBInt16</a></li>
<li><a href="./EIBInt32.html">EIBInt32</a></li>
<li><a href="./EIBInt8.html">EIBInt8</a></li>
<li><a href="./OZW_ValueID_id.html">OZW_ValueID_id</a></li>
<li><a href="./OZW_ValueID_id1.html">OZW_ValueID_id1</a></li>
<li><a href="./Object.html">Object</a></li>
<li><a href="./OpenZWave.html">OpenZWave</a></li>
<li><a href="./OrbiterProxy.html">OrbiterProxy</a></li>
<li><a href="./String.html">String</a></li>
<li><a href="./Test.html">Test</a></li>
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
</div>
</div>
<div id="documentation">
<h1 class="class">DPT9_Float</h1>
<div id="description">
</div>
<!-- Constants -->
<!-- Attributes -->
<!-- Methods -->
<div id="public-instance-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="get-method" class="method-detail ">
<a name="method-i-get"></a>
<div class="method-heading">
<span class="method-name">get</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code"
id="get-source">
<pre>
<span class="ruby-comment cmt"># File knx/dpt/tests/test_dpt9.rb, line 10</span>
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>
11: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;get, sign=#{sign} exp=#{exp} mant=#{mant}&quot;</span>
12: <span class="ruby-identifier">mantissa</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sign</span><span class="ruby-operator">==</span><span class="ruby-value">1</span>) <span class="ruby-operator">?</span> <span class="ruby-operator">~</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mant</span><span class="ruby-operator">^</span><span class="ruby-value">2047</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mant</span>
13: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">ldexp</span>((<span class="ruby-value">0.01</span>*<span class="ruby-identifier">mantissa</span>), <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">exp</span>)
14: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="set-method" class="method-detail ">
<a name="method-i-set"></a>
<div class="method-heading">
<span class="method-name">set</span><span
class="method-args">(v)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code"
id="set-source">
<pre>
<span class="ruby-comment cmt"># File knx/dpt/tests/test_dpt9.rb, line 16</span>
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">v</span>)
17: <span class="ruby-identifier">mantissa</span>, <span class="ruby-identifier">exponent</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">frexp</span>(<span class="ruby-identifier">v</span>)
18: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{self}.set(#{v}) with initial mantissa=#{mantissa}, exponent=#{exponent}&quot;</span>
19: <span class="ruby-comment cmt"># find the minimum exponent that will upsize the normalized mantissa (0,5 to 1 range)</span>
20: <span class="ruby-comment cmt"># in order to fit in 11 bits (-2048..2047)</span>
21: <span class="ruby-identifier">max_mantissa</span> = <span class="ruby-value">0</span>
22: <span class="ruby-identifier">minimum_exp</span> = <span class="ruby-identifier">exponent</span>.<span class="ruby-identifier">downto</span>(<span class="ruby-value">15</span>).<span class="ruby-identifier">find</span>{ <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
23: <span class="ruby-identifier">max_mantissa</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">ldexp</span>(<span class="ruby-value">100</span>*<span class="ruby-identifier">mantissa</span>, <span class="ruby-identifier">e</span>).<span class="ruby-identifier">to_i</span>
24: <span class="ruby-identifier">max_mantissa</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-value">2048</span>, <span class="ruby-value">2047</span>)
25: }
26: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sign</span> = (<span class="ruby-identifier">mantissa</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
27: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mant</span> = (<span class="ruby-identifier">mantissa</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-operator">~</span>(<span class="ruby-identifier">max_mantissa</span><span class="ruby-operator">^</span><span class="ruby-value">2047</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">max_mantissa</span>
28: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">exp</span> = <span class="ruby-identifier">exponent</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">minimum_exp</span>
29: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;... set(#{v}) finished: sign=#{sign}, mantissa=#{mant}, exponent=#{exp}&quot;</span>
30: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
<div id="rdoc-debugging-section-dump" class="debugging-section">
<p>Disabled; run with --debug to generate this.</p>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator</a> 1.1.6</small>.</p>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.