You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For floating-point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%G precision sets the maximum number of significant digits (trailing zeros are removed)
Another approach could be round the unit test result, but this can be a bit dangerous
The text was updated successfully, but these errors were encountered:
About this page, https://github.com/quii/learn-go-with-tests/blob/master/structs-methods-and-interfaces.md
I see a different ways to show the circle area value, in some parts with
%f
and%.2f
In any case, it won't give you too much info to see why the test fails
Example
With a circle with area 5, I think should be
78.539816339745
(Doing my self or using an online calculator), withgot %f want %f
it showsgot 78.539816 want 78.539816
But, if I change it to
%g
got 78.53981633974483 want 78.539816339745
Ok, perfect, set want to
78.53981633974483
https://golang.org/pkg/fmt/
Another approach could be round the unit test result, but this can be a bit dangerous
The text was updated successfully, but these errors were encountered: