HELP NEEDED ASAP!  Language: JAVA The following code sequence is supposed to compare a float and a double with the same value and output that they are equal. What is wrong with the following code sequence? Why is it not showing the correct answer? Write your code to fix the problem. float piF = 3.141592653589793f; double piD = 3.141592653589793; if(piF == piD)    System.out.println("piF and piD are equal"); else     System.out.println("piF and piD are not equal");

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question

HELP NEEDED ASAP! 

Language: JAVA

The following code sequence is supposed to compare a float and a double with the same value and output that they are equal. What is wrong with the following code sequence? Why is it not showing the correct answer? Write your code to fix the problem.

float piF = 3.141592653589793f;

double piD = 3.141592653589793;

if(piF == piD)

   System.out.println("piF and piD are equal");

else

    System.out.println("piF and piD are not equal");

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,