- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Apply modulus operator to floating-point values in Java
To apply modulus (%) operator to floating-point values in an effortless task. Let us see how.
We have the following two values −
double one = 9.7; double two = 1.2;
Let us now apply the modulus operator −
one % two
The following is the complete example that displays the output as well −
Example
public class Demo { public static void main(String args[]) { double one = 9.7; double two = 1.2; System.out.println( one % two ); } }
Output
0.09999999999999964
- Related Articles
- Floating-point hexadecimal in Java
- Comparison of floating point values in PHP.
- Format floating point number in Java
- Floating-point conversion characters in Java
- What is Modulus Operator (%) in JavaScript?
- Floating point operators and associativity in Java
- Format floating point with Java MessageFormat
- Java program to multiply given floating point numbers
- Java Program to Multiply Two Floating-Point Numbers
- Apply Ternary operator on double value in Java
- Floating Point Operations and Associativity in C, C++ and Java
- Floating point comparison in C++
- C++ Floating Point Manipulation
- Signed floating point numbers
- Fixed Point and Floating Point Number Representations

Advertisements