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

  Briefly describes the method you apply to that collection

Briefly describes the method you apply to that collection. Defines the method using pseudo code that contains at least two if methods.

  Flowchart create a flowchart that prompts

Flowchart Create a flowchart that prompts and gets input for the current grade. If the grade is 90 or above print "A". If the grade is 80-89 then print "B". If the grade is 70-79 then print "C".

  Implement solution for given problem in java control robot

CS1810 Software Implementation Event 2016/17 Assignment 3 - Robot Coding. Implement a solution for a given problem in Java that would control your finch robot

  Java program using the net beans ide

For this Assignment, you will update an existing Java program using the NetBeans IDE. You will use the NetBeans Integrated Development Environment to make changes to an existing NetBeans Java Project.

  Write a program to print all of the permutations

Write a program to print all of the permutations of the values 1, 2, 3, ..., n - Your program takes one argument from the command line, which as an integer n  that is the number of elements.

  Demonstrate in the program how two threads can

Demonstrate in the program how two threads can, sometimes, invoke atomic() concurrently. Create a second version of the program in which the two threads cannot invoke atomic concurrently.

  In java programming objects are stored on stack

In java programming Objects are stored on Stack. True/False

  1 comparing portions of strings write an application that

1. comparing portions of strings write an application that uses string method region-matches to compare two strings

  Write a program to guess a word by trying

Write a program to guess a word by trying to guess the individual characters - The word to be guessed shall be provided using the command-line argument

  Write a simple program to implement inner class

Write a simple program to implement inner class using ActionListener

  Writing messages to a serversocket in java

the server must accept a connection before the client can communicate.

  The letters of the alphabet a through z

The letters of the alphabet A through Z can be represented in Morse code. Each letter is represented by a combination of up to four dots and/or dashes, as shown below. Use Java to write and run a console-window program that can convert an English ..

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