Discussion:
Assignment Question 2: Mea Culpa
(too old to reply)
Joanne Atlee
2010-05-21 18:55:16 UTC
Permalink
Hi everyone,

As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.

To recover from this problem as best that we can, we are providing two
executables for you to use to test your program:

- the original executable. This uses floating point representation,
but integer values (to reduce the amount of floating point arithmetic).
So it is more precise than simply maintaining a double typed data
member and performing floating point arithmetic.

- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.


You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.


If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.


The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.


Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte


I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.


Jo
CS 246 SE Tutor
2010-05-21 23:27:24 UTC
Permalink
The precise executable has been posted to the assignment page of the
course webpage.

Also, Marmoset has been set up to allow submissions for bonus marks for
precise code. Note that it is set up as a separate project called
"A1Q2_Bonus". To be eligible for these bonus marks, you must submit
your code to "A1Q2_Bonus" as well as "A1Q2" (for the regular submissions
and tests).

Casey
Post by Joanne Atlee
Hi everyone,
As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.
To recover from this problem as best that we can, we are providing two
- the original executable. This uses floating point representation, but
integer values (to reduce the amount of floating point arithmetic). So
it is more precise than simply maintaining a double typed data member
and performing floating point arithmetic.
- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.
You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.
If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.
The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.
Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte
I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.
Jo
Robert Taylor
2010-05-24 05:38:32 UTC
Permalink
Do we still have the same limits imposed on us? No modifying the code
except for the private methods and those Money operands? I don't like
how the constructor is forcing a double cast on the amount. Are we
allowed to write a public method (overloaded constructor probably) that
allows us to pass integer types to the object, or have you guys done
some voodoo magic to that passed-in double to achieve sufficient precision?

I can't really imagine a way of implementing your second, more precise
executable otherwise. If I'm thinking about the problem completely
wrong, I'd like to know so that I just implement the first method.

Cheers,
Rob
Post by Joanne Atlee
Hi everyone,
As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.
To recover from this problem as best that we can, we are providing two
- the original executable. This uses floating point representation, but
integer values (to reduce the amount of floating point arithmetic). So
it is more precise than simply maintaining a double typed data member
and performing floating point arithmetic.
- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.
You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.
If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.
The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.
Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte
I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.
Jo
Robert Taylor
2010-05-24 06:00:58 UTC
Permalink
Read your post again and realized that you actually stated that a
rewrite of the interface would be needed. I guess I'm a little confused
over what you're letting us do. So we ARE allowed to modify your code as
part of the "challenge" to have superior precision?

Cheers,
Rob
Post by Robert Taylor
Do we still have the same limits imposed on us? No modifying the code
except for the private methods and those Money operands? I don't like
how the constructor is forcing a double cast on the amount. Are we
allowed to write a public method (overloaded constructor probably) that
allows us to pass integer types to the object, or have you guys done
some voodoo magic to that passed-in double to achieve sufficient precision?
I can't really imagine a way of implementing your second, more precise
executable otherwise. If I'm thinking about the problem completely
wrong, I'd like to know so that I just implement the first method.
Cheers,
Rob
Post by Joanne Atlee
Hi everyone,
As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.
To recover from this problem as best that we can, we are providing two
- the original executable. This uses floating point representation, but
integer values (to reduce the amount of floating point arithmetic). So
it is more precise than simply maintaining a double typed data member
and performing floating point arithmetic.
- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.
You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.
If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.
The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.
Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte
I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.
Jo
Robert Taylor
2010-05-24 07:35:35 UTC
Permalink
Nvm. I think I found the voodoo magic.

Cheers,
Rob
Post by Robert Taylor
Read your post again and realized that you actually stated that a
rewrite of the interface would be needed. I guess I'm a little confused
over what you're letting us do. So we ARE allowed to modify your code as
part of the "challenge" to have superior precision?
Cheers,
Rob
Post by Robert Taylor
Do we still have the same limits imposed on us? No modifying the code
except for the private methods and those Money operands? I don't like
how the constructor is forcing a double cast on the amount. Are we
allowed to write a public method (overloaded constructor probably) that
allows us to pass integer types to the object, or have you guys done
some voodoo magic to that passed-in double to achieve sufficient precision?
I can't really imagine a way of implementing your second, more precise
executable otherwise. If I'm thinking about the problem completely
wrong, I'd like to know so that I just implement the first method.
Cheers,
Rob
Post by Joanne Atlee
Hi everyone,
As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.
To recover from this problem as best that we can, we are providing two
- the original executable. This uses floating point representation, but
integer values (to reduce the amount of floating point arithmetic). So
it is more precise than simply maintaining a double typed data member
and performing floating point arithmetic.
- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.
You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.
If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.
The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.
Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte
I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.
Jo
Robert Taylor
2010-05-24 08:31:04 UTC
Permalink
PreciseMoney.out has the following behaviour:

