<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Расчет до сотых]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6827&amp;type=atom" />
	<updated>2012-02-20T05:30:06Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6827</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=57110#p57110" />
			<content type="html"><![CDATA[<p>разобрался. в чем была проблема. В батниках используется целочисленная 32 битная со знаком арифметика, т.е. максимально возможное число, с которым батники смогут что-то сделать это: -2147483648 и 2147483647</p>]]></content>
			<author>
				<name><![CDATA[lorents]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27502</uri>
			</author>
			<updated>2012-02-20T05:30:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=57110#p57110</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=57109#p57109" />
			<content type="html"><![CDATA[<p>соглашусь код не верен, но смысл не меняется</p>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2012-02-20T04:39:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=57109#p57109</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56996#p56996" />
			<content type="html"><![CDATA[<p>допустим,<br />x=1<br />y=3<br />мне выдает 0.03, честно говоря, как это можно исправить, мне надо получить 33,3%</p>]]></content>
			<author>
				<name><![CDATA[lorents]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27502</uri>
			</author>
			<updated>2012-02-18T05:04:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56996#p56996</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56988#p56988" />
			<content type="html"><![CDATA[<p>типа того ?<br /></p><div class="codebox"><pre><code>echo off
setlocal ENABLEDELAYEDEXPANSION
set x=999
set y=39999999
set d=0
call :len &quot;%y%%d%&quot;
call :len &quot;%y%&quot;
set/a &quot;n=%len% + %d%&quot;
if %n% gtr 8 echo Количество знаков превышает воможности вычисления, поправимо, но не так
set /a &quot;len=%len% + %d%&quot;
set z=1
for /l %%i in (1,1,!len!) do set z=!z!0
set /a &quot;z=%z% * x / y&quot;
set /a &quot;len=%len% - %d%&quot;
for /l %%i in (1,1,!len!) do set z=0!z!
echo 0.%z%

exit /b

:len (string) {
    @@rem Процедура определения длины строки
    @@rem
    setlocal
    set opt=%~1
    set opt=%opt:&quot;=&#039;%
    set out=%~0
    if &quot;%out:~0,1%&quot;==&quot;:&quot; (
        set out=%out:~1%
        ) else (
        set out=out
        )
    set /a n=0
    :loop_len
    if not &quot;%opt%&quot;==&quot;&quot; (
        set opt=%opt:~1%
        set /a n=%n%+1
        goto loop_len
        )
    endlocal &amp; set /a %out%=%n%
    exit /b 0
    }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2012-02-17T19:58:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56988#p56988</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56960#p56960" />
			<content type="html"><![CDATA[<p>а можно пример с процентами, 1/3=33,33%?<br />и у меня может быть ситуация 3/2=150%,00</p>]]></content>
			<author>
				<name><![CDATA[lorents]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27502</uri>
			</author>
			<updated>2012-02-17T08:14:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56960#p56960</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56936#p56936" />
			<content type="html"><![CDATA[<p>set /a x=&quot;100 * 1 / 3&quot;<br />echo 0.%x%</p>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2012-02-17T04:30:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56936#p56936</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56916#p56916" />
			<content type="html"><![CDATA[<p><strong>smaharbA</strong><br />пробовал, но у меня так и не вышло, думал может другие способы есть.</p>]]></content>
			<author>
				<name><![CDATA[lorents]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27502</uri>
			</author>
			<updated>2012-02-16T16:03:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56916#p56916</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56914#p56914" />
			<content type="html"><![CDATA[<p>умножить числитель на 100 не предлагать ?</p>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2012-02-16T14:38:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56914#p56914</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56913#p56913" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>lorents пишет:</cite><blockquote><p>Подскажите, как можно заставить batch до сотых?</p></blockquote></div><p>Позволю себе процитировать классика:<br />- <strong><em>Математически.</em></strong><br /></p><div class="quotebox"><cite>lorents пишет:</cite><blockquote><p>Может есть сторонние средства?</p></blockquote></div><p>Была где-то <a href="http://www.google.com/m?q=%62%72%61%69%6E%2E%65%78%65%20%64%6F%77%6E%6C%6F%61%64"><strong>тулза</strong></a> отечественных разработчиков.</p><p>К сожалению, работает далеко не у всех - плагинов каких-то требует.<br />А в большинстве случаев, при попытке запуска из-под UserMode приводит к BSOD&#039;у (скорее всего из-за отсутствия драйвера). <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>Но возможно, всё зависит от Операционной Среды.</p>]]></content>
			<author>
				<name><![CDATA[Аскет]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25748</uri>
			</author>
			<updated>2012-02-16T14:22:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56913#p56913</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Расчет до сотых]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56869#p56869" />
			<content type="html"><![CDATA[<p>Добрый день!<br />Подскажите, как можно заставить batch до сотых?<br />Пример:<br />1/3 мне выдает 0, как можно сделать 0,33. Может есть сторонние средства?</p>]]></content>
			<author>
				<name><![CDATA[lorents]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27502</uri>
			</author>
			<updated>2012-02-15T13:29:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56869#p56869</id>
		</entry>
</feed>
