テンプレート:Truncのソースを表示
←
テンプレート:Trunc
ナビゲーションに移動
検索に移動
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
<includeonly>{{trunc/1|{{formatnum:{{{1}}}|R}}|{{formatnum:{{{2|}}}|R}}}}</includeonly><noinclude> This template produces an expression for the truncated value of a given expression. If the value is in the range of integer-type numbers (in the range {{numf|trunc-2^63}} through {{numf|trunc(2^63-1024)+trunc1023}}), the resulting expression is of type integer. The template also serves as a tool to enter an integer larger than {{numf|2^53}}, avoiding rounding to float: split the digits up into two parameters, each forming an integer not larger than that limit, and avoiding leading zeros in the second parameter. If the latter requires a larger first parameter: for every trailing 0 it can be a factor 2 larger then mentioned (see also [[Help:Calculation accuracy#Integers]]). To enter an integer smaller than -{{numf|2^53}} explicitly, do the same with a minus sign before each part. Thus, when applying <code>#expr</code>, if the value is in the range of integer-type numbers the exact result is produced. The reason for not applying <code>#expr</code> in this template is: *for integer-type numbers: in subsequent use in another expression the value would be rounded to float *for floats: they would be rounded to 14 digits ==Examples== Integer-type expressions (unchanged): *{{xpsopocc|numf|trunc|trunc(2^63-1024)+trunc1023}} Explicit integer values in the range of type integer: *{{xpsoc|trunc|123|4567890123456789}} *{{xpsoc|trunc|1234|567890123456789}} *{{xpsoc|trunc|123456|7890123456789}} *{{xpsoc|trunc|1234567|890123456789}} *{{xpsoc|trunc|12345678|90123456789}} *{{xpsoc|trunc|1234567890|123456789}} *{{xpsoc|trunc|12345678901|23456789}} *{{xpsoc|trunc|123456789012|3456789}} *{{xpsoc|trunc|1234567890123|456789}} *{{xpsoc|trunc|12345678901234|56789}} *{{xpsoc|trunc|123456789012345|6789}} *{{xpsoc|trunc|1234567890123456|789}} *{{xpsopocc|numf|trunc|123|4567890123456789}} *{{xpsopocc|numf|trunc|1234|567890123456789}} *{{xpsopocc|numf|trunc|123456|7890123456789}} *{{xpsopocc|numf|trunc|1234567|890123456789}} *{{xpsopocc|numf|trunc|12345678|90123456789}} *{{xpsopocc|numf|trunc|1234567890|123456789}} *{{xpsopocc|numf|trunc|12345678901|23456789}} *{{xpsopocc|numf|trunc|123456789012|3456789}} *{{xpsopocc|numf|trunc|1234567890123|456789}} *{{xpsopocc|numf|trunc|12345678901234|56789}} *{{xpsopocc|numf|trunc|123456789012345|6789}} *{{xpsopocc|numf|trunc|1234567890123456|789}} *{{xpsopocc|numf|trunc|9e17|1}} (to avoid leading zeros in the second parameter, the first parameter is almost 100 times as large as 9,007,199,254,740,992. However, for every trailing 0 it can be a factor 2 larger then this number; in this case there are 17 trailing zeros; since the factor 100 is less than 2^17 the first parameter is exactly representable as float). *{{xpsopocc|numf|trunc|-123|-4567890123456789}} Float expressions with integer values in the range of type integer (the template converts them to type integer): *{{xpsoocc|#expr:|trunc|-2^63}} Float expressions with a non-integer value (the template applies the mathematical trunc function and returns a result of type integer):: *{{xpsopocc|numf|trunc|98.7}} *{{xpsopocc|numf|trunc|20/3}} *{{xpsopocc|numf|trunc|1e6/3}} Floats outside the range of type integer (unchanged): *{{xpsopocc|numfh|trunc|123.45e20}} :Compare the operator trunc: :*{{xpsoc|numf|trunc123.45e20}} ---- A leading zero in the second parameter is ignored: *{{xpsopocc|numf|trunc|123456789|0123456789}} If one of the integers is too large, it is rounded in the conversion to float, making the result inaccurate: *{{xpsopocc|numf|trunc|1|234567890123456789}} *{{xpsopocc|numf|trunc|12|34567890123456789}} *{{xpsopocc|numf|trunc|12345678901234567|89}} *{{xpsopocc|numf|trunc|123456789012345678|9}} [[Category:Mathematical templates|{{PAGENAME}}]]</noinclude>
テンプレート:Trunc
に戻る。
ナビゲーション メニュー
個人用ツール
ログイン
名前空間
テンプレート
議論
日本語
表示
閲覧
履歴表示
その他
検索
案内
索引
脳科学辞典について
最近完成した項目
編集履歴
執筆にあたって
引用の仕方
著作権について
免責事項
問い合わせ
各学会編集のオンライン用語辞典
About us (in English)
Twitter (BrainScienceBot)
ツール
リンク元
関連ページの更新状況
特別ページ
ページ情報
他のプロジェクト