Author | Message |
---|---|
jcalilu
Posts: 20
|
Posted 20:17 Apr 27, 2016 |
When I try to create a column for GPA: sum(g.value * c.units) / sum (c.units) as "major_gpa" for one of the values, I get a 3.29999995231628 (double precision type) for Amy's major GPA. But she is only taking one class which is worth 4 units and got a B+ (with a real type value of 3.3), so 4 units * 3.3 / 4 units = 3.3? Is the 3.29999995231628 answer acceptable? How can you make the result 3.3? |
cysun
Posts: 2935
|
Posted 22:21 Apr 27, 2016 |
Well, I used real (i.e. float4) for the grade value in the grades table, so the grade value is not very accurate to begin with and 3.299999 is perfectly acceptable. If you change the type to double precision (or float8) you should get 3.3. |