ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 May 2017 My Price 8.00

The IEEE-754 single precision floating point

Use a programming language of your choice (i.e java) to write an application to convert decimal number to IEEE-754 Single Precision Floating-Point Representation (32-bit) and IEEE-754 Double Precision Floating-Point Representation (64-bit) and convert back to decimal. Use GUI as user interface asking the user for decimal number and the program will output the result. 

Specification

The IEEE-754 single precision floating point standard uses an 8-bit exponent (with a bias of 127) and a 23-bit significand.

The IEEE-754 double precision standard uses an 11-bit exponent (with a bias of 1023) and a 52-bit significand.

Requirements

  • Make your application runnable.

I've been using Java but I have a hard time with GUI (t makes no sense to me) and how to convert the floating points back to decimals. Below is what I have so far. 

 

 

import java.util.Scanner;
public class conversionClass
{
     public static void main(String[]args)
     {
        Scanner scanInput = new Scanner(System.in);
        double decimalNum;
        int valueBit;
        String stringOfBits;
      
        System.out.println("Please enter the decimal that needs to convert in single precision floating point");
      
        decimalNum = scanInput.nextInt();
        float f = (float)decimalNum;
        valueBit = Float.floatToIntBits(f);
        stringOfBits = Integer.toBinaryString(valueBit);
        System.out.println("Single precision floating point:" + stringOfBits);
      
        System.out.println("Please enter the decimal that needs to convert in double precision floating point");
      
        decimalNum = scanInput.nextInt();
         stringOfBits = Long.toString(Double.doubleToLongBits(decimalNum), 2);
        System.out.println("double precision floating point:" + stringOfBits);   
      
     }
}

Answers

(11)
Status NEW Posted 26 May 2017 03:05 AM My Price 8.00

-----------

Not Rated(0)