Comparison of numbers and analysis of overflow in modular arithmetic

V. Guzhov, I. O. Marchenko, E. Trubilina, Dmitry S. Khaidukov
{"title":"Comparison of numbers and analysis of overflow in modular arithmetic","authors":"V. Guzhov, I. O. Marchenko, E. Trubilina, Dmitry S. Khaidukov","doi":"10.17212/2782-2001-2021-3-75-86","DOIUrl":null,"url":null,"abstract":"The method of modular arithmetic consists in operating not with a number, but with its remainders after division by some integers. In the modular number system or the number system in the residual classes, a multi-bit integer in the positional number system is represented as a sequence of several positional numbers. These numbers are the remainders (residues) of dividing the original number into some modules that are mutually prime integers. The advantage of the modular representation is that it is very simple to perform addition, subtraction and multiplication operations. In parallel execution of operations, the use of modular arithmetic can significantly reduce the computation time. However, there are drawbacks to modular representation that limit its use. These include a slow conversion of numbers from modular to positional representation; the complexity of comparing numbers in modular representation; the difficulty in performing the division operation; and the difficulty of determining the presence of an overflow. The use of modular arithmetic is justified if there are fast algorithms for calculating a number from a set of remainders. This article describes a fast algorithm for converting numbers from modular representation to positional representation based on a geometric approach. The review is carried out for the case of a comparison system with two modules. It is also shown that as a result of increasing numbers in positional calculus, they successively change in a spiral on the surface of a two-dimensional torus. Based on this approach, a fast algorithm for comparing numbers and an algorithm for detecting an overflow during addition and multiplication of numbers in modular representation were developed. Consideration for the multidimensional case is possible when analyzing a multidimensional torus and studying the behavior of the turns on its surface.","PeriodicalId":292298,"journal":{"name":"Analysis and data processing systems","volume":"13 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-09-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Analysis and data processing systems","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.17212/2782-2001-2021-3-75-86","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

The method of modular arithmetic consists in operating not with a number, but with its remainders after division by some integers. In the modular number system or the number system in the residual classes, a multi-bit integer in the positional number system is represented as a sequence of several positional numbers. These numbers are the remainders (residues) of dividing the original number into some modules that are mutually prime integers. The advantage of the modular representation is that it is very simple to perform addition, subtraction and multiplication operations. In parallel execution of operations, the use of modular arithmetic can significantly reduce the computation time. However, there are drawbacks to modular representation that limit its use. These include a slow conversion of numbers from modular to positional representation; the complexity of comparing numbers in modular representation; the difficulty in performing the division operation; and the difficulty of determining the presence of an overflow. The use of modular arithmetic is justified if there are fast algorithms for calculating a number from a set of remainders. This article describes a fast algorithm for converting numbers from modular representation to positional representation based on a geometric approach. The review is carried out for the case of a comparison system with two modules. It is also shown that as a result of increasing numbers in positional calculus, they successively change in a spiral on the surface of a two-dimensional torus. Based on this approach, a fast algorithm for comparing numbers and an algorithm for detecting an overflow during addition and multiplication of numbers in modular representation were developed. Consideration for the multidimensional case is possible when analyzing a multidimensional torus and studying the behavior of the turns on its surface.
模算法中数字的比较与溢出分析
模算术的方法不是用一个数字来运算,而是用它除以一些整数后的余数来运算。在模数系统或残差类中的数系统中,位置数系统中的多位整数表示为若干位置数的序列。这些数是将原数分成若干互为素数整数的模后的余数(残数)。模块化表示法的优点是执行加法、减法和乘法运算非常简单。在并行执行操作时,使用模块化算法可以显著减少计算时间。然而,模块化表示的缺点限制了它的使用。这些问题包括数字从模块表示到位置表示的缓慢转换;模表示中数字比较的复杂性进行除法运算的难度;以及确定是否存在溢出的困难。如果有从一组余数中计算数字的快速算法,则使用模运算是合理的。本文描述了一种基于几何方法将数字从模表示转换为位置表示的快速算法。对一个有两个模块的比较系统进行了审查。在位置演算中,随着数字的增加,它们在二维环面表面呈螺旋形变化。在此基础上,提出了一种快速的数字比较算法和一种模块化表示中数字加乘溢出检测算法。在分析多维环面并研究其表面上的转弯行为时,可以考虑多维情况。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信