[samigo-team] Floating point numbers

Sam Ottenhoff ottenhoff at longsight.com
Fri Mar 15 08:34:27 PDT 2013


Changes committed to trunk.  All single-precision floats in Samigo have
been replaced with doubles:

  https://jira.sakaiproject.org/browse/SAM-2087

Small change in common (for importing), reference (conversion scripts), and
lots of changes in samigo Hibernate files (.hbm.xml) and Java files.

--Sam


On Sun, Mar 10, 2013 at 1:31 PM, Sam Ottenhoff <ottenhoff at longsight.com>
wrote:
>
> Okay, I attached a patch to https://jira.sakaiproject.org/browse/SAM-2087.
>
> I also have a demo server up: http://198.30.168.81:15150/portal/.  Sakai
demo mode is enabled so you can login with a username like
instructor1/sakai or student0012/sakai.
>
> All of my tests look good so far.  This change makes sense to me.  The
gradebook uses double-precision numbers for recording points.  Samigo
should do the same thing.
>
> This is a large change.  It essentially changes all occurrences of floats
with doubles.
>
> --Sam
>
>
> On Tue, Mar 5, 2013 at 11:34 AM, Sam Ottenhoff <ottenhoff at longsight.com>
wrote:
>>
>> I gave it a try, but it involves 1000+ changes.  It probably makes sense
to just improve precision and move from floats to doubles instead.  The
gradebook records POINTS_EARNED as a double.
>>
>>
>> On Thu, Feb 28, 2013 at 2:16 PM, Karen Tsao <ktsao at stanford.edu> wrote:
>>>
>>> Thanks for everyone's input.
>>>
>>> Sam,
>>>
>>> Could you please make the change? Thanks!
>>>
>>> Karen
>>>
>>>
>>> On Thu, Feb 28, 2013 at 6:19 AM, David Horwitz <david.horwitz at uct.ac.za>
wrote:
>>>>
>>>> There's a another issue (fixable without replacing floats but still)
>>>>
>>>> There are several places in the code where direct foat comparisons are
made:
>>>>
>>>> Float a =
>>>> Float b,
>>>>
>>>> if (a.equals(b))
>>>>
>>>> For instance to check if an answer has been updated etc. We could be
getting extra updated because of slight differences in the float
representation ...
>>>>
>>>> D
>>>>
>>>>
>>>> On Thu, 2013-02-28 at 09:11 -0500, Sam Ottenhoff wrote:
>>>>
>>>>
>>>> But just curious, what is the advantage of this change? Is this for
getting a more precise score? Like some 0.999 issue?
>>>>
>>>>
>>>>
>>>> An instructor created a complex placement exam that used point scores
in the millions, thousands, hundreds, etc. as a way of being able to
quickly see points in various sections in the final score (example:
27005508.06 could be broken up to see that the student scores 06 on sec 1,
08, on sec 2, 55 on sec 3, 27 on sec 4).
>>>>
>>>>
>>>>
>>>> So the reason why floating point numbers aren't used for money:
>>>>
>>>>
>>>>
>>>> > create table floattest (z float);
>>>>
>>>> > insert into floattest VALUES (2075808);
>>>>
>>>> > select * from floattest;
>>>>
>>>>
>>>>
>>>> The result: 2075810
>>>>
>>>> _______________________________________________
>>>> samigo-team mailing list
>>>> samigo-team at collab.sakaiproject.org
>>>> http://collab.sakaiproject.org/mailman/listinfo/samigo-team
>>>>
>>>>
>>>> ________________________________
>>>> UNIVERSITY OF CAPE TOWN
>>>>
>>>> This e-mail is subject to the UCT ICT policies and e-mail disclaimer
published on our website at
http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27
21 650 9111. This e-mail is intended only for the person(s) to whom it is
addressed. If the e-mail has reached you in error, please notify the
author. If you are not the intended recipient of the e-mail you may not
use, disclose, copy, redirect or print the content. If this e-mail is not
related to the business of UCT it is sent by the sender in the sender's
individual capacity.
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/samigo-team/attachments/20130315/74369580/attachment.html 


More information about the samigo-team mailing list