-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: fix markdown for the decimal package #202
Conversation
decimal/decimal.go
Outdated
// The package implements methods to encode and decode BCD. | ||
// | ||
// BCD (Binary-Coded Decimal) is a sequence of bytes representing decimal | ||
// digits of the encoded number (each byte has two decimal digits each encoded | ||
// using 4-bit nibbles), so byte >> 4 is the first digit and byte & 0x0f is the | ||
// second digit. The leftmost digit in the array is the most significant. The | ||
// rightmost digit in the array is the least significant. | ||
// | ||
// The first byte of the BCD array contains the first digit of the number, | ||
// represented as follows: | ||
// | ||
// | 4 bits | 4 bits | | ||
// = 0x = the 1st digit | ||
// | ||
// (The first nibble contains 0 if the decimal number has an even number of | ||
// digits). The last byte of the BCD array contains the last digit of the | ||
// number and the final nibble, represented as follows: | ||
// | ||
// | 4 bits | 4 bits | | ||
// = the last digit = nibble | ||
// | ||
// The final nibble represents the number's sign: 0x0a, 0x0c, 0x0e, 0x0f stand | ||
// for plus, 0x0b and 0x0d stand for minus. | ||
// | ||
// Examples: | ||
// | ||
// The decimal -12.34 will be encoded as 0xd6, 0x01, 0x02, 0x01, 0x23, 0x4d: | ||
// | ||
// | MP_EXT (fixext 4) | MP_DECIMAL | scale | 1 | 2,3 | 4 (minus) | | ||
// | 0xd6 | 0x01 | 0x02 | 0x01 | 0x23 | 0x4d | | ||
// | ||
// The decimal 0.000000000000000000000000000000000010 will be encoded as | ||
// 0xc7, 0x03, 0x01, 0x24, 0x01, 0x0c: | ||
// | ||
// | MP_EXT (ext 8) | length | MP_DECIMAL | scale | 1 | 0 (plus) | | ||
// | 0xc7 | 0x03 | 0x01 | 0x24 | 0x01 | 0x0c | | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment about BCD encoding/decoding was placed to a file bcd.go
intentionally.
Sure, you can move it to another place, although I don't get your motivation.
Additionally, this change is not related to the fixed ticket, why it was added to commit with fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the description of the internal implementation is redundant in the description of the package. I'm hesitant to turn it into a code comment.
520bb71
to
e9f45ab
Compare
I've moved the implementation details from GoDoc comments to the code comments. |
ff497a2
to
ba1aa4b
Compare
1283d64
to
a820c8d
Compare
a820c8d
to
89896c3
Compare
89896c3
to
9ee249f
Compare
The patch hides the implementation details of the Decimal type from documentation. It provides comments for Decimal.MarshalMsgpack and Decimal.UnmarshalMsgpack. Closes #201
9ee249f
to
b9ddb95
Compare
The patch hides the implementation details of the Decimal type from
documentation. It provides comments for Decimal.MarshalMsgpack and
Decimal.UnmarshalMsgpack.
How-to test:
$ godoc -http=:8080
in the go-tarantool folder.I didn't forget about (remove if it is not applicable):
Related issues:
Closes #201