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

Analysis of formatting decimals #452

Open
joelburget opened this issue Apr 2, 2019 · 0 comments
Open

Analysis of formatting decimals #452

joelburget opened this issue Apr 2, 2019 · 0 comments
Labels
FV Formal verification

Comments

@joelburget
Copy link
Contributor

We can't currently analyze formatting decimals due to the representation we use:

-- We model decimals as integers. The value of a decimal is the value of the
-- integer, shifted right 255 decimal places.
newtype Decimal = Decimal { unDecimal :: Integer }

Compare with these formatting examples:

pact> (format "{}" [1.5])
"1.5"
pact> (format "{}" [1.50])
"1.50"

It would be impossible to get these two different answers without explicitly tracking the decimal places a la Data.Decimal:

data DecimalRaw i = Decimal {
      decimalPlaces :: ! Word8,
      decimalMantissa :: ! i}

So, for this analysis we'll have to add a decimalPlaces field to our Decimal.

@joelburget joelburget added the FV Formal verification label Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FV Formal verification
Projects
None yet
Development

No branches or pull requests

1 participant