external real function S To R (string (255) Input)
  integer Sign = 0,
           Sym,
           Pos = 1
  long real Value,
              Exp

   routine Next
      Pos = Pos + 1
      if Pos > Length (Input) start
         Sym = 0
      else
         Sym = Char No (Input, Pos)
      finish
   end

   Sym = Char No (Input, Pos)
   if Sym = '-' start
      Sign = 1
      Next
   finish
   Value = 0
   if Sym # '.' start
      signal 6, 5, Pos unless '0' <= Sym <= '9'           {Char No out of range}
      cycle
         Value = Value*10.0 + (Sym - '0')
         Next
      repeat until not '0' <= Sym <= '9'
   finish
   if Sym = '.' start
      Exp = 10.0
      cycle
         Next
         exit unless '0' <= Sym <= '9'
         Value = Value + (Sym - '0')/Exp
         Exp = Exp * 10.0
      repeat
   finish
   if Sym = '@' start
      Sym = S To I (Sub String (Input, Pos + 1, Length (Input)))
      Value = Value * 10.0¬Sym
   finish
   Value = -Value if Sign # 0
   result = Value
end {S To R}

endoffile