Skip to main content

generate_points

Function generate_points 

Source
pub fn generate_points(
    source: &str,
    file: &str,
    regenerate: &str,
) -> Result<Option<Generated>, Error>
Expand description

Generates the module of the point types declared in source, or None if it declares none. file and regenerate are as for generate.

The module, named points, holds PointError, the error of the constructors; for each declared type, a struct with new, which rejects inputs that are not finite and parameters outside the where clause, new_unchecked, which accepts anything, one accessor per parameter of an implicit type, and an implementation of Point; and AnyPoint, an enum with one variant per type, which implements Point too and converts from each type with From. Its checks module holds, for each type that is not explicit, exact_<name>, its exact coordinates evaluated with the exact numbers of implicit-predicates-oracle.

The constructor of a type that is not explicit evaluates its coordinates in f64 with an error bound for each, by the rule of crate::error_bound; Point::exact writes them as expansions, and fails with ExactError::OutOfRange when an input is not finite, an operand of a sum of expansions reaches 2^1020, or an operand of an exact product leaves the product domain of the core.

ยงErrors

A syntax error in a declaration; a point type whose name does not start with an uppercase letter; a parameter whose name does not start with a lowercase letter; a parameter or type with a name that the generated code uses; an integer that is not exactly an f64; an error bound with more roundings than crate::MAX_ROUNDS; exact coordinates whose temporaries take more than 4,096 f64; coordinates of more than crate::MAX_POINT_NODES distinct operations and inputs; or a where comparison that, after cancelling the parameters on both sides, is not one parameter against an integer of magnitude at most 2^53, the only form emitted for now.