Performance Analysis of BigDecimal Arithmetic Operation in Java

The Java programming language provides binary floating-point primitive data types such as float and double to represent decimal numbers. However, these data types cannot represent decimal numbers with complete accuracy, which may cause precision errors while performing calculations. To achieve bette...

Full description

Bibliographic Details
Main Authors: Jos Timanta Tarigan, Elviawaty M. Zamzami, Cindy Laurent Ginting
Format: Article
Language:English
Published: ITB Journal Publisher 2018-12-01
Series:Journal of ICT Research and Applications
Subjects:
Online Access:http://journals.itb.ac.id/index.php/jictra/article/view/7278
_version_ 1818919147299405824
author Jos Timanta Tarigan
Elviawaty M. Zamzami
Cindy Laurent Ginting
author_facet Jos Timanta Tarigan
Elviawaty M. Zamzami
Cindy Laurent Ginting
author_sort Jos Timanta Tarigan
collection DOAJ
description The Java programming language provides binary floating-point primitive data types such as float and double to represent decimal numbers. However, these data types cannot represent decimal numbers with complete accuracy, which may cause precision errors while performing calculations. To achieve better precision, Java provides the BigDecimal class. Unlike float and double, which use approximation, this class is able to represent the exact value of a decimal number. However, it comes with a drawback: BigDecimal is treated as an object and requires additional CPU and memory usage to operate with. In this paper, statistical data are presented of performance impact on using BigDecimal compared to the double data type. As test cases, common mathematical processes were used, such as calculating mean value, sorting, and multiplying matrices.
first_indexed 2024-12-20T01:01:14Z
format Article
id doaj.art-fceb1c6071e848b2941455e68b846b6b
institution Directory Open Access Journal
issn 2337-5787
2338-5499
language English
last_indexed 2024-12-20T01:01:14Z
publishDate 2018-12-01
publisher ITB Journal Publisher
record_format Article
series Journal of ICT Research and Applications
spelling doaj.art-fceb1c6071e848b2941455e68b846b6b2022-12-21T19:59:00ZengITB Journal PublisherJournal of ICT Research and Applications2337-57872338-54992018-12-0112310.5614/itbj.ict.res.appl.2018.12.3.5Performance Analysis of BigDecimal Arithmetic Operation in JavaJos Timanta Tarigan0Elviawaty M. Zamzami1Cindy Laurent Ginting2Faculty of Computer Science and Information Technology, Universitas Sumatera Utara, Jalan Universitas No.9, Padang Bulan, Medan Baru, Kota Medan 20222, Sumatera UtaraFaculty of Computer Science and Information Technology, Universitas Sumatera Utara, Jalan Universitas No.9, Padang Bulan, Medan Baru, Kota Medan 20222, Sumatera UtaraFaculty of Computer Science and Information Technology, Universitas Sumatera Utara, Jalan Universitas No.9, Padang Bulan, Medan Baru, Kota Medan 20222, Sumatera Utara,The Java programming language provides binary floating-point primitive data types such as float and double to represent decimal numbers. However, these data types cannot represent decimal numbers with complete accuracy, which may cause precision errors while performing calculations. To achieve better precision, Java provides the BigDecimal class. Unlike float and double, which use approximation, this class is able to represent the exact value of a decimal number. However, it comes with a drawback: BigDecimal is treated as an object and requires additional CPU and memory usage to operate with. In this paper, statistical data are presented of performance impact on using BigDecimal compared to the double data type. As test cases, common mathematical processes were used, such as calculating mean value, sorting, and multiplying matrices.http://journals.itb.ac.id/index.php/jictra/article/view/7278BigDecimal arithmetic operationfloating-point arithmeticnumerical programmingoptimizationprogramming language
spellingShingle Jos Timanta Tarigan
Elviawaty M. Zamzami
Cindy Laurent Ginting
Performance Analysis of BigDecimal Arithmetic Operation in Java
Journal of ICT Research and Applications
BigDecimal arithmetic operation
floating-point arithmetic
numerical programming
optimization
programming language
title Performance Analysis of BigDecimal Arithmetic Operation in Java
title_full Performance Analysis of BigDecimal Arithmetic Operation in Java
title_fullStr Performance Analysis of BigDecimal Arithmetic Operation in Java
title_full_unstemmed Performance Analysis of BigDecimal Arithmetic Operation in Java
title_short Performance Analysis of BigDecimal Arithmetic Operation in Java
title_sort performance analysis of bigdecimal arithmetic operation in java
topic BigDecimal arithmetic operation
floating-point arithmetic
numerical programming
optimization
programming language
url http://journals.itb.ac.id/index.php/jictra/article/view/7278
work_keys_str_mv AT jostimantatarigan performanceanalysisofbigdecimalarithmeticoperationinjava
AT elviawatymzamzami performanceanalysisofbigdecimalarithmeticoperationinjava
AT cindylaurentginting performanceanalysisofbigdecimalarithmeticoperationinjava