There is a partial answer on Stack Overflow, but I'm asking something a teeny bit more specific than the answers there.

So... Does the formal semantics (Section 7.2) specify the meaning of such a numeric literal? Does it specify the meaning of numeric operations on the value resulting from interpreting the literal?

If yes, what are the meanings (in English -- denotational semantics is all greek characters to me :))?

1 Answer 1


Reading from the standard:

If the written representation of a number has no exactness prefix, the constant may be either inexact or exact. It is inexact if it contains a decimal point, an exponent, or a ``#'' character in the place of a digit, otherwise it is exact.

Basically remember they amount to insignificant figures. The compiler isn't required to have any specific value for them there but it must put something. (most use zero). It's a way of making a number imprecise.

  • Yes, that is what the standard says, which I noted indirectly in my question. It does not, however, define the meaning of 123#4. I was wondering if there was a specification of the meaning of # in place of a digit in the formal semantics. My assumption is that it was probably intended for symbolic manipulation of numbers (ie sig-figs and how they propagate) but it's not specified in the standard's English text.
    – ikmac
    Dec 10, 2012 at 0:12
  • It's illegal to randomly substitute in # for digits, they have to group together at the end of the number. It is similar to writing 1.23 * 10^4 or 123# except a # isn't guaranteed to be 0. Dec 10, 2012 at 0:17
  • thanks for pointing that out -- I see it now in the grammar. Ok, so it seems to have been originally intended to represent lack of precision (ie a measurement with N significant figures), although implementations appear to simply replace #'s with 0's and mark the number inexact, then forget about the #'s, which seems to defeat the purpose. Also, I've just looked at R6RS, which has dropped this.
    – ikmac
    Dec 10, 2012 at 19:12
  • yeah it's kinda silly in my experience. generally explicit 0's are better for representing insignificant digits, especially since they work correctly in math stuff Dec 10, 2012 at 19:14
  • Agreed. 0's work fine when using straight numbers etc. The #'s would require numbers be handled symbolically (treating each run of #'s as both 0's and 9's to determine how many digits in the result of an operation are indeterminate and should be replaced with #'s) -- so that's probably why the meaning wasn't specified, only the effect of making a number inexact.
    – ikmac
    Dec 10, 2012 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.