!Original grotty faulty version
!%systemrealfn stor(%string(255)input)
!  !reads a real from the string, assuming string starts with the real
!  !(or blank spaces followed by a real)
!  %integer sign=0,sym,pos=0
!  %real value,exp
!  !
!  input=input."!";         !check that there is a finish character
!  %cycle
!    sym = charno(input,pos+1)
!    %exit %if sym > ' '
!    pos=pos+1
!  %repeat
!  %if sym = '-' %start
!    sign = 1
!    pos=pos+1;  sym = charno(input,pos+1)
!  %finish
!  value = 0
!  %if sym # '.' %start
!    %signal 6,5,pos %unless '0' <= sym <= '9';  !charno out of range
!    %cycle
!      value = value*10.0+(sym-'0')
!      pos=pos+1;  sym = charno(input,pos+1)
!    %repeat %until %not '0' <= sym <= '9'
!  %finish
!  %if sym = '.' %start
!    exp = 10.0
!    %cycle
!      pos=pos+1;  sym = charno(input,pos+1)
!      %exit %unless '0' <= sym <= '9'
!      value = value+(sym-'0')/exp
!      exp = exp*10.0
!    %repeat
!  %finish
!  %if sym = '@' %start
!    pos = pos+1
!    sym = charno(input,pos+1); pos = pos+1
!    value = value*10.0¬(sym-'0')
!  %finish
!  value = -value %if sign # 0
!  %result = value
!%end;  !stor

!Working version, courtesy of RMM (as if it wasn't obvious
!from the grotesque 'aesthetic' source layout)

system 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}

systemrealfn ftor(string(255)s)
  result = stor(s)
end

endoffile