Skip to content
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

SQL Decimal Cookbook erroneously refers to "adjusted exponent" #109

Open
popematt opened this issue Mar 3, 2023 · 0 comments
Open

SQL Decimal Cookbook erroneously refers to "adjusted exponent" #109

popematt opened this issue Mar 3, 2023 · 0 comments
Labels
doc Documentation

Comments

@popematt
Copy link
Contributor

popematt commented Mar 3, 2023

SQL Decimal Cookbook

Because an Ion decimal can have more than one encoding, the value of the exponent property is actually the adjusted exponent as defined in the IBM Hursley Lab General Decimal Arithmetic Specification:

The adjusted exponent is the value of the exponent of a number when that number is expressed as though in scientific notation with one digit (non-zero unless the coefficient is 0) before any decimal point. This is given by the value of the exponent+(clength–1), where clength is the length of the coefficient in decimal digits.

For example, the adjusted exponent of the values 0.00123d2 and 0.123d0 is the exponent of the adjusted form, 1.23d-1.

All of the modeling guidance that the cookbook provides is correct, but the Ion data model doesn't actually use the adjusted exponent. It just uses the regular exponent as defined in the Decimal data model. See also exponent in the ISL 2.0 spec.

@popematt popematt changed the title SQL Decimal Cookbook erroneously refers to _adjusted exponent_ SQL Decimal Cookbook erroneously refers to "adjusted exponent" Mar 3, 2023
@popematt popematt added the doc Documentation label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation
Projects
None yet
Development

No branches or pull requests

1 participant