Command: -$2.2222
== -$2.22

In the assignment it was stated that "-$2.2222 is rounded down to
-$2.23". Money.out produces the correct output. Isn't PreciseMoney.out
supposed to be the one with better precision?

Cheers,
Rob
Post by Robert Taylor
Nvm. I think I found the voodoo magic.
Cheers,
Rob
Post by Robert Taylor
Read your post again and realized that you actually stated that a
rewrite of the interface would be needed. I guess I'm a little confused
over what you're letting us do. So we ARE allowed to modify your code as
part of the "challenge" to have superior precision?
Cheers,
Rob
Post by Robert Taylor
Do we still have the same limits imposed on us? No modifying the code
except for the private methods and those Money operands? I don't like
how the constructor is forcing a double cast on the amount. Are we
allowed to write a public method (overloaded constructor probably) that
allows us to pass integer types to the object, or have you guys done
some voodoo magic to that passed-in double to achieve sufficient precision?
I can't really imagine a way of implementing your second, more precise
executable otherwise. If I'm thinking about the problem completely
wrong, I'd like to know so that I just implement the first method.
Cheers,
Rob
Post by Joanne Atlee
Hi everyone,
As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.
To recover from this problem as best that we can, we are providing two
- the original executable. This uses floating point representation, but
integer values (to reduce the amount of floating point arithmetic). So
it is more precise than simply maintaining a double typed data member
and performing floating point arithmetic.
- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.
You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.
If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.
The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.
Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte
I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.
Jo
Robert Taylor
2010-05-24 08:45:24 UTC
Permalink
Man am I ever tired. Sorry. You guys already covered this... We're not
even supposed to be testing with more than two decimal inputs.

Maybe I should go to sleep soon.

Cheers,
Rob
Post by Robert Taylor
Command: -$2.2222
== -$2.22
In the assignment it was stated that "-$2.2222 is rounded down to
-$2.23". Money.out produces the correct output. Isn't PreciseMoney.out
supposed to be the one with better precision?
Cheers,
Rob
Post by Robert Taylor
Nvm. I think I found the voodoo magic.
Cheers,
Rob
Post by Robert Taylor
Read your post again and realized that you actually stated that a
rewrite of the interface would be needed. I guess I'm a little confused
over what you're letting us do. So we ARE allowed to modify your code as
part of the "challenge" to have superior precision?
Cheers,
Rob
Post by Robert Taylor
Do we still have the same limits imposed on us? No modifying the code
except for the private methods and those Money operands? I don't like
how the constructor is forcing a double cast on the amount. Are we
allowed to write a public method (overloaded constructor probably) that
allows us to pass integer types to the object, or have you guys done
some voodoo magic to that passed-in double to achieve sufficient precision?
I can't really imagine a way of implementing your second, more precise
executable otherwise. If I'm thinking about the problem completely
wrong, I'd like to know so that I just implement the first method.
Cheers,
Rob
Post by Joanne Atlee
Hi everyone,
As some of you have noticed, the provided executable for Question 2 has
a precision that is *much* less than desired -- due to innate
imprecisions in floating-point number representation.
To recover from this problem as best that we can, we are providing two
- the original executable. This uses floating point representation, but
integer values (to reduce the amount of floating point arithmetic). So
it is more precise than simply maintaining a double typed data member
and performing floating point arithmetic.
- a more precise executable. This one uses integer types and integer
values (again to reduce the amount of floating point arithmetic even
more). There is more than the above hints to achieve this level of
precision.
You are free to based your solution on either of the provided
executables. We are keeping the original executable around because some
of you have been working to make your solution like ours. You can do so
and receive full credit for this question.
If you want to take the challenge of the question as it was originally
intended, we provide a new executable. We believe that it is precise to
Money values of +/= $50 billion, and multiplication factors that have up
to 2 decimal places. You can receive up to 10 additional marks on the
assignment for achieving this level of precision.
The name of your submitted solution is the same, regardless of which
level of precision you achieve. If you are submitting the more precise
solution, look for the Marmoset Q2 BONUS submission.
Lastly, for your information, we'll be running the test scripts on
linux006.student.cs. It has
int 4 byte
long 8 byte
long long 8 byte
double 8 byte
long double 16 byte
I apologize for the late detection of the lack of precision in our
original provided executable. I hope that the chance for doing better
than my original solution, and for getting bonus marks (and bragging
rights) for doing so will partially make up for this.
Jo
Loading...