Parses a float from a string and returns it as float.
hcl
parse-float string &key start end default-format => float
string⇩ |
A string. |
Bounding index designators for string. | |
default-format⇩ |
float⇩ |
A float. |
The function parse-float
parses a float from the substring of string delimited by start and end and returns it as float.
If the substring represents an integer or the exponent marker is E or is omitted, then float will be of type default-format, which defaults to the value of *read-default-float-format*. Otherwise, its type will match the exponent marker as specified by 2.3.2.2 "Syntax of a Float" in the Common Lisp standard.
If the substring does not represent an integer or a float, then an error of type parse-error is signaled.
(parse-float "10") => 10.0f0
(parse-float "10" :default-format 'double-float) => 10.0d0
(parse-float "10d0") => 10.0d0
(parse-float "10.5") => 10.5f0
(parse-float "10.5d0") => 10.5d0
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:35