Skip to content

Simplify spec by adding safe math functions #2086

@vbuterin

Description

@vbuterin

The two that immediately come to mind, with multiple use cases already in the spec, are:

def safe_modulo_subtract(a, b, modulus):
    return (a + modulus - b) % modulus

def safe_a_mul_b_div_c(a, b, c, increment):
    return (a // increment) * b // (c // increment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions