Float-point literals in Language Guide

I don't know where to report bug for the book "The Swift Programming Language (Swift 5.1)". May be here?

Language Guide

Floating-point literals can be decimal (with no prefix), or hexadecimal (with a 0x prefix). They must always have a number (or hexadecimal number) on both sides of the decimal point. Decimal floats can also have an optional exponent , indicated by an uppercase or lowercase e ; hexadecimal floats must have an exponent, indicated by an uppercase or lowercase p .

This is not true. For decimal must be fractional part or exponent. For hexadecimal must be exponent, but fractional part is optional. Will be better to copy/paste from the "Language Reference" (the same book):

Decimal floating-point literals consist of a sequence of decimal digits followed by either a decimal fraction, a decimal exponent, or both.

Hexadecimal floating-point literals consist of a 0x prefix, followed by an optional hexadecimal fraction, followed by a hexadecimal exponent.

Hi @Yahont – thanks for the report, can you file it at bugs.swift.org and we'll make sure it goes to the team that maintain the book.


Terms of Service

Privacy Policy

Cookie Policy