def parse_float()

in src/envs/ode.py [0:0]


    def parse_float(self, lst):
        """
        Parse a list that starts with a float.
        Return the float value, and the position it ends in the list.
        """
        if len(lst) < 2 or lst[0] not in ["FLOAT+", "FLOAT-"]:
            return np.nan, 0
        sign = -1 if lst[0] == "FLOAT-" else 1
        if not lst[1].isdigit():
            return np.nan, 1
        mant = 0.0
        i = 1
        for x in lst[1:]:
            if not (x.isdigit()):
                break
            mant = mant * 10.0 + int(x)
            i += 1
        if len(lst) > i and lst[i] == ".":
            i += 1
            mul = 0.1
            for x in lst[i:]:
                if not (x.isdigit()):
                    break
                mant += mul * int(x)
                mul *= 0.1
                i += 1
        mant *= sign
        if len(lst) > i and lst[i] == "10^":
            i += 1
            try:
                exp, offset = self.parse_int(lst[i:])
            except InvalidPrefixExpression:
                return np.nan, i
            i += offset
        else:
            exp = 0
        return mant * (10.0 ** exp), i