Float

Double-precision floating-point scalar type

Audience: Programmer

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Format

  • 64-bit IEEE 754 floating-point

  • Approximately 15-17 decimal digits of precision

  • Range: ±1.7976931348623157E+308

  • Supports scientific notation

Usage

type ItemMovement {
  quantity: Float!
  unitPrice: Float
  totalValue: Float
}

mutation {
  createItemMovement(input: {
    quantity: 10.5
    unitPrice: 29.99
  }) {
    itemMovement {
      totalValue  # Returns Float
    }
  }
}

Common Float Fields

  • Quantities with decimals

  • Prices and monetary values

  • Percentages and ratios

  • Coordinates (latitude/longitude)

  • Measurements and dimensions

Precision Considerations

Best Practices

  1. Use for scientific calculations

  2. Consider fixed-point for money (or use Int for cents)

  3. Be aware of precision limitations

  4. Use rounding when displaying to users

See Also

  • Int - Whole number values

  • String - For arbitrary precision decimals

Last updated

Was this helpful?