Skip to content

ext/bcmath: PHP 8.4の翻訳 #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 2, 2025
16 changes: 1 addition & 15 deletions language-snippets.ent
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9cd8eb0f11edb4e59fd22f723137bbb91d6ab64f Maintainer: takagi Status: working -->
<!-- EN-Revision: 3295741565f760edd22e305bd10e37f243e9e194 Maintainer: takagi Status: working -->
<!-- Credits: hirokawa,haruki,shimooka,mumumu,jdkfx -->

<!ENTITY installation.enabled.disable 'この拡張モジュールはデフォルトで有効になっています。無効にしたい場合は、次のオプションを指定してコンパイルします。'>
Expand Down Expand Up @@ -2121,20 +2121,6 @@ PECL 拡張モジュールのインストール</link> という章にありま

<!ENTITY sqlsafemode '<link xmlns="http://docbook.org/ns/docbook" linkend="ini.sql.safe-mode">SQL セーフモード</link>'>

<!-- BCMath Notes -->
<!-- to be translated -->
<!ENTITY bc.scale.description '<varlistentry xmlns="http://docbook.org/ns/docbook">
<term><parameter>scale</parameter></term>
<listitem>
<simpara>
This parameter is used to set the number of digits after the decimal place in the result.
If &null;, it will default to the default scale set with <function>bcscale</function>,
or fallback to the value of the
<link linkend="ini.bcmath.scale"><literal>bcmath.scale</literal></link> INI directive.
</simpara>
</listitem>
</varlistentry>'>

<!-- CTYPE Notes -->
<!ENTITY note.ctype.parameter.integer '<note xmlns="http://docbook.org/ns/docbook"><para>
-128 から 255 までの <type>int</type> を渡すと、ひとつの文字の ASCII 値とみなします
Expand Down
122 changes: 122 additions & 0 deletions reference/bc/bcmath.number.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: c7e83fbbbcde9f54affc09424d032c38492a3ff4 Maintainer: saki Status: ready -->

<reference xml:id="class.bcmath-number" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

<title>BcMath\Number クラス</title>
<titleabbrev>BcMath\Number</titleabbrev>

<partintro>
<section xml:id="bcmath-number.intro">
&reftitle.intro;
<simpara>
任意精度数値のクラスです。
このオブジェクトは、オーバーロードされた
<link linkend="language.operators.arithmetic">算術演算子</link>,
<link linkend="language.operators.comparison">比較演算子</link>
をサポートしています。
</simpara>

<note>
<simpara>
このクラスは、&php.ini;で設定された
<link linkend="ini.bcmath.scale">bcmath.scale</link>
INI ディレクティブの影響を受けません。
</simpara>
</note>

<note>
<simpara>
オーバーロードされた演算子の動作は、対応するメソッドで
<parameter>scale</parameter> パラメータに &null; を指定した場合と同じです。
</simpara>
</note>
</section>

<section xml:id="bcmath-number.synopsis">
&reftitle.classsynopsis;

<classsynopsis class="class">
<ooclass>
<modifier>final</modifier>
<modifier>readonly</modifier>
<classname>BcMath\Number</classname>
</ooclass>

<oointerface>
<modifier>implements</modifier>
<interfacename>Stringable</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<type>string</type>
<varname linkend="bcmath-number.props.value">value</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<type>int</type>
<varname linkend="bcmath-number.props.scale">scale</varname>
</fieldsynopsis>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.bcmath-number')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='BcMath\\Number'])">
<xi:fallback/>
</xi:include>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.bcmath-number')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='BcMath\\Number'])">
<xi:fallback/>
</xi:include>
</classsynopsis>
</section>

<section xml:id="bcmath-number.props">
&reftitle.properties;
<variablelist>
<varlistentry xml:id="bcmath-number.props.value">
<term><varname>value</varname></term>
<listitem>
<simpara>
任意精度数値の文字表現。
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="bcmath-number.props.scale">
<term><varname>scale</varname></term>
<listitem>
<simpara>
オブジェクトに設定されているスケールの値。
計算メソッドで明示的に <parameter>scale</parameter> パラメータが設定されていない場合、
この値は自動的に計算されて設定されます。
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>

</partintro>

&reference.bc.bcmath.entities.number;

</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
195 changes: 195 additions & 0 deletions reference/bc/bcmath/number/add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a414ee95eb79e2c62c80827a46e15da5d15af97e Maintainer: saki Status: ready -->

<refentry xml:id="bcmath-number.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>BcMath\Number::add</refname>
<refpurpose>任意精度の数値を加算する</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="BcMath\\Number">
<modifier>public</modifier> <type>BcMath\Number</type><methodname>BcMath\Number::add</methodname>
<methodparam><type class="union"><type>BcMath\Number</type><type>string</type><type>int</type></type><parameter>num</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>scale</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<simpara>
<varname>$this</varname> と <parameter>num</parameter> を加算します。
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>num</parameter></term>
<listitem>
<simpara>
加数を表す値。
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>scale</parameter></term>
<listitem>
<simpara>
計算結果オブジェクトの <property>BcMath\Number::scale</property> を明示的に指定します。
&null; の場合、計算結果の <property>BcMath\Number::scale</property> は自動的に設定されます。
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
加算結果を新しい <classname>BcMath\Number</classname> オブジェクトとして返します。
</simpara>
<simpara>
加算結果オブジェクトの <property>BcMath\Number::scale</property> が自動的に設定される場合、加算に使用する2つの数値のうち、
大きい方の <property>BcMath\Number::scale</property> が使用されます。
</simpara>
<simpara>
つまり、2つの値の <property>BcMath\Number::scale</property> がそれぞれ <literal>2</literal> と <literal>5</literal> の場合、
加算結果オブジェクトの <property>BcMath\Number::scale</property> は <literal>5</literal> になります。
</simpara>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
このメソッドは、以下の場合に <classname>ValueError</classname> をスローします:
<simplelist>
<member><parameter>num</parameter> が、BCMath で有効でない数値形式の文字列である場合</member>
<member><parameter>scale</parameter> が範囲外の値である場合</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title><methodname>BcMath\Number::add</methodname> で <parameter>scale</parameter> を指定しない例</title>
<programlisting role="php">
<![CDATA[
<?php
$number = new BcMath\Number('1.234');

$ret1 = $number->add(new BcMath\Number('2.34567'));
$ret2 = $number->add('-3.456');
$ret3 = $number->add(7);

var_dump($number, $ret1, $ret2, $ret3);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(BcMath\Number)#1 (2) {
["value"]=>
string(5) "1.234"
["scale"]=>
int(3)
}
object(BcMath\Number)#3 (2) {
["value"]=>
string(7) "3.57967"
["scale"]=>
int(5)
}
object(BcMath\Number)#2 (2) {
["value"]=>
string(6) "-2.222"
["scale"]=>
int(3)
}
object(BcMath\Number)#4 (2) {
["value"]=>
string(5) "8.234"
["scale"]=>
int(3)
}
]]>
</screen>
</example>

<example>
<title><methodname>BcMath\Number::add</methodname> で <parameter>scale</parameter> を指定する例</title>
<programlisting role="php">
<![CDATA[
<?php
$number = new BcMath\Number('1.234');

$ret1 = $number->add(new BcMath\Number('2.34567'), 1);
$ret2 = $number->add('-3.456', 10);
$ret3 = $number->add(7, 0);

var_dump($number, $ret1, $ret2, $ret3);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(BcMath\Number)#1 (2) {
["value"]=>
string(5) "1.234"
["scale"]=>
int(3)
}
object(BcMath\Number)#3 (2) {
["value"]=>
string(3) "3.5"
["scale"]=>
int(1)
}
object(BcMath\Number)#2 (2) {
["value"]=>
string(13) "-2.2220000000"
["scale"]=>
int(10)
}
object(BcMath\Number)#4 (2) {
["value"]=>
string(1) "8"
["scale"]=>
int(0)
}
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>bcadd</function></member>
<member><methodname>BcMath\Number::sub</methodname></member>
</simplelist>
</refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Loading