Open
Description
The doc comment below should be hidden from end users because the terms value
and exp
are not defined anywhere end users can see.
// Decimal represents a fixed-point decimal. It is immutable.
// number = value * 10 ^ exp ← (THIS)
type Decimal struct {
value *big.Int
// NOTE(vadim): this must be an int32, because we cast it to float64 during
// calculations. If exp is 64 bit, we might lose precision.
// If we cared about being able to represent every possible decimal, we
// could make exp a *big.Int but it would hurt performance and numbers
// like that are unrealistic.
exp int32
}
Some suggestions:
-
Prevent the line from being rendered. (I don't know it's technically possible in Go though.)
-
Just move the line inside
struct{ ... }
. Maybe just after the opening brace{
. -
Keep the comment but define the terms
value
andexp
. I think this approach is very interesting as I was personally impressed when I first read the source code to know howDecimal
was implemented.
Metadata
Metadata
Assignees
Labels
No labels