Create a java class that implements floating point add

Assignment Help JAVA Programming
Reference no: EM131826900

Assignment

For this assignment, you will be creating a Java class that implements floating point Add and Multiply. The layout of your class should look like this:

// your name
public class fp
{
public int add(int a, int b)
{
...
}
public int mul(int a, int b) {
...
}
}

The name of this file should be 'fp.java'. Email this to me by the start of class on the 23rd. I will have a test program that will call these routines with a number of test cases. Your grade for the homework will be based on the percentage of test cases that your code correctly solves.

As you can see, the inputs and outputs of the routines are all integers. However, the bits in these integers follows the IEEE754 standard, so bit 31 is the S field, bits 23 - 30 are the E field, and bits 0 - 22 are the F field. The first thing you will need to do is split these fields out, and when you are done, assemble the result S, E, and F fields back into an integer. You might do something like this:

int aS = (a >> 31) & 1;
int aE = (a >> 23) & 255;
int aF = a & 0x7FFFFF;

Also, to help test your code, recall these numbers in FP format:

int v24_25 = 0x41C20000; // 24.25
int v_1875 = 0xBE400000; // -0.1875
int v5 = 0xC0A00000; // -5.0

Important notes:

1. Your code should not require any extra packages.

2. The book didn't adequately discuss rounding issues, so none of the test cases will require rounding.

3. The book did not accurately discuss denormalized numbers, so the only denormalized number in the test cases will be the value '0'.

4. But the examples will include zero, infinities, and some NaNs. In particular, figure out how to handle inputs that are infinity.

Reference no: EM131826900

Questions Cloud

Create database salesinformation : CREATE DATABASE salesinformation; CREATE TABLE sales_data (sale_date date, client_name varchar, product_name varchar, total_dsum int);
Approximate measure of subcutaneous body fat : Use the ice data set to see if the intramuscular temperature changes more for people with smaller Skinfold measurements.
Temperature measurements from the ice data set : Use the B1930 temperature measurements from the ice data set to see if there is evidence that any of the following differ between men and women.
Predict waist-to-hip ratio : Does the genetic marker in fusion1 predict waist-to-hip ratio (phenol where)? Fit an appropriate model to answer this question.
Create a java class that implements floating point add : For this assignment, you will be creating a Java class that implements floating point Add and Multiply. The layout of your class should look like this.
Rabbit experiment in the previous problem : Answer the following questions about the rabbit experiment in the previous problem.
Report and analysis of the firms financial performance : HI5002 - Finance for Business - Discuss what dividend policy of the management of the company appears to be implemented. Explain any reason related
Contains the results of a randomized block : The data set egg prod in the faraway package contains the results of a randomized block experiment. Six pullets (young chickens) were placed into each of 12 pen
Prepare an income statement using full costing : Problem - Variable and Full Costing Income: Comprehensive Problem. Prepare an income statement using full costing

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd