Skip to content

Parser: implement float and double types with endian variants #40

@unclesp1d3r

Description

@unclesp1d3r

Summary

Implement floating-point type specifiers: float, double, befloat, bedouble, lefloat, ledouble.

Context

Some binary formats store floating-point values (scientific data, image metadata, audio parameters). While less common than integer types, float/double support is needed for full magic file compatibility.

Current state: No floating-point types exist in TypeKind or the parser.

Acceptance Criteria

  • TypeKind extended with Float and Double variants
  • Parser recognizes float, double, befloat, bedouble, lefloat, ledouble
  • Evaluator reads 4/8 bytes and interprets as IEEE 754 float/double
  • Endianness handling for all variants
  • Comparison operators work with floating-point values (with appropriate epsilon for equality)
  • Unit tests for each type and endian variant

Impact

MEDIUM - Less commonly used than integer types but needed for full compatibility.

Files to Modify

  • src/parser/ast.rs - Extend TypeKind enum
  • src/parser/grammar.rs - Parse float/double specifiers
  • src/evaluator/types.rs - Implement read_float() and read_double()

References

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestevaluatorRule evaluation engine and logicparserMagic file parsing components and grammarpriority:normalStandard work item
No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions