Didart

Floating Equality

Sep 28th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FloatingEquality {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double eps = 0.000001;
  8.         double firstDigit = Double.parseDouble(scanner.nextLine());
  9.         double secondDigit = Double.parseDouble(scanner.nextLine());
  10.  
  11.         if (Math.abs(firstDigit - secondDigit) < 0.000001) {
  12.             System.out.println("True");
  13.         } else {
  14.             System.out.println("False");
  15.         }
  16.     }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment