Claims (1)
о оо Изобретение относитс к вычислительной технике и может быть применено в ЭЦВМ и специализированных цифровых вычислительных устройствах. Целью изобретени вл етс расширение функциональных возможностей за счет округлени отрицательных чисел. На чертеже представлена схема устройства дл округлени чисел. Устройство дл округлени чисел содержит регистр 1 сохран емой части числа, схему 2 сравнени , датчик 3 случайных чисел, группу элементов И 4, регистр 5 отбрасываемой части числа, сумматор 6, вход 7 запуска устройства, элементы И-НЕ 8 и 9, элемент ИЛИ-НЕ 10, элементы НЕ 11 и 12. Устройство дл округлени чисел работает следующим образом. Числа, обрабатываемые устройством, представлены в дополнительном коде с фиксированной зап той. Старший разр д знаковый «О соответствует плюсу, «1 минусу . Округл емое число помещаетс на регистры 1 и 5. На вход 7 поступает сигнал начала операции, который бткрывает элементы И 4 группы и возбуждает датчик 3. Случайные числа сравниваютс схемой 2 сравнени с отбрасываемыми разр дами числа, поступающими с регистра 5 через элементы И 4 группы. Если округл емые числа больще случайных , то на входы элемента ИЛИ-НЕ 10 и первого элемента И-НЕ 8 из схемы 2 сравнени выдаетс значение «1, а если округл емые числа меньще случайных чисел - значение «О. Состо ние знакового разр да регистра 1 инвертируетс элементом НЕ 12 и поступает на входы элемента ИЛИ-НЕ 10 и первого элемента И-НЕ 8. Информаци с выхода элемента ИЛИ- НЕ 10 поступает на старщие разр ды сумматора 6, а информаци с первого элемента И - НЕ 8 - на второй элемент И-НЕ 9, где она сравниваетс с информацией с элемента ИЛИ-НЕ 10. Результат сравнени поступает в младщий разр д сумматора 6. В сумматоре 6 производитс сложение поступившего значени с содержимым регистра 1. Нолученный результат записываетс в регистр 1. Округление отрицательных чисел в большую сторону по абсолютной величине происходит по сигналу со схемы 2 сравнени , соответствующему нулю, и в меньшую сторону при соответствии сигнала единице. Дл положительных чисел, наоборот, округление в большую сторону происходит по сигналу, соответствующему единице, и в меньшую сторону при соответствии сигнала нулю. Таким образом, в устройстве производитс округление чисел на единицу с веро тностью , численно равной значению отбрасываемой части как положительных чисел , так и отрицательных. Формула изобретени Устройство дл округлени чисел, содержащее регистр сохран емой части числа, регистр отбрасываемой части числа, сумматор , группу элементов И, схему сравнени , датчик случайных чисел, причем разр дный выход регистра отбрасываемой части числа соединен с первыми входами элементов И группы, выходы которых соединены с первым входом схемы сравнени , второй вход которой соединен с выходом датчика случайных чисел, вход запуска которого соединен с вторыми входами элементов И группы и с ВХОДОМ запуска устройства, разр дный выход регистра сохран емой части числа соединен с входом первого слагаемого сум.матора , отличающеес тем, что, с целью расщирени функциональных возможностей за счет округлени отрицательных чисел, оно содержит два элемента И-НЕ, элемент ИЛИ-НЕ и два элемента НЕ, причем выход схемы сравнени соединен с первыми входами первого элемента И-НЕ и элемента ИЛИ-НЕ, выходы которых соединены соответственно с первым входом второго элемента И-НЕ и с входом первого элемента НЕ, выходы которых соединены соответственно с младщим разр дом входа второго слагаемого сумматора и с вторым входом второго элемента И-НЕ, выход знакового разр да регистра сохран емой части числа соединен через второй элемент НЕ с вторым входом первого элемента И-НЕ и с вторым входом элемента ИЛИ-НЕ, выход которого соединей со старшими разр дами входа второго слагаемого сумматора, выход которого соединен с разр дным входом регистра сохран емой части числа.о оо The invention relates to computing and can be applied in digital computers and specialized digital computing devices. The aim of the invention is to enhance the functionality by rounding negative numbers. The drawing shows a diagram of the device for rounding numbers. The device for rounding numbers contains the register 1 of the stored part of the number, the comparison circuit 2, the sensor 3 of random numbers, the group of elements AND 4, the register 5 of the drop part of the number, the adder 6, the device start input 7, the elements AND-NO 8 and 9, the element OR -NOT 10, elements NOT 11 and 12. The device for rounding numbers works as follows. The numbers processed by the device are presented in an additional code with a fixed comma. The highest bit of the sign “O corresponds to a plus,“ 1 minus. The rounded number is placed on registers 1 and 5. Input 7 receives a signal to start operation, which opens elements AND 4 groups and excites sensor 3. Random numbers are compared by circuit 2 comparison with the rejected digits of the number coming from register 5 through elements AND 4 groups . If the rounded numbers are more than random, then the inputs of the element OR-NOT 10 and the first element, AND-NOT 8 from comparison circuit 2 are given the value "1, and if the rounded numbers are less than random numbers, the value" O. The state of the sign bit of register 1 is inverted by the element NOT 12 and is fed to the inputs of the element OR — NOT 10 and the first element AND — NOT 8. Information from the output of the element OR — NOT 10 goes to the high bits of the adder 6, and the information from the first element AND - NOT 8 - to the second element AND-NOT 9, where it is compared with information from the element OR - NOT 10. The result of the comparison goes to the youngest bit of the adder 6. In the adder 6, the received value is added to the contents of the register 1. The result obtained is written to Register 1. Rounding Negative s number to the next higher absolute value occurs on a signal from the comparison circuit 2 corresponding to zero and in accordance with the smaller side unit signal. For positive numbers, on the contrary, rounding up occurs on the signal corresponding to one, and down on the corresponding signal to zero. Thus, the device rounds up the numbers by one with a probability that is numerically equal to the value of the drop part of both positive and negative numbers. Apparatus of the Invention A device for rounding numbers comprising a register of a stored part of a number, a register of a dropped part of a number, an adder, a group of elements AND, a comparison circuit, a random number sensor, the discharge output of the register of a dropped part of a number connected to the first inputs of the elements of AND group whose outputs connected to the first input of the comparison circuit, the second input of which is connected to the output of the random number sensor, the start input of which is connected to the second inputs of the AND elements of the group and to the device start INPUT, bit The output of the register of the stored part of the number is connected to the input of the first summand summator, characterized in that, in order to extend the functionality by rounding negative numbers, it contains two AND-NOT elements, an OR-NOT element and two NOT elements, and the output Comparison circuits are connected to the first inputs of the first AND-NOT element and the OR-NOT element, the outputs of which are connected respectively to the first input of the second AND-NOT element and to the input of the first element NOT, the outputs of which are connected respectively to the junior input second input The second term of the adder and with the second input of the second NAND element, the output of the sign bit of the register of the stored part of the number is connected via the second element NOT to the second input of the first AND element and the second input of the OR NOT element, the output of which is connected to the higher The input of the second term of the adder, the output of which is connected to the bit input of the register of the stored part of the number.