About One p-adic Representation of Floating-point Numbers
DOI:
https://doi.org/10.24160/1993-6982-2025-6-179-188Keywords:
p-adic numbers, floating point numbers, Hansel codes, ultrametric norm, rounding errorsAbstract
The purpose of the work is to develop and study an approach based on p-adic numbers for problems where conventional floating-point arithmetic demonstrates a loss of accuracy, in particular, when performing computations with numbers that differ greatly from each other in order and when subtracting numbers close to each other in value.
The work methodology is based on a theoretical analysis of the p-adic representation of floating-point numbers and a theoretical and experimental study of its behavioral properties with limited accuracy.
For the p-adic representation based on Hansel codes, formulas are presented for estimating the range of representable rational numbers and the representation accuracy depending on the p-adic representation parameters (the number p, the length of the mantissa r). The features of the p-adic representation of numbers are considered, in particular, the fact that rounding is performed without distortion of the lower digits due to the direction during bitwise transfer operations. The results of experiments conducted in the SageMath environment have shown that the use of p-adic arithmetic, when calculating the scalar product of vectors with very differing coordinates provides an accurate result, while the standard floating-point arithmetic demonstrates a dramatic loss of accuracy. It has theoretically been shown that if one of the two norms of the difference between two floating-point numbers close to each other in value is less than unity (real or p-adic), then the other one is greater than unity, which allows one to automatically select a more accurate result when subtracting numbers close in value and reduce the risk of loss of accuracy.
The difference in the p-adic representation topology in comparison with real numbers makes it possible to use this representation as an additional tool for clarifying the results when subtracting numbers close to each other in value or calculations with numbers differing from each other in order.
References
1. Оцоков Ш. А., Дзегеленок И. И. Машинная арифметика и направления её развития. М.: Изд-во МЭИ, 2022.
2. Caruso X., Roe D., Vaccon T. Computations with P-adic Numbers // J. Symbolic Computation. 2017. V. 81. Pp. 205—219.
3. Maddock C. P-Adic Numbers: Theory and Applications. Boston: Henderson Mathematical Institute Publ., 2024.
4. Katok S. P-Adic Analysis Compared with Real. N.-Y.: Providence: American Math. Soc., 2007.
5. Schikhof W.H. Ultrametric Calculus: an Introduction to P-Adic Analysis. Cambridge: Cambridge University Press, 1984.
6. Doris C. Exact P-Adic Computation in Magma // J. Symbolic Computation. 2021. V. 104. Pp. 476—493.
7. Pan V. Y., Murphy B., Rosholt R. Toeplitz and Hankel Matrices Meet Hensel Lifting. Technical Rep. TR-2005008. N.-Y.: City University of New York, 2005.
8. Robert A. M. A Course in P-adic Analysis. New York: Springer, 2000.
9. Cohen H. A Course in Computational Algebraic Number Theory. Berlin: Springer, 1993.
10. Грегори Р., Кришнамурти Е. Безошибочные вычисления: методы и приложения. М.: Мир, 1988.
11. Zerzaihi M., Kecies M., Knapp J. Computation of Square and Cube Roots of P-Adic Numbers via Newton-Raphson Method // J. Mathematics Research. 2013. V. 5(1). Pp. 1—8.
12. Волович И. В., Козырев С. В. p-адическая математическая физика: основные конструкции, применения к сложным и наноскопическим системам // Математическая физика и её приложения. 2008. № 1. С. 1—36.
13. Hao J. The development of P-adic Numbers Theoretically and Their Use in Number Theory // Theoretical and Natural Sci. 2023. V. 25(1). Pp. 73—77.
14. Знакомство с p-адическими числами. Ч. 1 [Электрон. ресурс] https://habr.com/ru/articles/645939/ (дата обращения 08.05.2025).
15. Koç Ç. K. Parallel P-adic Method for Solving Linear Systems of Equations // Parallel Computing. 1997. V. 23(13). Pp. 2067—2074.
16. SageMath Documentation: P-adic Numbers (Version 10.6) [Электрон. ресурс] https://doc.sagemath.org/html/en/reference/padics/index.html (дата обращения 08.05.2025).
17. Мак-Кракен Д., Дорн У. Численные методы и программирование на Фортране. М.: Мир, 1965.
18. Kettner L. e. a. Class-room Examples of Robustness Problems in Geometric Computations // Algorithms – ESA. Lecture Notes in Computer Science. Berlin: Springer, 2004. V. 3221.
19. Орлов Д.А. Организация многопотоковой обработки данных с исключением аномалий при решении задач вычислительной геометрии: дис. … канд. техн. наук. М.: НИУ «МЭИ», 2010.
---
Для цитирования: Оцоков Ш.А., Мишин А.А., Сурхаев М.А. Об одном р-адическом представлении чисел с плавающей точкой // Вестник МЭИ. 2025. № 6. С. 179—188. DOI: 10.24160/1993-6982-2025-6-179-188
---
Конфликт интересов: авторы заявляют об отсутствии конфликта интересов
#
1. Otsokov Sh. A., Dzegelenok I. I. Mashinnaya Arifmetika i Napravleniya ee Razvitiya. M.: Izd-vo MEI, 2022. (in Russian).
2. Caruso X., Roe D., Vaccon T. Computations with P-adic Numbers. J. Symbolic Computation. 2017; 81:205—219.
3. Maddock C. P-Adic Numbers: Theory and Applications. Boston: Henderson Mathematical Institute Publ., 2024.
4. Katok S. P-Adic Analysis Compared with Real. N.-Y.: Providence: American Math. Soc., 2007.
5. Schikhof W.H. Ultrametric Calculus: an Introduction to P-Adic Analysis. Cambridge: Cambridge University Press, 1984.
6. Doris C. Exact P-Adic Computation in Magma. J. Symbolic Computation. 2021;104:476—493.
7. Pan V. Y., Murphy B., Rosholt R. Toeplitz and Hankel Matrices Meet Hensel Lifting. Technical Rep. TR-2005008. N.-Y.: City University of New York, 2005.
8. Robert A. M. A Course in P-adic Analysis. New York: Springer, 2000.
9. Cohen H. A Course in Computational Algebraic Number Theory. Berlin: Springer, 1993.
10. Gregori R., Krishnamurti E. Bezoshibochnye Vychisleniya: Metody i Prilozheniya. M.: Mir, 1988. (in Russian).
11. Zerzaihi M., Kecies M., Knapp J. Computation of Square and Cube Roots of P-Adic Numbers via Newton-Raphson Method. J. Mathematics Research. 2013;5(1):1—8.
12. Volovich I. V., Kozyrev S. V. P-adicheskaya Matematicheskaya Fizika: Osnovnye Konstruktsii, Primeneniya k Slozhnym i Nanoskopicheskim Sistemam. Matematicheskaya Fizika i ee Prilozheniya. 2008;1:1—36. (in Russian).
13. Hao J. The Development of P-adic Numbers Theoretically and Their Use in Number Theory. Theoretical and Natural Sci. 2023;25(1):73—77.
14. Znakomstvo s P-adicheskimi Chislami. Ch. 1 [Elektron. Resurs] https://habr.com/ru/articles/645939/ (Data Obrashcheniya 08.05.2025). (in Russian).
15. Koç Ç. K. Parallel P-adic Method for Solving Linear Systems of Equations. Parallel Computing. 1997;23(13):2067—2074.
16. SageMath Documentation: P-adic Numbers (Version 10.6) [Elektron. Resurs] https://doc.sagemath.org/html/en/reference/padics/index.html (Data Obrashcheniya 08.05.2025).
17. Mak-Kraken D., Dorn U. Chislennye Metody i Programmirovanie na Fortrane. M.: Mir, 1965. (in Russian).
18. Kettner L. e. a. Class-room Examples of Robustness Problems in Geometric Computations. Algorithms – ESA. Lecture Notes in Computer Science. Berlin: Springer, 2004;3221.
19. Orlov D.A. Organizatsiya Mnogopotokovoy Obrabotki Dannykh s Isklyucheniem Anomaliy pri Reshenii Zadach Vychislitel'noy Geometrii: Dis. … Kand. Tekhn. Nauk. M.: NIU «MEI», 2010. (in Russian)
---
For citation: Otsokov Sh.A., Mishin A.A., Surkhaev M.A. About One p-adic Representation of Floating-point Numbers. Bulletin of MPEI. 2025;6:179—188. (in Russian). DOI: 10.24160/1993-6982-2025-6-179-188
---
Conflict of interests: the authors declare no conflict of interest

