Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

(exp) uses unexpectedly megatons of gas #375

@CryptoPascal31

Description

@CryptoPascal31

Issue description

When used with an argument with many decimals, (exp) uses billions of gas

Steps to reproduce

pact> (env-gasmodel "table")
"Set gas model to table-based cost model"
pact> (env-gaslimit 1000000)
"Set gas limit to 1000000"
pact> (env-gas 0)
"Set gas to 0"
pact> (exp -0.00369328591312029)
(interactive):1:0: Gas limit "1000000"exceeded: 18446744073709552
 1 | (exp -0.00369328591312029)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Expected Behavior

I would expect something more reasonable.

Debug Information

This one is ok:

pact> (env-gasmodel "table")
"Set gas model to table-based cost model"
pact> (env-gaslimit 10)
"Set gas limit to 10"
pact> (env-gas 0)
"Set gas to 0"
pact> (^ (exp 1.0) -0.00369328591312029)
0.99631352587875243731474483865895308554172515869140625
pact> (env-gas)
3

Note: I have the same beahviour on-chain and in REPL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions