<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: 24-битная экспонента]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11608&amp;type=atom" />
	<updated>2016-05-20T10:09:08Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11608</id>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: 24-битная экспонента]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103972#p103972" />
			<content type="html"><![CDATA[<p>Аналог exp(x) в VBcript int(exp((a/2^24)*log(2))*2^24) : </p><div class="codebox"><pre><code>@echo off
setlocal enabledelayedexpansion
set c=1
for %%i in (
    rem Продолжение квадратных корней двойки
	23726566 19951584 18295683 17520006 17144589 16959907 16868314 16822703
	16799944 16788576 16782895 16780055 16778635 16777925 16777570 16777393
	16777304 16777260 16777238 16777227 16777221 16777218 16777217 16777216
) do (
	set exp[!c!]=%%i
	set /a c+=1
)
set num=%1
set number=16777216
for /l %%i in (1,1,24) do (
	set /a &quot;mask=(num &gt;&gt; (24-%%i)) &amp; 1&quot;
	if !mask!==1 call :mul24 !number! !exp[%%i]! number
)
Echo !number!
endlocal
exit /b

:mul24
setlocal
set a=%1
set b=%2
set /a &quot;n=((a &gt;&gt; 12)*(b &gt;&gt; 12))+(((a &amp; 0xFFF)*(b &gt;&gt; 12)) &gt;&gt; 12)+(((a &gt;&gt; 12)*(b &amp; 0xFFF)) &gt;&gt; 12)&quot;
endlocal&amp;set %3=%n%
goto :eof
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[torus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33003</uri>
			</author>
			<updated>2016-05-20T10:09:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103972#p103972</id>
		</entry>
</feed>
