JPS6146856B2 - - Google Patents

Info

Publication number
JPS6146856B2
JPS6146856B2 JP759378A JP759378A JPS6146856B2 JP S6146856 B2 JPS6146856 B2 JP S6146856B2 JP 759378 A JP759378 A JP 759378A JP 759378 A JP759378 A JP 759378A JP S6146856 B2 JPS6146856 B2 JP S6146856B2
Authority
JP
Japan
Prior art keywords
register
signal
output
address
timing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired
Application number
JP759378A
Other languages
Japanese (ja)
Other versions
JPS54100633A (en
Inventor
Tomohiro Shimizu
Yutaka Takeuchi
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP759378A priority Critical patent/JPS54100633A/en
Publication of JPS54100633A publication Critical patent/JPS54100633A/en
Publication of JPS6146856B2 publication Critical patent/JPS6146856B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Calculators And Similar Devices (AREA)
  • Complex Calculations (AREA)

Description

【発明の詳細な説明】[Detailed description of the invention]

本発明は組合せ演算可能な小型電子式計算機に
関する。 最近、小型電子式計算機、例えば、電子式卓上
計算機の分野では、その機器の普及に伴い、小
型、薄型化の傾向と共に機能の高級化が望まれ、
三角関数、指数関数、対数関数及び階乗演算等の
各種演算機能に加えて、順列演算(nPr)、組合
せ演算(nCr)をも可能な計算機が実用化されて
いる。 一方、従来のこの種計算機にあつては、機器の
小型化の要求に伴い組合せ演算 (但しn,r共正の整数) を算出する場合、できるだけ同一のサブルーチン
を使用し、余計なステツプやそれに伴う複雑な回
路を付加しないようにし回路の小型化を計る必要
があつた。その為、従来は組合せ演算を算出する
際は、元来計算機に設けられていた階乗演算を行
うサブルーチンをそのまま利用するような演算方
式を用いていた。即ち、上記式に於いて、まず
n1を計算し、次に分母のr1および(n―r)1を
計算し、次にr1x(n―r)1を計算し、最後に
上記n1をr1x(n―r)1で割り算するという手
法が用いられていた。 しかるに、例えば、仮数部の表示桁数および指
数部の表示桁数が夫々9桁および3桁で表示可能
な範囲(即ち、演算可能な範囲)が―9.9999999
×1099〜9.9999999×1099である計算機に上記演算
方式を採用し、組合せ演算を算出しようとする場
合、70以上の数値n,rを入力すると、組合せ演
算nCr実行時に於ける分子のn1或いは分母のr1を
計算中にその途中結果が上記表示可能桁数より大
きい値となり、オーバーフローし、計算不能とな
つてしまう。ところが、例えば、数値n=80,r
=78を入力値とする組合せ演算80C78を実行しよ
うとする場合、演算結果は3160でこれは表示可能
にもかかわらず、階乗演算801の演算途中にてオ
ーバーフローとなり、上記組合せ演算の演算結果
が得られないという不都合があつた。即ち、計算
可能な入力データの範囲が極めて狭い範囲に限定
され、その演算の答が表示可能な組合せ演算すべ
てを計算し得ないという欠点があつた。 又、他方、上記組合せ演算は、nCr=nC(n
―r)の関係により、数値r(n―r)の大小関
係において、 (i) r≧n―rのとき nCr=n・(n―1)……(r+1)/(n―r)
!……(2) (ii) r<n―rのとき nCr=n・(n―1)……(n―r+1)/r!…
…(3) で求められるものである。 本発明は上記事情に鑑みてなされたもので、階
乗演算を利用し、且つ簡単な判断手段を付加する
のみで、表示可能な結果数の組合せ演算はすべて
計算可能とすると共に演算スピードの向上が計れ
る組合せ演算機能を有する小型電子式計算機を提
供するものである。 以下、図面を参照し、本発明の一実施例を説明
する。 第1図は、本発明の一実施例を示す回路ブロツ
ク図で、図中11は各種マイクロ命令がストアさ
れているROMである。そして、該ROM11から
は、後述する演算用メモリであるRAM12記被
演算数を記憶しているレジスタの行アドレスを指
定する信号SU、演算数を記憶しているレジスタ
の行アドレスを指定する信号FU、被演算数を記
憶しているレジスタの列アドレスあるいは処理開
始列アドレスを指定する信号SL時び演算数を記
憶しているレジスタの列アドレスあるいは処理終
了列アドレスを指定する信号FL、演算、判断ス
テツプ時に必要な数値コードを出力する数値コー
ド信号C0、演算命令、数値コード発生命令、転
送命令等のオペレーシヨンコードOP、および自
己の次アドレス指定する信号Naが各々バスライ
ンa〜gを介して並列的に出力している。そし
て、バスラインgを介して出力する信号Naは、
上記ROM11の内容が記憶されている番地を指
定するアドレスレジスタ13に一時的に記憶され
る。アドレスレジスタ13の出力は、ROMアド
レス部14に入力する。このROMアドレス部1
4は、アドレスレジスタ13から入力される信号
をデコードしてROM11のアドレスを選択指定
する。また、オペレーシヨンコードOpはバスラ
インfを介してオペレーシヨンデコーダ15に供
給される。このオペレーシヨンデコーダ15は、
上記オペレシヨンコードOpをデコードして例え
ば行指定アドレスFUにより指定されたレジスタ
のデータ出力指令OF、行指定アドレスSuにより
指定されたレジスタのデータ出力指令OS、キー
入力読込み指令KE、間接アドレス読出し指令
ID、減算指令SB、指定桁長さモードM、ジヤツ
ジ命令JU等の各種制御指令を出力する。また、
上記オペレーシヨンデコーダ15からタイミング
レコーダ16に制御指令が送られる。このタイミ
ングデコーダ16は、オペレーシヨンデコーダ1
5からの上記各制御指令、指定桁長まモードM及
び図示しないタイミングパルス発生部から与えら
れる第2図に示すクロツクパルスφ,φ、タ
イミングパルスt1〜t3に従つて各種タイミング信
号φa〜φd,ta〜tc、コード入力指令CI、読出
し/書込み指令R/W等を出力する。上記各タイ
ミング信号は φa=t3・φ・OP1 φb=t2・φ・OP1 φd=t3・φ・+Bφ ta=・ST+M・t1 tb=M・1 tc=・T である。なお、第2図に於てt1〜t3が1桁分であ
りRAM12よりデータを読出す際にはSuでアド
レス指定されたレジスタの内容がt1のタイミング
で読出され、Fuでアドレス指定されたレジスタ
の内容がt1のタイミングで読出され、Fuでアド
レス指定されたレジスタの内容がt2のタイミング
で読出される、また、書込みに於てはFuでアド
レス指定されたレジスタにt3のタイミングで書込
まれる。また、上記タイミング信号のOP1はオペ
レーシヨンデコーダ15から表示及びキーサンプ
リング命令、STは次のステツプのスタート指令
で命令ステツプの先頭においてフリツプフロツプ
17からタイミングデコーダ16に与えられる。
また、指定桁長さモードMは、RAM12の指定
が1桁の場合に“1”、2桁以上で“0”とな
る。 しかして、上記ROM11から出力される行指
定アドレス信号SU及びFUは、各々バスライン
a,bを介してゲート回路G1,G2に印加され、
これらゲート回路G1,G2の出力は、バスライン
hを介してRAM12の行アドレス入力端子RAU
に入力する。なお、上記ゲート回路G1には、図
示しないタイミング信号発生部から出力する上記
第2図に示すタイミング信号t1が直接供給され、
ゲート回路G2にはタイミング信号t1がインバータ
18を介して供給されて、ゲートの開閉制御が行
われる。また、ROM11から出力されるRAM1
2の列アドレスあるいは処理開始列指定イドレス
信号SL及び列アドレスあるいは処理終了列指定
アドレス信号FLはそれぞれバスラインc,dを
介してゲート回路G3,G4に加えられる。上記ゲ
ート回路G3,G4はタイミングデコーダ16から
出力されるタイミング信号ta,tb′によつてそれ
ぞれゲート制御される。そして上記ゲート回路
G3,G4の出力は入出力バスライン1に出力さ
れ、RAM12の列アドレス入力端子RALに入力
する。また、上記ゲート回路G3の出力は、カウ
ンタ20へ供給される。このカウンタ20は、タ
イミング信号φdによりカウント動作を行うもの
で、タイミング信号φdが入力される毎に1ずつ
カウントアツプする。そして、上記カウンタ20
の出力はゲート回路G5を介してRAM12の列ア
ドレス入力端子RALへ加えられると共に一致回
路21の一方の入力端に加えられる。この一致回
路21の他方の入力端にはROM11からバスラ
インdに出力される処理終了列指定アドレス信号
Lが与えられる。この一致回路21にはオペレ
ーシヨンデコーダ15から出力される指定桁長さ
モードMがインバータ22を介して与えられてお
り、このインバータ22の出力が“1”の時に一
致回路21が動作するようになつている。この一
致回路21の一致出力はアンド回路23に加えら
れると共にオア回路24を介してフリツプフロツ
プ17に入力される。さらにこのフリツプフロツ
プ17にはオペレーシヨンデコーダ15から出力
される指定桁長さモードMがオア回路24を介し
て与えられる。このフリツプフロツプ17はタイ
ミング信号t3・φに同期して入力信号を読込
み、次のタイミング信号t1に同期して、前記した
スタート指令STを出力する。また、上記オペレ
ーシヨンデコーダ15から出力される指定桁長さ
モードMはアンド回路25に加えられる。アンド
回路23,25にはタイミング信号t3・φが入
力されており、その出力信号はオア回路26を介
してアドレスレジスタ13に読込みクロツク信号
eとして送られる。 一方、上記RAM12は、第3図に示すような
桁数が16桁(0〜15桁)のレジスタが例えばX,
Y,Z,AおよびBの5個が行方向に設けられて
おり、その各レジスタの0〜1桁目は指数デー
タ、2桁目には上記指数データの正、負を示す符
号データ、3〜13桁目には仮数データ、14桁目に
は演算の種類、或いは、制御の種類を記憶するフ
ラグデータ、及び第15桁目には上記仮数データの
正、負を示す符号データが記憶される。尚、前記
各レジスタX,Y,Z,A,Bには(1)〜(5)行アド
レス番号が付してあり、上記各レジスタは、前記
行指定アドレス信号Fu、或いはSuにより上記ア
ドレス番号に対応したコードが出力された際にア
ドレス指定される。又、上記各レジスタの桁0〜
15は前記列指定アドレス信号FL或いはSLによつ
て指定される。又、上記RAM12の上記各レジ
スタのデータの読み出し、書き込みは上記タイミ
ングデコーダ16から出力されるR/W信号によ
つて制御され、この信号が“0”の時は読み出し
動作が行なわれ、“1”の時に書き込み動作が行
なわれるようになつている。 しかして、上記記行及び列アドレス信号により
アドレス指定され、演算後、被演算数、或いは転
送等のためにRAM12より所定のタイミングt1
およびt2で読出されるデータは、出力端子OUT
より並列4ビツトのデータとして出力され、タイ
ミング信号t1・φでゲート制御されるゲート回
路G6を介してラツチ回路27へ送られると共に
タイミング信号t2・φでゲート制御されるゲー
ト回路G7を介してラツチ回路28へ送られる。
そして、上記ラツチ回路27の出力は、オペレー
シヨンデコーダ15から出力される間接アドレス
読出し指令IDにより制御されるゲート回路G8
介してRAM12の列アドレス入力端子RALへ入
力される。さらにラツチ回路27の出力は、オペ
レーシヨンデコーダ15から出力されるデータ出
力指令OSにより制御されるゲート回路G9を介し
て演算回路29の入力端aに供給される。又、上
記ラツチ回路28からゲート回路G10を介して出
力されるデータは演算回路29の入力端bへ送ら
れると共にバツフア30へ送られる。このバツフ
ア30はタイミング信号φaに同期して動作する
もので、その出力はデコーダ31を介して表示部
32へ送られて表示される。しかして、上記演算
回路29は、演算データ出力ラインj及びキヤリ
ー出力ラインkを備えており、ラインjから出力
されるデータはRAM12の入力端子INへ入力さ
れると共にオア回路33を介してアンド回路34
へも加えられる。又、ラインkに出力されるキヤ
リーあるいはボロー信号はアンド回路35へ加え
られる。上記アンド回路34,35はオペレーシ
ヨンデコーダ15からジヤツジ命令JUが与えら
れた際に信号を出力するもので、アンド回路3
4,35の出力は、アドレスレジスタ13に分岐
ステツプのためにアドレスデータとして入力され
る。また、前記ラツチ回路27からゲート回路
G9を介して出力されるデータは、タイミング信
号φbに同期して動作するバツフア36へ入力さ
れる。このバツフア36の出力はデコーダ37を
介してキー入力部38へキーサンプリング信号と
して送られると共に表示部32へ表示桁選択信号
(デイジツト信号)として送られる。 上記キー入力部38から出力されるキー入力デ
ータは、タイミング信号t3・φに同期して動作
するバツフア39に貯えられ、オペレーシヨンデ
コーダ15から出力されるキー入力指令KEによ
り制御されるゲート回路G11を介して演算回路3
0の入力端子aに入力される。また、この入力端
子aにはROM11からラインeに出力される数
値コードC0がゲート回路G12を介して入力され
る。このゲー回路G12は、オペレーシヨンデコー
ダ15から出力されるコード入力指令CIによつ
て制御される。 次に第4図により、アドレスレジスタ13、
ROMアドレス部14、ROM11、オペレーシヨ
ンデコーダ15、タイミングデコーダ16の詳細
について説明する。なお、第4図は上記各回路部
についてnCrキーが操作された場合の処理に関係
する部分のみを示したもので、その他の部分につ
いては省略してある。アドレスレジスタ13はn
ビツト構成であるがそのうちの下位15ビツトが示
されており、その各ビツトにはROM11から出
力される5ビツトの次のアドレスNaが入力され
る。この場合、アドレスレジスタ13の第1、第
2ビツトには上記次アドレスNaと共にアンド回
路34,35の出力がオア回路41,42を介し
て入力される。上記アドレスレジスタ13の各ビ
ツト出力は、直接及びインバータを介してROM
アドレス部14へ送られ、ここでデコードされて
ROM11のアドレスを指定する。ROM11は
ROMアドレス部14からのアドレス指定によ
り、例えばSU,FU,SL,FL,CO,Op,Na
等の信号を出力する。この場合行指定アドレス信
号SU,FU3ビツトコードで、列指定アドレス信
号SL,FLおよびコード信号COは4ビツトコー
ドでオペレーシヨン信号OPおよび次アドレス信
号Naは5ビツトコードで出力される。オペレー
シヨンデコーダ15は、ROM11から出力され
るオペレーシヨンコードOPをデコードし、例え
ばSB,JU,M,OS,OF等の制御指令を出力す
る。タイミングデコーダ16はオペレーシヨンデ
コーダ15から出される制御信号に応じて各種タ
イミング信号との論理積回路が形成され、φd,
CI,R/W等の制御信号を上記タイミング信号
に同期して出力する。すなわち、タイミング信号
φdはオペレーシヨンデコーダ15から指定桁長
さ命令信号Mが出力されていない時のタイミング
信号t3 に同期して出力され、コード入力指令
信号CIはオペレーシヨンデコーダ15のラインl1
に信号“1”が出力している時スタート信号ST
に同期して出力される。そして読出し/書込み指
令信号R/Wはオペレーシヨンデコーダ15のラ
インl2に信号“1”が出力されている時、タイミ
ングt3に同期して“1”信号が出力する。この
時、上記RAM112は書き込みモードとなり、そ
の他は読み出しモードとなつている。尚、タイミ
ングデコーダ16より出力される第1図記載の他
のタイミング信号についての説明はここでは省略
されている。第5図は主なオペレーシヨンに対す
るオペレーシヨンコードOPとその時出力される
各制御製信号との関係を示したものである。 又、第6図は各ステツプ実行のため選択される
アドレスとその時出力される主な各種制御信号と
の関係を示す図である。 次に上記のように構成された本発明の動作を第
7図及び第8図のフローチヤート、並びに第9図
に示すX,Y,A,Bの記憶状態図を参照して説
明する。 今、演算例:12C7=792 ……(4) を例にとり、キー入力部38で□1□2(第1の数値
n)12C7□7(第2の数値r)□=のキー操作が行な
われ、その入力データがレジスタX,Y,A,B
に第9図aの如くX=12,Y=5,A=0,B=
0が各々記憶され、上記(4)式の組合せ演算が計算
機内部で開始される時点から説明する。 尚、第9図において各レジスタはその第12桁目
と第11桁目の間が表示に対しての固定的な小数的
位置になつており、指数部の下2桁(0および1
桁目)で10のべき乗桁を表わし、指数部の3桁目
でべき乗数の符号(“1”で「+」,“0”で
「−」を表わし、第15桁目で仮数の符号(“0”で
「+」、“1”で「−」)を表わしている。即ち、例
えば、第9図aのXレジスタの内容は
1.200000000 101を意味し、数値12を表わしてい
る。又、同図のXレジスタの第14桁目の記号
「F」は組合せ演算コードで、キー入力部38で
組合せ演算用キーncrが操作されると上記第14桁
目に所定の制御により書き込まれるものである。 上記の如くキー操作がなされると各レジスタの
状態は上述の如く第9図aとなり、計算機内部で
はステツプSAに入り、Xレジスタの内容「12」
をAレジスタに転送する動作が実行される。この
ステツプSAにおいてはアドレスレジスタ13に
よりROMアドレス部14を介してROM11の1
番地がアドレスされ、ROM11からオペレーシ
ヨンコードOpとして「0100」(2進数)が出力さ
れる。このオペレシヨンコードOpは、第4図に
示すオペレーシヨンデコーダ15でデコードさ
れ、信号OSが“1”となり、又、この時タイミ
ング信号t3に同期して信号R/Wがタイミングデ
コーダ16より出力される。この時、ROM11
から出力される行指定アドレス信号Suは「001」
(1),Fuは「100」(4)、列アドレス信号SL
「0000」(0),FL「1111」(15)が出力される。
従つて、このステツプの最初のデイジツトの1サ
イクルであるt1のタイミングにおいて、上記信号
Su(1)がゲート回路G1を介して、又信号SL(0)
がゲート回路G3(この時信号Mは“0”よりta=
ST+M・t1は“t”)を介してそれぞれRAM1
2の端子RAUおよび端子RALに供給され、RAM
12内のXレジスタの0桁目が指定される。これ
によりXレジスタの0桁目の内容「1」が読み出
され、t1・φのタイミングでゲート回路G6を介
してラツチ回路27へセツトされる。この時信号
OPが“1”であるのでラツチ回路27にセツト
された内容はゲート回路G9を介して演算回路2
9へ入力されるようになる。又、この時、上記信
号SLの内容(0)がカウンタ20にセツトされ
る。次にt2のタイミングでは何もおこなわれず、
次にt3のタイミングにおいて、信号FU(4)と上記
した信号SL(0)により、RAM12はAレジス
タの0桁目が指定されると共に、上述したR/W
信号が“1”より読み出しモードから書き込みモ
ードとなる。従つて上記ラツチ回路27にセツト
されていたXレジスタの0桁目の内容「1」がゲ
ート回路G9、演算回路29を介してRAM12の
入力端子INよりAレジスタの0桁目に書き込ま
れる。この時、カウンタ20の内容はタイミング
デコーダ16により出力されるタイミング信号
bによりその内容が+1されて、その値が「1」
となる。又、上記SL信号(0)および信号FL
(15)は信号で作動する一致する回路21に供
給され、一致か否かが比較される。ここでは一致
信号が出力されないのでアンド回路23は開かれ
ない。一方、このステツプではオペレーシヨンデ
コーダ15からは信号Mは出力されないのでアン
ド回路25も開かれない。従がつて、オア回路2
6からは読み込みクロツクeは出力されず、ア
ドレスレジスタ13の内容は更新されないまま次
のデイジツトサイクルt1〜t3へ入る。このサイク
ルではXレジスタの1桁目の内容をAレジスタの
1桁目に転送する。まず、t1のタイミングで、信
号SU(0)がゲート回路G1を介してRAM12に
供給されて、Xレジスタを指定し、又、列アドレ
ス信号は信号SL(ゲート回路G3が開かれない)
に変わつて、上記カウンタ20の内容1がタイミ
ング信号tにより開かれるゲート回路G5を介し
てRAM12のRAL端子に供給され、第1桁目が
指定される。このアドレス指定により、Xレジス
タの1桁目の内容「0」が読み出され、ラツチ回
路27にセツトされる。そして、上記したと同様
の動作によりt3のタイミングで、このラツチ回路
27にセツトされた内容がRAM12内のAレジ
スタ第1桁目に書き込まれる。又、上記ゲート回
路G5の出力はカウンタ20の入力側及び一致回
路21にも印加されているので、このt3のタイミ
ングにおいて、タイミング信号φによりカウン
タ20の内容が再び+1されて「2」となると共
に、一致回路21では上記信号FL(15)との一
致が比較される。この時も一致しないので一致回
路21からは一致信号が得られず、上記したと同
様にしてアドレスレジスタ13のアドレス内容は
更新されず、、次のデイジツトサイクルに入る。
このようにして、Xレジスタの0〜15桁の各桁の
内容をカウンタ20により列アドレス指定しなが
ら順次Aレジスタの対応する桁に転送する動作が
繰り返される。そして、上記カウンタ20の内容
が「15」となると、Xレジスタの15桁目の内容が
Aレジスタの15桁目にt3のタイミングで転送され
る。これと同時に一致回路21では上記カウンタ
20の内容「15」と信号FL(15)との一致がと
れ、一致信号が出力される。この一致信号はオア
回路24を介してフリツプフロツプ17に与えら
れ、t3・φのタイミングで読み込まれる。そし
てクロツクパルスに同期してスタート信号
STが出力されてタイミングデコーダ16に与え
られる。従つて、上記スタート信号STは、次の
処理ステツプの最初のデイジツトサイクルで出力
することになる。更に上記一致信号は上記タイミ
ングt3に同期してアンド回路23、オア回
路26を介して読み込みクロツクパルスeとし
てアドレスレジスタ13に与えられ、アドレスレ
ジスタ13の内容が変更される。この時、アドレ
スレジスタ13に与えられているアドレス信号
は、オペレーシヨンデコーダ15より信号JU
出力されていないので、ROM11より出力され
ている次アドレス信号Na(「11110」(30)」のみ
であり、そのアドレス内容が(30)に変更されて
次のステツプSBに進む。 次にステツプSBではYレジスタの内容「7」
をBレジスタに転送する動作が実行される。この
ステツプSBではROM11の30番地がアドレスさ
れ、ROM11からオペレーシヨンコードOpとし
て「0100」(第6図参照)が出力される。このオ
ペレーシヨンコードOpの出力によりオペレーシ
ヨンコーダ15からは信号OSが“1”となり、
又この時タイミングデコーダ16からは信号R/
Wがタイミング信号t3に同期して出力される(第
5図参照)この時、ROM11から出力さる行指
定アドレス信号SU「010」(2)、FUは「101」(5)、
列アドレス信号SLは「0000」(0)、FL「1111」
(15)が出力される。そしてこれらの信号に制御
されてステツプSAと同様な動作が実行されて、
Yレジスタの内容「7」がBレジスタに転送され
る。この動作が完了するとこの時ROM11から
出力されている次アドレス信号Naは「00010」(2)
であるからそのアドレス内容が(2)に変更されて次
のステツプScに進む。その際の各レジスタの状
態は第9図bに示される如くとなる。 次にステツプScではAレジスタの内容「12」
よりYレジスタの内容「7」を減算し、その結果
をAレジスタに書き込む動作が行なわれる。即
ち、数値(n―r)を算出してAレジスタに書き
込む動作が実行される。このステツプScでは
ROM11の2番地がアドレスされ、オペレーシ
ヨンコードOpとして「0101」が出力さされる。
(第6図参照)尚、この減算動作を行うに際し
て、実際は、まずAレジスタの内容とYレジスタ
の内容との小数点位置を合わせるためのステツプ
が行なわれ、Aレジスタの仮数部の内容が一桁分
左シフトされると共に指数部の内容が「100」と
なる。即ち、YレジスタおよびAレジスタの仮数
部内容は
The present invention relates to a small electronic calculator capable of combinatorial calculations. Recently, in the field of small electronic calculators, such as electronic desktop calculators, with the spread of these devices, there is a trend toward smaller and thinner devices, as well as higher functionality.
In addition to various arithmetic functions such as trigonometric functions, exponential functions, logarithmic functions, and factorial operations, computers that can also perform permutation operations (nPr) and combination operations (nCr) have been put into practical use. On the other hand, in the case of conventional computers of this type, combinatorial calculations have been (However, n and r are both positive integers) When calculating, it was necessary to use the same subroutines as much as possible, avoid adding unnecessary steps and associated complicated circuits, and reduce the size of the circuit. Therefore, conventionally, when calculating a combinational operation, a calculation method was used in which a subroutine for performing a factorial calculation, which was originally provided in a computer, was used as is. That is, in the above formula, first
Calculate n1, then calculate the denominator r1 and (n-r)1, then calculate r1x(n-r)1, and finally divide the above n1 by r1x(n-r)1. method was used. However, for example, the number of digits displayed in the mantissa and the number of digits displayed in the exponent are 9 digits and 3 digits, respectively, and the range that can be displayed (that is, the range that can be calculated) is -9.9999999.
×10 99 ~ 9.9999999 × 10 99 If you use the above calculation method on a computer and try to calculate a combination operation, if you input numbers n and r of 70 or more, n1 or n1 of the numerator when executing the combination operation nCr While calculating the denominator r1, the intermediate result becomes a value larger than the number of digits that can be displayed, causing an overflow and making calculation impossible. However, for example, the number n=80, r
When trying to execute the combinational operation 80 C 78 with =78 as the input value, the result is 3160 and even though this can be displayed, an overflow occurs during the factorial operation 801, and the above combinational operation cannot be performed. The problem was that no results were obtained. That is, the range of input data that can be calculated is limited to an extremely narrow range, and it is not possible to calculate all combinational operations whose answers can be displayed. On the other hand, the above combinational operation is nCr=n C (n
-r), in the magnitude relationship of the numerical value r (n-r), (i) When r≧n-r, nCr=n・(n-1)...(r+1)/(n-r)
! ...(2) (ii) When r<n-r, nCr=n・(n-1)...(n-r+1)/r! …
...(3). The present invention has been made in view of the above circumstances, and by using factorial operations and adding a simple judgment means, it is possible to calculate all combinations of results that can be displayed, and to improve the calculation speed. The object of the present invention is to provide a small electronic calculator that has a combinatorial calculation function that can measure. Hereinafter, one embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a circuit block diagram showing one embodiment of the present invention, and numeral 11 in the figure is a ROM in which various microinstructions are stored. Then, from the ROM 11, a signal S U which specifies the row address of the register storing the operands stored in RAM 12, which is a memory for calculations described later, and a signal specifying the row address of the register storing the operands are sent. F U , a signal S L specifying the column address of the register storing the operand or the processing start column address; and a signal F L specifying the column address of the register storing the operand or the processing end column address. , a numeric code signal C 0 that outputs a numeric code necessary for calculation and judgment steps, an operation code OP such as an arithmetic instruction, a numeric code generation instruction, and a transfer instruction, and a signal Na that designates its own next address are connected to the bus line a. ~g is output in parallel. The signal Na output via the bus line g is
The contents of the ROM 11 are temporarily stored in an address register 13 that specifies the address where the contents are stored. The output of the address register 13 is input to the ROM address section 14. This ROM address section 1
4 decodes the signal input from the address register 13 and selects and specifies the address of the ROM 11. Further, the operation code Op is supplied to the operation decoder 15 via the bus line f. This operation decoder 15 is
Decode the above operation code Op to read out, for example, the data output command OF of the register specified by the row designation address F U , the data output command OS of the register designated by the row designation address Su, the key input read command KE, and the indirect address read. Command
Outputs various control commands such as ID, subtraction command SB, specified digit length mode M, and change command JU. Also,
A control command is sent from the operation decoder 15 to the timing recorder 16. This timing decoder 16 is an operation decoder 1
Various timing signals φa are generated in accordance with the above control commands from 5, specified digit length mode M, and clock pulses φ 1 , φ 2 and timing pulses t 1 to t 3 shown in FIG. 2 given from a timing pulse generator (not shown). ~φd, ta~tc, code input command CI, read/write command R/W, etc. are output. The above timing signals are φa=t 3・φ 1・OP 1 φb=t 2・φ 1・OP 1 φd=t 3・φ 1・+Bφ 1 ta=・S T +M・t 1 tb=M・1 tc =・T. In Figure 2, t 1 to t 3 correspond to one digit, and when reading data from the RAM 12, the contents of the register addressed by Su are read at the timing of t 1 , and the contents of the register addressed by Fu are read out at the timing of t 1. The contents of the register addressed by Fu are read at timing t 1 , the contents of the register addressed by Fu are read at timing t 2 , and when writing, the contents of the register addressed by Fu are read at timing t 3 . It is written at the timing of Further, the timing signal OP1 is a display and key sampling command from the operation decoder 15, and ST is a start command for the next step, which is supplied from the flip-flop 17 to the timing decoder 16 at the beginning of the command step.
Further, the designated digit length mode M is "1" if the RAM 12 designation is one digit, and "0" if it is two or more digits. The row designation address signals S U and F U output from the ROM 11 are applied to the gate circuits G 1 and G 2 via the bus lines a and b, respectively, and
The outputs of these gate circuits G 1 and G 2 are sent to the row address input terminal RAU of the RAM 12 via the bus line h.
Enter. The gate circuit G 1 is directly supplied with the timing signal t 1 shown in FIG. 2, which is output from a timing signal generation section (not shown), and
A timing signal t 1 is supplied to the gate circuit G 2 via an inverter 18 to control opening and closing of the gate. Also, RAM1 output from ROM11
The column address or processing start column designation address signal S L and the column address or processing end column designation address signal F L of 2 are applied to gate circuits G 3 and G 4 via bus lines c and d, respectively. The gate circuits G 3 and G 4 are gate-controlled by timing signals ta and tb' outputted from the timing decoder 16, respectively. And the above gate circuit
The outputs of G 3 and G 4 are output to the input/output bus line 1 and input to the column address input terminal RAL of the RAM 12. Further, the output of the gate circuit G 3 is supplied to the counter 20 . This counter 20 performs a counting operation in response to a timing signal φd, and counts up by one each time the timing signal φd is input. Then, the counter 20
The output of is applied to the column address input terminal RAL of the RAM 12 via the gate circuit G 5 and also applied to one input terminal of the matching circuit 21. The other input terminal of the matching circuit 21 is supplied with a processing end column designation address signal F L outputted from the ROM 11 to the bus line d. The specified digit length mode M output from the operation decoder 15 is applied to this matching circuit 21 via an inverter 22, so that the matching circuit 21 operates when the output of this inverter 22 is "1". It's summery. The coincidence output of this coincidence circuit 21 is applied to an AND circuit 23 and is also inputted to a flip-flop 17 via an OR circuit 24. Furthermore, the specified digit length mode M output from the operation decoder 15 is applied to the flip-flop 17 via an OR circuit 24. This flip-flop 17 reads an input signal in synchronization with the timing signal t3 · φ1 , and outputs the above-mentioned start command ST in synchronization with the next timing signal t1 . Further, the specified digit length mode M output from the operation decoder 15 is applied to the AND circuit 25. Timing signals t 3 and φ 1 are input to AND circuits 23 and 25, and their output signals are sent to address register 13 via OR circuit 26 as read clock signal e. On the other hand, the RAM 12 has registers with 16 digits (0 to 15 digits) as shown in FIG.
Five registers Y, Z, A, and B are provided in the row direction, and the 0th to 1st digits of each register are exponent data, the 2nd digit is code data indicating the positive or negative of the exponent data, and 3. The 13th digit stores mantissa data, the 14th digit stores flag data that stores the type of operation or control, and the 15th digit stores sign data that indicates whether the mantissa data is positive or negative. Ru. Each of the registers X, Y, Z, A, and B is assigned a row address number (1) to (5), and each register is assigned the address number by the row designation address signal Fu or Su. The address is specified when the code corresponding to is output. Also, the digits of each register above
15 is designated by the column designation address signal F L or S L . Further, reading and writing of data in each of the registers of the RAM 12 is controlled by the R/W signal output from the timing decoder 16, and when this signal is "0", a read operation is performed; ”, the write operation is performed. Therefore, the address is specified by the row and column address signals mentioned above, and after the operation, the RAM 12 outputs the address at a predetermined timing t 1 for the operand, transfer, etc.
The data read at and t 2 is output at the output terminal OUT
The data is output as parallel 4-bit data, and sent to the latch circuit 27 via the gate circuit G6 , which is gate-controlled by the timing signals t 1 and φ 1, and is also gate-controlled by the timing signals t 2 and φ 1. It is sent to the latch circuit 28 via G7 .
The output of the latch circuit 27 is input to the column address input terminal RAL of the RAM 12 via a gate circuit G8 controlled by the indirect address read command ID output from the operation decoder 15. Furthermore, the output of the latch circuit 27 is supplied to the input terminal a of the arithmetic circuit 29 via a gate circuit G9 controlled by the data output command OS output from the operation decoder 15. Further, the data outputted from the latch circuit 28 via the gate circuit G10 is sent to the input terminal b of the arithmetic circuit 29 and also to the buffer 30. This buffer 30 operates in synchronization with the timing signal φa, and its output is sent via a decoder 31 to a display section 32 for display. The arithmetic circuit 29 is equipped with an arithmetic data output line j and a carry output line k, and the data output from the line j is input to the input terminal IN of the RAM 12 and sent to the AND circuit via the OR circuit 33. 34
It can also be added to. Further, a carry or borrow signal outputted to line k is applied to an AND circuit 35. The AND circuits 34 and 35 output signals when the operation decoder 15 gives a judge command JU, and the AND circuit 3
The outputs of 4 and 35 are input to the address register 13 as address data for the branch step. Further, from the latch circuit 27 to the gate circuit
The data output via G9 is input to the buffer 36 which operates in synchronization with the timing signal φb. The output of the buffer 36 is sent to the key input section 38 as a key sampling signal via a decoder 37, and is also sent to the display section 32 as a display digit selection signal (digit signal). The key input data outputted from the key input unit 38 is stored in a buffer 39 that operates in synchronization with the timing signal t3 · φ1 , and is sent to a gate controlled by the key input command KE outputted from the operation decoder 15. Arithmetic circuit 3 via circuit G 11
It is input to input terminal a of 0. Further, the numerical code C0 outputted from the ROM 11 to the line e is inputted to this input terminal a via the gate circuit G12 . This game circuit G12 is controlled by the code input command CI output from the operation decoder 15. Next, according to FIG. 4, the address register 13,
Details of the ROM address section 14, ROM 11, operation decoder 15, and timing decoder 16 will be explained. It should be noted that FIG. 4 shows only the parts related to the processing when the nCr key is operated for each of the above-mentioned circuit parts, and other parts are omitted. Address register 13 is n
Of the bit configuration, the lower 15 bits are shown, and the next 5-bit address Na output from the ROM 11 is input to each bit. In this case, the outputs of the AND circuits 34 and 35 are input to the first and second bits of the address register 13 via the OR circuits 41 and 42 together with the next address Na. Each bit output of the address register 13 is sent to the ROM directly and via an inverter.
It is sent to the address section 14, where it is decoded.
Specify the address of ROM11. ROM11 is
For example, S U , F U , S L , F L , C O , Op, Na
Outputs signals such as In this case, the row designation address signals S U and F U are output as 3-bit codes, the column designation address signals S L , F L and the code signal C O are output as 4-bit codes, and the operation signal OP and the next address signal Na are output as 5-bit codes. The operation decoder 15 decodes the operation code OP output from the ROM 11 and outputs control commands such as SB, JU, M, OS, OF, etc. The timing decoder 16 forms an AND circuit with various timing signals according to the control signal output from the operation decoder 15, and outputs φd,
Control signals such as CI and R/W are output in synchronization with the timing signal. That is, the timing signal φd is output in synchronization with the timing signal t 3 1 when the specified digit length command signal M is not output from the operation decoder 15, and the code input command signal CI is output from the line l of the operation decoder 15. 1
Start signal ST when signal “1” is output to
output in sync with The read/write command signal R/W is output as a "1" signal in synchronization with timing t3 when the signal "1" is output on line l2 of the operation decoder 15. At this time, the RAM 112 is in write mode, and the others are in read mode. Note that descriptions of other timing signals shown in FIG. 1 output from the timing decoder 16 are omitted here. FIG. 5 shows the relationship between the operation code OP for the main operations and each control signal output at that time. Further, FIG. 6 is a diagram showing the relationship between the addresses selected for execution of each step and the main various control signals output at that time. Next, the operation of the present invention configured as described above will be explained with reference to the flowcharts of FIGS. 7 and 8 and the storage state diagram of X, Y, A, and B shown in FIG. 9. Now, taking the calculation example: 12 C 7 = 792 ...(4) as an example, use the key input section 38 to enter □1□2 (first numerical value n) 12 C 7 □7 (second numerical value r)□= A key operation is performed and the input data is stored in registers X, Y, A, B.
As shown in Figure 9a, X=12, Y=5, A=0, B=
The explanation will start from the point in time when each 0 is stored and the combinatorial operation of the above equation (4) is started inside the computer. In addition, in Figure 9, the decimal position between the 12th and 11th digits of each register is fixed for the display, and the last two digits of the exponent part (0 and 1
digit) represents the power digit of 10, the third digit of the exponent part represents the sign of the power (“1” represents “+”, “0” represents “-”, and the 15th digit represents the significand of the mantissa ( "0" represents "+" and "1" represents "-").For example, the contents of the X register in Figure 9a are
1.200000000 10 means 1 and represents the number 12. Further, the symbol "F" in the 14th digit of the X register in the same figure is a combination operation code, and when the combination operation key ncr is operated in the key input unit 38, it is written in the 14th digit according to a predetermined control. It is something. When the key operations are performed as described above, the state of each register becomes a as shown in FIG.
An operation is performed to transfer the A register to the A register. In this step S A , the address register 13 sends the ROM 11 through the ROM address section 14.
The address is addressed, and "0100" (binary number) is output from the ROM 11 as the operation code Op. This operation code Op is decoded by the operation decoder 15 shown in FIG. 4, and the signal OS becomes "1". At this time, the signal R/W is output from the timing decoder 16 in synchronization with the timing signal t3 . be done. At this time, ROM11
The row designation address signal Su output from is "001"
(1), Fu is output as "100" (4), column address signal S L is output as "0000" (0), and F L is output as "1111" (15).
Therefore, at timing t1 , which is one cycle of the first digit of this step, the above signal
Su(1) passes through the gate circuit G1 , and the signal S L (0)
is the gate circuit G 3 (at this time, the signal M is from “0” to ta=
ST+M・t 1 is “t”) respectively RAM1
2 terminal RAU and terminal RAL, RAM
The 0th digit of the X register in 12 is specified. As a result, the content "1" in the 0th digit of the X register is read out and set to the latch circuit 27 via the gate circuit G6 at the timing of t1 · φ1 . At this time the signal
Since OP is “1”, the contents set in the latch circuit 27 are sent to the arithmetic circuit 2 via the gate circuit G9 .
9 will be input. Also, at this time, the content (0) of the signal S L is set in the counter 20. Next, at timing t 2 , nothing is done,
Next, at timing t3 , the RAM 12 is designated with the 0th digit of the A register by the signal F U (4) and the above-mentioned signal S L (0), and the above-mentioned R/W
When the signal becomes "1", the mode changes from the read mode to the write mode. Therefore, the content "1" in the 0th digit of the X register set in the latch circuit 27 is written to the 0th digit of the A register from the input terminal IN of the RAM 12 via the gate circuit G 9 and the arithmetic circuit 29. At this time, the contents of the counter 20 are incremented by 1 by the timing signal b output by the timing decoder 16, and the value becomes "1".
becomes. Moreover, the above S L signal (0) and the signal F L
(15) is supplied to a signal-operated matching circuit 21 and compared to see if there is a match. Since no coincidence signal is output here, the AND circuit 23 is not opened. On the other hand, in this step, since the signal M is not output from the operation decoder 15, the AND circuit 25 is not opened either. Therefore, OR circuit 2
From 6 onwards, the read clock e is not output, and the next digit cycle t1 to t3 is entered without updating the contents of the address register 13. In this cycle, the contents of the first digit of the X register are transferred to the first digit of the A register. First, at timing t1 , the signal S U (0) is supplied to the RAM 12 via the gate circuit G 1 to specify the X register, and the column address signal is supplied to the RAM 12 via the gate circuit G 1 . (Not available)
Instead, the content 1 of the counter 20 is supplied to the RAL terminal of the RAM 12 via the gate circuit G5 opened by the timing signal t, and the first digit is designated. By this address designation, the content "0" of the first digit of the X register is read out and set in the latch circuit 27. Then, by the same operation as described above, the contents set in the latch circuit 27 are written to the first digit of the A register in the RAM 12 at timing t3 . Furthermore, since the output of the gate circuit G5 is also applied to the input side of the counter 20 and the coincidence circuit 21, at the timing of t3 , the content of the counter 20 is again incremented by 1 by the timing signal φ0 and becomes "2". '', and the coincidence circuit 21 compares the coincidence with the signal F L (15). Since there is no match at this time, no match signal is obtained from the match circuit 21, and the address contents of the address register 13 are not updated in the same way as described above, and the next digit cycle begins.
In this way, the operation of sequentially transferring the contents of each of the 0 to 15 digits of the X register to the corresponding digit of the A register while specifying the column address by the counter 20 is repeated. When the content of the counter 20 becomes "15", the content of the 15th digit of the X register is transferred to the 15th digit of the A register at timing t3 . At the same time, the matching circuit 21 finds a match between the content "15" of the counter 20 and the signal F L (15), and outputs a matching signal. This coincidence signal is applied to the flip-flop 17 via the OR circuit 24, and read at the timing t3 · φ1 . Then, the start signal is synchronized with clock pulse 2 .
ST is output and given to the timing decoder 16. Therefore, the start signal ST will be output in the first digit cycle of the next processing step. Further, the coincidence signal is applied to the address register 13 as a read clock pulse e through the AND circuit 23 and the OR circuit 26 in synchronization with the timing t3.1 , and the contents of the address register 13 are changed. At this time, since the signal J U is not output from the operation decoder 15, the address signal given to the address register 13 is only the next address signal Na ("11110"(30)") output from the ROM 11. Yes, the contents of the address are changed to (30) and the process advances to the next step S B. Next, in step S B , the contents of the Y register are changed to "7".
An operation is performed to transfer the data to the B register. In this step S B , address 30 of the ROM 11 is addressed, and the ROM 11 outputs "0100" (see FIG. 6) as the operation code Op. With the output of this operation code Op, the signal OS from the operation coder 15 becomes "1",
At this time, the timing decoder 16 outputs the signal R/
W is output in synchronization with the timing signal t3 (see Figure 5). At this time, the row designation address signal S U output from the ROM 11 is "010" (2), F U is "101" (5),
Column address signal S L is “0000” (0), F L is “1111”
(15) is output. Then, under the control of these signals, an operation similar to step S A is executed,
The content "7" of the Y register is transferred to the B register. When this operation is completed, the next address signal Na output from the ROM11 at this time is "00010" (2)
Therefore, the address contents are changed to (2) and the process proceeds to the next step Sc. The state of each register at that time is as shown in FIG. 9b. Next, in step Sc, the contents of the A register are "12".
Then, the content "7" of the Y register is subtracted and the result is written to the A register. That is, an operation of calculating a numerical value (nr) and writing it into the A register is executed. In this step Sc
Address 2 of the ROM 11 is addressed, and "0101" is output as the operation code Op.
(See Figure 6) When performing this subtraction operation, in reality, a step is first performed to match the decimal point positions of the contents of the A register and the contents of the Y register, and the contents of the mantissa part of the A register are one digit. At the same time, the contents of the exponent part become "100". That is, the mantissa contents of the Y register and A register are

【表】 となるが、ここではそのステツプのROM11で
の命令状態図および動作についての説明は省略す
る。そして次の減算動作作の命令が示してある。 上述の如く、ROM11よりオペレーシヨンコ
ードOP「0101」が出力されると、オペレーシヨ
ンデコーダ15からは減算信号SB、制御信号OS
およびOFが出力され、又タイミングデコーダ1
6からは読出し書き込み信号R/Wがタイミング
信号t3に同期して出力される。この時、ROM1
1から出力される行指定アドレス信号SU
「010」(2)、FUは「100」(4)、列アドレス信号SL
は「0011」(3)、FL「1101」(13)が出力される。
なお、この時信号Mは「0」であり、は“1”
である従つて、このステツプの最初のデイジツト
サイクルのt1のタイミングでは、上記信号SU(2)
がゲート回路G1を介して、又、信号SL(3)はtaの
タイミングで開かれるゲート回路G3を介して
RAM12の端子RAU、および端子RALに供給さ
れ、RAM12内のYレジスタの3桁目が指定さ
れる。そして、RAM12の信号R/Wは“0”
信号即ち、読み出し信号が供給される。これによ
りYレジスタの3桁目の内容「0」が読み出れ、
t1のタイミングでゲート回路G6を介してラ
ツチ回路27へセツトされる。この時、信号OS
が“1”であるのでラツチ回路G9を介して演算
回路29のa端子に与えられる。又、この時上記
信号SLの内容(3)がカウンタ20にセツトされ
る。次にt2のタイミングでは、ゲート回路G1が閉
じゲート回路G2が開かれるので行アドレス信号
U(4)がRAM12のRAU端子に供給されると共
に列アドレス信号はSL(3)がゲート回路G3を介し
て引き続きRAL端子に供給され、Aレジスタの
3桁目が指定される。これにより、Aレジスタの
3桁目の内容がRAM12のOUT端子より読み出
され、t2のタイミングでゲート回路G7を介
してラツチ回路28にセツトされる。この時、信
号OFが“1”であるのでラツチ回路28にセツ
トされた内容は演算回路29のb端子に与えられ
る。次にt3ねタイミングになると、RAM12へ
の行アドレス信号並びに列アドレス信号はt2のタ
イミングと同様でAレジスタの3桁目が指定され
ているが、R/W信号はこのタイミングではタイ
ミングデコーダ16より“1”が供給され、書き
込みモードとなる。そして、演算回路29ではオ
ペレーシヨンデコーダ15からの減算信号SBに
より、上記RAM12より読み出されたAレジス
タの3桁目の内容よりYレジスタの3桁目の内容
の減算、即ち、「0―0」がおこなわれ、その結
果がパスラインjを介してRAM12のIN端子よ
りAレジスタの3桁目に書込まれる。この時、カ
ウンタ20の内容はタイミングデコーダ16より
出力されるタイミング信号Dによりその内容が
され、その値が「4」となる。又上記SL
号(3)および信号FL(15)が信号で作動する一
致回路21に供給され、比較される。しかしなが
ら、ここでは一致が得られず一致回路21からは
一致信号が得られない。従がつて、ステツプSA
と同様の動作でアドレスレジスタ13のアドレス
内容は変更されずに次のデイジツトサイクルt1
t3に入る。ここでも、演算回路29での演算とし
て減算が行なわれるほかはステツプSAと同様の
動作により、Aレジスタの第4桁目の内容よりY
レジスタの第4桁目の内容が減算(0―0)さ
れ、その結果Aレジスタの第4桁目に「0」が書
き込まれる。同様に各デイジツトサイクルが繰り
返され各桁毎の減算が13桁目まで行なわれる。そ
の結果、A―Y=「12―7」即ち、数値「5」が
Aレジスタに貯えられ、第9図cの如くのレジス
タ状態となる。このように両レジスタ間の第13行
目までの減算が行なわれるサイクルでは、一致回
路21より一致信号が出力される。この一致信号
はステツプSAと同様にして、オア回路24を介
してフリツプフロツプ17に加えられ、スタート
信号STを出力すると共にアンド回路23、オア
回路26を介してアドレスレジスタ13に読み込
みクロツクパルスeとして加えられる。この
時、アドレスレジスタ13に与えられているアド
レス信号はROM11より出力されている次アド
レス信号Ne〔「00011」(3)〕のみであり、そのア
ドレスの内容が(3)に変更され、ステツプSDに進
む。この際各レジスタの状態は第9図cに示され
る如くとなる。 次のステツプSDではYレジスタの内容(第2
の数値r)とAレジスタの内容(数値n―r)と
の大小関係の判断がおこなわれる。即ちこのステ
ツプはr≧n―rならば上述した(2)式にもとづく
演算を実行する準備がなされ、他方、r<n―r
ならば(3)式にもとづく演算の準備のためになされ
る。このステツプのオペレーシヨンコードOPは
第6図に示される如く「0111」でこれによりオペ
レーシヨンデコーダ15からは信号OF,OS、減
算信号SB、判断信号JUが出力される。又、この
時ROM11からは行指定アドレス信号SU
「100」(4)、FU「101」(2)、列アドレス信号SL
「0000」(0)、FL「1101」(13)が出力される。
従つて、上記ステツプScと同様の動作でこの場
合Yレジスタの内容「7」よりAレジスタの内容
「5」の減算動作による減算ジヤツジが演算回路
29で行なわれ、その判断結果、即ち、データ有
り信号とキヤリー信号が各々オア回路33および
ラインkを介してアンド回路35,36に送られ
る。この実施例では「7―5=2」即ちr≧n―
rより、データ有り信号のみがオア回路33を介
してアンド回路35に加えられる。この時、アン
ド回路35の他方の入力端にはオペレーシヨンデ
コーダ15より判断信号JUが印加されているの
でアンド回路35から“1”信号が出力し、オア
回路41を介してアドレスレジスタ13の1ビツ
ト目に供給される。この時ROM11からの次ア
ドレス信号Naは「00101」(5)より上記アンド回路
35から出力があつたとしてもその次アドレス
Na信号の内容は変更されずにアドレスレジスタ
13に読み込まれ、次のステツプSEに進むこと
となる。尚、もしも、Yレジスタの内容がAレジ
スタの内容よりも小の場合即ち、r<n―rの場
合は演算回路29よりデータ有り信号及びキヤリ
ー信号が出力され、これら信号の各々がアンド回
路35,36に印加され、オア回路41,42を
介してその判断信号がアドレスレジスタ13に印
加され、アドレスレジスタの内容を7番地に変化
させるようにし、そのまま、階乗演算(I)のス
テツプへと進むようになる。しかして、この実施
例の場合は上述の如く5番地のアドレスが指定さ
れステツプSEへと進む。 次にステツプSEではAレジスタの内容「5」
がZレジスタに転送する動作が行なわれる。この
ステツプSEでのオペレーシヨンコードOpは
「0100」であり、オペレーシヨンデコーダ15よ
り信号OSおよタイミングデコーダ16より読み
出し/書き込み信号R/Wが出力され、又、この
時ROM11から行アドレス指定信号SU「100」
(4)、(Aレジスタ)FU「011」(3)(Zレジスタ)、
列アドレス信号SL「000」、FL「1111」が出力さ
れ、ステツプSAと同様の動作によりAレジスタ
の内容がZレジスタに転送される。そして、この
時ROM11の次アドレス信号Na「01000」(8)よ
り、アドレスレジスタ13の内容が「8」に変更
されて次のステツプSFへ進む。 次のステツプSFでは上記ステツプSEと同様の
動作によりBレジスタ内容「7」がAレジスタに
転送され、アドレスレジスタ13の内容が「9」
に変更されステツプSGへ進む。そしてこのステ
ツプSGでは上記ステツプSEと同様の同作によ
り、Zレジスタの内容「5」がBレンスタに転送
される。即ち、上記ステツプSDの判断結果に基
づきステツプSE,SF,SGによりAレジスタの
内容(n―r)とBレジスタの内容rとの交換動
作がなされ、Aレジスタの内容は「7」r、Bレ
ジスタの内容「5」(n―r)となる。この結
果、各レジスタの状態は第9図dの如くとなる。 上記ステツプSGでのROM11の次アドレス信
号Na「00111」(7)により次のステツプSHの階乗
演算フローの()に入る。このステツプSH
階乗演算()と後述のステツプSjの階乗演算
()により階乗演算フローが形成されるわけで
あるが、この動作は第8図に示すフローの動作手
順にしたがつて動作が実行される。第8図の動作
手順は従来一般的に知られる階乗演算のものと同
じであるから、ここではその詳細な動作の説明は
省略し簡単に触れることにする。まず、階乗演算
()中において、ステツプSH―は、単にキー
入力部より階乗演算を指示する場合のセツト状態
のステツプを示したもので例えば、キー入力部3
9で数値キーの幾れかが押され、その値がRAM
12のXレジスタにセツトされ、その後、階乗演
算指示キーn1が操作され、上記Xレジスタの第
14桁目に階乗演算を指示するフラツクが書き込ま
れるものである。しかし、今回の実施例ではこの
ステツプに相当する動作は既にステツプSGまで
に完了している。ステツプSH―に入り、上記
Xレジスタ内の数値、即ち、第1の数値nが正の
整数か否かが判断され、「No」の場合には直ちに
エラールーチン処理に入りエラーが表示され、
「YeS」の場合は次のステツプSH―に進む。こ
の場合にはn=12より「YES」(正の整数)と判
断されてステツプSH―に進み、Yレジスタに
数値「1」が書き込まれる。これはは、実際の階
乗演算n・(n―1)・(n―2)……を上位の数
値項から順次乗算をしてゆく為の準備の為のステ
ツプである。このステツプSH―が終了する
と、この発明では一且階乗演算フローをぬけてア
ドレスレジスタ13の内容が「01011」(11)に変
更されて、第7図のステツプSIに進む。このス
テツプSIでは本発明の為に設けられたステツプ
でXレジスタの第14桁目に記憶されているフラグ
コードFの内容が組合せ演算指示のフラグか階乗
演算指示のフラグかが判断される。即ち、このス
テツプではオペレーシヨンコード「1011」が出力
され、これによりオペレーシヨンデコーダ15か
らは信号OS、M、減算信号SBおよび判断信号J
Uが、タイミングデコーダ16からは信号CIが
各々出力される。又、この時、ROM11からは
同時に行アドレス信号はFU「001」(1)、列アドレ
ス信号はFL「1110」(14)が各々出力すると共に
数値コード信号C0「1100」が出力される。そし
て、ステツプSDと同様の動作により、Xレジス
タの第14桁目の内容〔この例では「12」(組合せ
演算指示フラグ)〕がRAM12より読み出され、
ゲート回路G7、ラツチ回路28、ゲート回路G10
を介して演算回路29の端子bに供給され、同時
に、コード信号C0「12」がゲートG12を介して演
算回路29の端子aに供給され、演算回路29に
て、上記両入力データによる減算が実行され、そ
の演算結果により減算ジヤツジの動作が行なわ
れ、この判断で「NO」、即ち、階乗演算指示フラ
グと判断された際は第8図の階乗演算()のス
テツプSJIに進み、「YES」と判断された際は
ステツプSKに進む。この実施例では演算回路2
9「12―12=0」の減算が実行され、データも、
ボロー信号も出力しないので「YES」と判断さ
れてアドレスレジスタ13の内容が「12」に変更
され、次のステツプSKに進む。 次のステツプSKではXレジスタの内容とAレ
ジスタの内容が一致するか否かが判断される。こ
れは、組合せ演算算nCrの分子の演算式の演算の
終了を決定する、即ちn(n―1)・(n―2)…
……(n―r+1)或いはn・(n―1)・(n―
2)………(r+1)の演算が終了したか否かの
判断を行なう為のものである。このステツプにお
いては、オペレーシヨンコードOpとして
「0111」が出力され、オペレーシヨンデコーダ1
5より信号SB,OS,OFおよびJUが出力され
る。この時、ROM11により信号SU「100」,F
U「001」,SL「0011」,FL「1101」が出力され
る。これにより演算回路29にて「「X―A」の
減算が行なわれ、その結果が「0」、即ち、演算
回路29よりボロー信号、およびデータ有り信号
が出力されない場合、両レジスタの内容が一致し
たとみなし、上記演算終了とみなしてステツプS
Lへ進む、又、上記結果が「0」でない、即ち、
演算回路29およびオア回路33を介してデータ
有り信号が出力される場合、両レジスタの内容が
一致しないとみなし、上記演算実行のステツプS
J―(第8図の階乗演算)へと進む。この場
合、「12―7=5」より両レジスタの内容は一致
しないとみなして次のステツプSIへと進む。 次にステツプSj―ではYレジスタの内容と
Xレジスタの内容との乗算を行い、その結果をY
レジスタに書込む演算が行なわれる。即ち、この
場合nPr=n(n―2)(n―2)……(n―r
+1)のうちのまず「n×1=n」(12×1=
12)算が行なわれ、その結果、Yレジスタに
「12」が書き込まれる。 次にステツプSJ―に進み、このステツプで
はXレジスタの内容より数値「1」を減算する演
算が行なわれる。このステツプの動作はROM1
1より出力されるオペレーシヨンコードレジスタ
の指定信号およびコード信号Coが異なるだけで
ステツプScとほぼ同様の動作にて実行され、演
算回路29で〔Xレジスタの内容「12」―数値コ
ード「1」〕の減算が実行され、その結果「11」
がXレジスタに書き込まれ、第9図eの状態とな
る。そして、次は再び第7図のステツプSIへと
進進む。このステツプSIでは上述の動作によ
り、組合せ演算のフラツグ有りの判断がなされ、
ステツプSKに進み、このステツプでもXレジス
タの内容が「11」、Aレジスタの内容が「7」よ
り、「NO」と判断されて、次にステツプSJ
に進み、Xレジスタの内容「11」、Yレジスタの
内容「12」との乗算が行なわれ、その結果がYレ
ジスタに書き込まれる。即ちn・(n―1)・(n
―2)……(n―r+1)のうちのn×(n―
1)の演算が行なわれ、その結果「132」がYレ
ジスタに書き込まれる。その後、ステツプSJ
がが実行され、更に、ステツプSI→SK→SJ
―の動作が実行され、n×(n―1)・(n―
2)=12×11×10の演算がなされる。更に上記ス
テツプサイクルの動作の繰り返しが、ステツプS
GでXレジスタの内容とAレジスタの内容との一
致が判断されるまで繰り返される。即ち、Xレジ
スタの内容が「7」になるまで繰り返されらる。
このステツプSKで一致がとれると、上記第(2)式
の分子の演算(12×11×10×9×8)=95040の演
算が終了し、アドレスレジスタ13の内容が
「010000」(16)に変更されて次のステツプSL
進む。この時のレジスタの状態は第第9図fの如
くである。 次のスステツプSLに進み、このステツプでは
XレジスタおよびBレジスタの第14桁目のフラグ
コード(組合せ演算指示コード)のクリヤ動作が
行なわれる。即ち、行アドレス信号FU、およ
び、列アドレス信号FLでXレジスタ或いはBレ
ジスタの第14桁目を指定し、オペレーシヨンコー
ダ15より信号M、タイミングデコーダ16より
信号R/Wを出力し、上記両レジスタの第14桁目
に「0」を書き込む動作が行なわれる。尚、第4
図ではXレジスタの第14桁目の「0」書き込みの
マイクロ命令のみが記載され、Bレジスタの第14
桁目を指定するマイクロ命令はレジスタの指定信
号が相違するのみなのでここではそのステツプは
省略してある。この時の各レジスタの状態図は第
9図gの如くである。 次いでステツプSMに進み、このステツプでは
ステツプFと同様の動作でステツプSGでBレジ
スタに格納されていた内容「5」〔(n―r)〕を
Xレジスタに転送し、第9図hの如くとなる。そ
して、ステツプSNに進み、ステツプBと同様の
動作でYレジスタ内容即ち、上記階乗演算の演算
結果「95040」をBレジスタに転送し、一時記憶
され、第9図iの如くとなる。 次いで、ステツプSOに進み、上記ステツプSM
でXレジスタに転送された数値(n―r)の階乗
演算〔上述の数式(3)の分母を求める演算〕が実行
される。今、この場合X=「5」であるから上記
第8図のステツプSH―,SH―,SH―,
H―,SH―による階乗演算フローがステツ
プSH―にてXレジスタの内容「5」が「0」
になるまで繰り返し行なわれ、その演算結果であ
るX1=5×4×3×2×1=120が求められ、Y
レジスタに記憶される。(第9図i)、そして、次
にステツプSpに進み、Bレジスタの内容
「95040」がXレジスタに転送され、第9図jの状
態となる。そして、次にステツプSQに進み、X
レジスタの内容「95040」をYレジスタの内容
「120」で除算する演算、即ち、組合せ演算nCrの
第(2)式の分子を分母で除算する演算が実行され、
その演算結果「792」がXレジスタに書き込まれ
る。この様にして組合せ演算の結果が求められる
と、表示をする為の後処理のステツプSRを経て
ステツプSSでその結果が表示される。 又、上記構成例に於いて、組合せ演算80C78
演算する場合は、上記ステツプSDにてYレジス
タの内容「78」(数値r)とAレジスタの内容
「2」(n―r)との大小判断にてr≧(n―r)
と判断されて、上記(2)式の演算が実行される。即
ち、上述したと同様のステツプ動作を経て、階乗
演算のステツプSH〜SKで80×79=6320を得て、
ステツプSOで(n―r)1=21=2を得て、ス
テツプSaでその演算結果である80C78=3160が得
られ、表示されるものである。この様に、従来の
計算機ではオーバーフローとなる組合せ演算も演
算実行可能で表示されるものである。 尚、上記実施例では数値のレジスタへの記憶状
態を指数形態のものを示したが、他の記憶形態の
ものでもできることはもちろんである。 以上、詳術した如く本発明によれば、階乗演算
フローを巧みに利用し、従来のものに簡単な判断
手段を付加するのみで組合せ演算nCrの演算結果
が表示可能桁数以内の値ならば、確実にその演算
結果が求められ、したがつて、入力データ(数値
n,r)の入力範囲が拡張されて計算機能の向上
が計られ使用上も極めて便利な計算機が得られ
る。更に、階乗演算の回数も又、その演算も最後
までやらずに判断結果により途中で停止するよう
に制御されので演算スピードが大幅に向上し得る
小型電子式算機を提供できる。
[Table] However, the explanation of the instruction state diagram and operation in the ROM 11 of that step will be omitted here. Then, the instruction for the next subtraction operation is shown. As mentioned above, when the operation code OP "0101" is output from the ROM 11, the operation decoder 15 outputs the subtraction signal SB and the control signal OS.
and OF are output, and timing decoder 1
From 6 onwards, a read/write signal R/W is output in synchronization with the timing signal t3 . At this time, ROM1
The row designation address signal S U output from 1 is "010" (2), the F U is "100" (4), and the column address signal S L
"0011" (3) is output for F L "1101" (13).
At this time, the signal M is "0" and is "1".
Therefore, at the timing t1 of the first digit cycle of this step, the above signal S U (2)
is passed through the gate circuit G1 , and the signal S L (3) is passed through the gate circuit G3 , which is opened at the timing of ta.
It is supplied to the terminals RAU and RAL of the RAM 12, and the third digit of the Y register in the RAM 12 is designated. Then, the signal R/W of RAM12 is “0”
A signal or readout signal is provided. As a result, the content of the third digit of the Y register "0" can be read,
It is set to the latch circuit 27 via the gate circuit G6 at the timing of t1.1 . At this time, the signal OS
Since it is "1", it is applied to the a terminal of the arithmetic circuit 29 via the latch circuit G9. Also, at this time, the content (3) of the signal S L is set in the counter 20. Next, at timing t2 , the gate circuit G1 is closed and the gate circuit G2 is opened, so the row address signal F U (4) is supplied to the RAU terminal of the RAM 12, and the column address signal S L (3) is supplied to the RAU terminal of the RAM 12. It is subsequently supplied to the RAL terminal via gate circuit G3 , and the third digit of the A register is designated. As a result, the contents of the third digit of the A register are read out from the OUT terminal of the RAM 12, and set in the latch circuit 28 via the gate circuit G7 at timing t2 · 1 . At this time, since the signal OF is "1", the contents set in the latch circuit 28 are applied to the b terminal of the arithmetic circuit 29. Next, at timing t 3 , the row address signal and column address signal to the RAM 12 are the same as the timing at t 2 , and the third digit of the A register is specified, but the R/W signal is sent to the timing decoder at this timing. "1" is supplied from 16, and the write mode is entered. In response to the subtraction signal SB from the operation decoder 15, the arithmetic circuit 29 subtracts the contents of the third digit of the Y register from the contents of the third digit of the A register read out from the RAM 12, that is, "0-0. '' is performed, and the result is written to the third digit of the A register from the IN terminal of the RAM 12 via the pass line j. At this time, the contents of the counter 20 are determined by the timing signal D output from the timing decoder 16, and its value becomes "4". The S L signal (3) and the signal F L (15) are also supplied to a signal-operated matching circuit 21 for comparison. However, no match is obtained here, and no match signal is obtained from the match circuit 21. Therefore, step SA
With the same operation, the address contents of the address register 13 are not changed and the next digit cycle t 1 ~
Enter t3 . Here again, the operation is the same as in step SA except that subtraction is performed as an operation in the arithmetic circuit 29.
The contents of the fourth digit of the register are subtracted (0-0), and as a result, "0" is written to the fourth digit of the A register. Similarly, each digit cycle is repeated and subtraction is performed for each digit up to the 13th digit. As a result, AY = "12-7", that is, the numerical value "5" is stored in the A register, resulting in the register state as shown in FIG. 9c. In the cycle in which subtraction is performed up to the 13th row between both registers, the match circuit 21 outputs a match signal. This match signal is applied to the flip-flop 17 via the OR circuit 24 in the same manner as in step S A , and outputs the start signal ST, and is read into the address register 13 via the AND circuit 23 and the OR circuit 26 and is applied as a clock pulse e. It will be done. At this time, the only address signal given to the address register 13 is the next address signal Ne ["00011" (3)] output from the ROM 11, and the content of that address is changed to (3), and the step S Proceed to D. At this time, the status of each register becomes as shown in FIG. 9c. In the next step S D, the contents of the Y register (second
The magnitude relationship between the numerical value r) and the contents of the A register (the numerical value n−r) is determined. That is, in this step, if r≧n−r, preparations are made to execute the calculation based on the above equation (2), and on the other hand, if r<n−r
If so, this is done in preparation for the calculation based on equation (3). The operation code OP of this step is "0111" as shown in FIG. 6, and the operation decoder 15 outputs the signals OF, OS, the subtraction signal SB , and the judgment signal JU . Also, at this time, the row designation address signal S U is sent from the ROM 11.
"100" (4), F U "101" (2), column address signal S L
“0000” (0) and F L “1101” (13) are output.
Therefore, in the same operation as in step Sc above, in this case, the arithmetic circuit 29 performs a subtraction operation by subtracting the content "5" of the A register from the content "7" of the Y register, and the result of the judgment is that there is data. The signal and the carry signal are sent to AND circuits 35 and 36 via OR circuit 33 and line k, respectively. In this example, "7-5=2", that is, r≧n-
From r, only the data presence signal is applied to the AND circuit 35 via the OR circuit 33. At this time, since the judgment signal J U is applied from the operation decoder 15 to the other input terminal of the AND circuit 35, a “1” signal is output from the AND circuit 35, and the address register 13 is outputted via the OR circuit 41. Supplied to the 1st bit. At this time, the next address signal Na from the ROM 11 is "00101" (5), so even if there is an output from the AND circuit 35, the next address
The contents of the Na signal are read into the address register 13 without being changed, and the process proceeds to the next step SE . If the content of the Y register is smaller than the content of the A register, that is, if r<n−r, the arithmetic circuit 29 outputs a data present signal and a carry signal, and each of these signals is sent to the AND circuit 35. . I can move on. Therefore, in this embodiment, the address No. 5 is specified as described above, and the process proceeds to step SE . Next, in step S E , the content of the A register is "5".
An operation is performed in which the data is transferred to the Z register. The operation code Op in this step SE is "0100", the operation decoder 15 outputs the signal OS, the timing decoder 16 outputs the read/write signal R/W, and at this time, the ROM 11 specifies the row address. Signal S U "100"
(4), (A register) F U "011" (3) (Z register),
Column address signals S L "000" and F L "1111" are output, and the contents of the A register are transferred to the Z register by the same operation as in step SA . At this time, the contents of the address register 13 are changed to "8" from the next address signal Na "01000" (8) of the ROM 11, and the process proceeds to the next step SF . In the next step S F , the contents of the B register ``7'' are transferred to the A register by the same operation as in the above step S E , and the contents of the address register 13 are changed to ``9''.
, and proceed to step S G. In this step S G , the content "5" of the Z register is transferred to the B register by the same operation as in the above step S E. That is, based on the judgment result of step S D , the contents of the A register (n-r) and the contents r of the B register are exchanged in steps S E , S F , S G , and the contents of the A register become "7". ”r, the content of the B register becomes “5” (nr). As a result, the state of each register becomes as shown in FIG. 9d. In response to the next address signal Na "00111" (7) of the ROM 11 in step S G , the process enters the factorial calculation flow () in the next step S H. A factorial calculation flow is formed by the factorial calculation () in step S H and the factorial calculation () in step Sj, which will be described later. Then the action is executed. Since the operating procedure shown in FIG. 8 is the same as that of the conventionally known factorial calculation, a detailed explanation of the operation will be omitted here and will be briefly mentioned. First, in the factorial calculation (), step S H - simply indicates the step in the set state when the factorial calculation is instructed from the key input section.
At 9, some number key is pressed and the value is stored in RAM.
12 of the X register, and then the factorial operation instruction key n1 is operated to set the
A flag indicating the factorial operation is written in the 14th digit. However, in this embodiment, the operation corresponding to this step has already been completed by step SG . Step SH- is entered, and it is determined whether the value in the X register, that is, the first value n, is a positive integer or not. If "No", the error routine processing is immediately entered and an error is displayed.
If “Yes”, proceed to the next step S H -. In this case, since n=12, it is judged as ``YES'' (a positive integer), and the process proceeds to step S H -, where a numerical value ``1'' is written in the Y register. This is a step to prepare for the actual factorial operations n, (n-1), (n-2), etc. to be multiplied sequentially from the higher numerical terms. When this step S H - is completed, the present invention skips the single factorial operation flow, changes the contents of the address register 13 to "01011" (11), and proceeds to step S I in FIG. 7. In step S I , a step provided for the present invention, it is determined whether the contents of the flag code F stored in the 14th digit of the X register are a combinational operation instruction flag or a factorial operation instruction flag. . That is, in this step, the operation code "1011" is output, and the operation decoder 15 outputs the signals OS, M, the subtraction signal S B , and the judgment signal J.
A signal U is output from the timing decoder 16, and a signal CI is output from the timing decoder 16. At this time, the ROM 11 simultaneously outputs the row address signal F U "001" (1), the column address signal F L "1110" (14), and outputs the numerical code signal C 0 "1100". Ru. Then, by the same operation as in step S D , the contents of the 14th digit of the
Gate circuit G 7 , latch circuit 28, gate circuit G 10
At the same time, the code signal C 0 "12" is supplied to the terminal a of the arithmetic circuit 29 via the gate G 12 , and the arithmetic circuit 29 calculates the result according to both input data. Subtraction is executed, and the operation of the subtraction jack is performed based on the result of the operation. When the judgment is "N O ", that is, the factorial operation instruction flag is determined, step S of the factorial operation () in Fig. 8 is executed. Proceed to J - I , and if the answer is ``YES'', proceed to step S K. In this embodiment, the arithmetic circuit 2
9 The subtraction “12-12=0” is executed, and the data is also
Since no borrow signal is output, the determination is ``YES'', the contents of the address register 13 are changed to ``12'', and the process proceeds to the next step SK . In the next step SK , it is determined whether the contents of the X register and the contents of the A register match. This determines the end of the operation of the numerator expression of the combinational operation nCr, that is, n(n-1)・(n-2)...
...(n-r+1) or n・(n-1)・(n-
2) This is for determining whether the calculation of (r+1) has been completed or not. In this step, "0111" is output as the operation code Op, and the operation decoder 1
5 outputs signals SB, OS, OF, and JU. At this time, the signals S U “100” and F
U “001”, S L “0011”, and F L “1101” are output. As a result, the arithmetic circuit 29 performs subtraction of "X-A", and if the result is 0, that is, the arithmetic circuit 29 does not output a borrow signal or a data present signal, the contents of both registers match. It is assumed that the above calculation has been completed, and the process goes to step S.
Proceed to L , and the above result is not "0", i.e.
When a data presence signal is outputted via the arithmetic circuit 29 and the OR circuit 33, it is assumed that the contents of both registers do not match, and step S of the above-mentioned arithmetic execution is performed.
Proceed to J - (factorial operation in Figure 8). In this case, since "12-7=5", it is assumed that the contents of both registers do not match, and the process proceeds to the next step S I. Next, in step S j -, the contents of the Y register and the contents of the X register are multiplied, and the result is
An operation is performed that writes to a register. That is, in this case nPr=n(n-2)(n-2)...(n-r
+1), first of all “n×1=n” (12×1=
12) The calculation is performed, and as a result, "12" is written to the Y register. Next, the program proceeds to step SJ-- , in which an operation is performed to subtract a numerical value "1" from the contents of the X register. The operation of this step is ROM1
The operation is almost the same as step Sc, except that the specified signal of the operation code register output from 1 and the code signal Co are different. ] is executed and the result is ``11''.
is written to the X register, resulting in the state shown in FIG. 9e. Then, proceed again to step S I in Fig. 7. In this step S I , by the above-mentioned operation, it is determined whether the combinational operation is flagged, and
Proceeding to step S K , the content of the X register is "11" and the content of the A register is "7" at this step, so it is judged as "NO", and then step S J -
Then, the contents of the X register "11" are multiplied by the contents of the Y register "12", and the result is written to the Y register. That is, n・(n-1)・(n
-2)...n×(n- of (n-r+1))
The operation 1) is performed, and as a result "132" is written to the Y register. After that, step S J -
is executed, and further steps S I →S K →S J
- is executed, n×(n-1)・(n-
2)=12×11×10 calculations are performed. Furthermore, repetition of the operation of the above step cycle is performed in step S.
This process is repeated until G determines that the contents of the X register and the contents of the A register match. That is, the process is repeated until the content of the X register becomes "7".
If a match is found in this step S K , the calculation of the numerator of the above equation (2) (12×11×10×9×8) = 95040 is completed, and the contents of the address register 13 are changed to “010000” (16 ) and proceed to the next step S L. The state of the register at this time is as shown in FIG. 9(f). The program advances to the next step S L , in which the flag code (combination operation instruction code) in the 14th digit of the X register and the B register is cleared. That is, the 14th digit of the X register or B register is specified by the row address signal F U and the column address signal F L , the operation coder 15 outputs the signal M, the timing decoder 16 outputs the signal R/W, An operation is performed to write "0" into the 14th digit of both registers. Furthermore, the fourth
In the figure, only the microinstruction to write "0" to the 14th digit of the X register is shown, and the 14th digit of the B register is
Since the microinstruction for specifying the digit differs only in the register specification signal, that step is omitted here. The state diagram of each register at this time is as shown in FIG. 9g. Next, the process proceeds to step SM , and in this step, the content "5" [(n-r)] stored in the B register in step S G is transferred to the X register in the same manner as in step F, and the content is transferred to the It will be as follows. Then, the program proceeds to step S N , and in the same manner as step B, the contents of the Y register, ie, the result of the above factorial operation "95040" is transferred to the B register and temporarily stored, resulting in the result as shown in FIG. 9i. Next, proceed to step S O and repeat step S M
Then, a factorial operation (operation for determining the denominator of the above-mentioned formula (3)) of the numerical value (n-r) transferred to the X register is executed. Now, in this case, since X = "5", the steps S H -, S H -, S H -,
The factorial operation flow by S H -, S H - changes the contents of the X register "5" to "0" at step S H -
The calculation is repeated until X 1 =5×4×3×2×1=120 is obtained, and Y
stored in a register. (FIG. 9i) Then, the program proceeds to step Sp, where the contents of the B register "95040" are transferred to the X register, resulting in the state shown in FIG. 9J. Then, proceed to step S Q and
The operation of dividing the register content "95040" by the Y register content "120", that is, the operation of dividing the numerator by the denominator of equation (2) of the combinational operation nCr, is executed.
The calculation result "792" is written to the X register. When the result of the combinational operation is obtained in this way, the result is displayed in step S S after passing through step S R of post-processing for display. In addition, in the above configuration example, when calculating the combination operation 80 C 78 , the content of the Y register "78" (numeric value r) and the content of the A register "2" (n-r) are Based on the size judgment, r≧(n-r)
It is determined that this is the case, and the calculation of equation (2) above is executed. That is, through step operations similar to those described above, 80×79=6320 is obtained in steps S H to S K of the factorial calculation,
At step S0 , (n-r)1=21=2 is obtained, and at step Sa, the result of the calculation, 80 C 78 =3160, is obtained and displayed. In this way, in conventional computers, even combinational operations that would result in overflow can be executed and displayed. In the above embodiment, numerical values are stored in the register in an exponential format, but it is of course possible to use other storage formats. As detailed above, according to the present invention, by skillfully utilizing the factorial operation flow and adding a simple judgment means to the conventional one, if the result of the combination operation nCr is a value within the number of digits that can be displayed. For example, the calculation result can be reliably obtained, the input range of input data (numeric values n, r) is expanded, the calculation function is improved, and a calculator that is extremely convenient to use can be obtained. Furthermore, the number of times of factorial calculations is also controlled so that the calculations are not completed until the end and are stopped midway depending on the judgment result, thereby providing a compact electronic calculator that can significantly improve the calculation speed.

【図面の簡単な説明】[Brief explanation of the drawing]

図面はこの発明の一実施例を示すもので、第1
図は本発明の構成図、第2図は第1図において使
用されるタイミングパルスを示す図、第3図は第
1図におけるRAM内のレジスタの構成内容を示
す図、第4図は第1図のROM、オペレーシヨン
デコーダ、およびタイミングデコーダ部の一部分
の構成例を示す図、第5図は主なオペレーシヨン
コードOpとその時出力される各種信号との関係
を示した図、第6図は各ステツプでのアドレス番
地とその時出力される各種信号との関係を示す
図、第7図は組合せ演算の処理を示すフローチヤ
ート、第8図は第7図における階乗演算の処理を
示すフローチヤート、第9図は組合せ演算処理の
際のレジスタのデータ記憶状態の変化を示す図で
ある。 11……ROM、12……RAM、14……
ROMアドレス部、15……オペレーシヨンデコ
ーダ、16……タイミングデコーダ、20……カ
ウンタ、21……一致回路、39……キー入力
部。
The drawings show one embodiment of the invention.
2 is a diagram showing the configuration of the present invention, FIG. 2 is a diagram showing the timing pulses used in FIG. 1, FIG. 3 is a diagram showing the configuration contents of the register in the RAM in FIG. Figure 5 is a diagram showing a configuration example of a part of the ROM, operation decoder, and timing decoder section in Figure 5. Figure 5 is a diagram showing the relationship between the main operation code Op and various signals output at that time. Figure 6 is A diagram showing the relationship between the address address at each step and the various signals output at that time, FIG. 7 is a flowchart showing the processing of the combinational calculation, and FIG. 8 is a flowchart showing the processing of the factorial calculation in FIG. 7. , FIG. 9 is a diagram showing changes in the data storage state of registers during combinatorial arithmetic processing. 11...ROM, 12...RAM, 14...
ROM address section, 15...operation decoder, 16...timing decoder, 20...counter, 21...matching circuit, 39...key input section.

Claims (1)

【特許請求の範囲】 1 組合せ演算(nCr)を指定するキーと、この
キーの前後に入力される数値データをそれぞれ数
値n,rとして記憶する第1、第2の記憶手段
と、数値(n―r)を算出する算出手段と、この
算出手段により算出された数値(n―r)を記憶
する第3の記憶手段と、上記数値rと上記数値
(n―r)との大小関係係を判断する判断手段
と、この判断手段により上記数値rが上記数値
(n―r)より大きいと判断されたときに、上記
第2の記憶手段の内容と上記第3の記憶手段の内
容とを交換する交換手段と、上記第1および第2
の記憶手段に記憶された各数値に基づいて nCr の演算を実行する演算手段とを具備したことを特
徴とする小型電子式計算機。
[Claims] 1. A key for specifying a combinational operation (nCr), first and second storage means for storing numerical data input before and after this key as numerical values n and r, respectively; -r), a third storage means for storing the numerical value (n-r) calculated by the calculating means, and a magnitude relationship between the numerical value r and the numerical value (n-r). a determining means for determining, and when the determining means determines that the numerical value r is greater than the numerical value (n-r), exchanging the contents of the second storage means and the contents of the third storage means; exchange means, and the first and second
1. A small electronic calculator characterized by comprising: calculation means for executing nCr calculation based on each numerical value stored in the storage means.
JP759378A 1978-01-26 1978-01-26 Miniature electronic computer Granted JPS54100633A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP759378A JPS54100633A (en) 1978-01-26 1978-01-26 Miniature electronic computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP759378A JPS54100633A (en) 1978-01-26 1978-01-26 Miniature electronic computer

Publications (2)

Publication Number Publication Date
JPS54100633A JPS54100633A (en) 1979-08-08
JPS6146856B2 true JPS6146856B2 (en) 1986-10-16

Family

ID=11670093

Family Applications (1)

Application Number Title Priority Date Filing Date
JP759378A Granted JPS54100633A (en) 1978-01-26 1978-01-26 Miniature electronic computer

Country Status (1)

Country Link
JP (1) JPS54100633A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63160047U (en) * 1987-04-09 1988-10-19
JPH055813Y2 (en) * 1986-12-10 1993-02-16

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH055813Y2 (en) * 1986-12-10 1993-02-16
JPS63160047U (en) * 1987-04-09 1988-10-19

Also Published As

Publication number Publication date
JPS54100633A (en) 1979-08-08

Similar Documents

Publication Publication Date Title
US3202805A (en) Simultaneous digital multiply-add, multiply-subtract circuit
JPS58181165A (en) Vector operating processor
JPS6146856B2 (en)
US4410956A (en) Exponential operation device
US3508037A (en) Decimal add/subtract circuitry
US4075705A (en) Calculator for determining cubic roots
JPH0113129B2 (en)
JPS6120134A (en) Root calculator
JPH02126321A (en) Decoder for instruction code
JPS6019030B2 (en) educational electronics
JPS5834852B2 (en) Enzanshiyorihoushiki
JPS6127772B2 (en)
SU1541600A1 (en) Device for conversion of coordinates
JPS6227930Y2 (en)
JPS5940665Y2 (en) Power calculation control device
JPH0325809B2 (en)
JPS6113269B2 (en)
JP4483491B2 (en) Decimal calculator
JPS5922587Y2 (en) random number generator
JPS6118219B2 (en)
JPS5821292B2 (en) Marmezan Shiyorihoushiki
JPS59846B2 (en) Index display method
JPS5924463B2 (en) computer equipment
JPS5939773B2 (en) Logarithmic function calculation method
JPS6040065B2 (en) small electronic calculator