number_codes/2
[ISO]number_codes(
+Number,
-Codes)
number_codes(
-Number,
+Codes)
Codes is the codes comprising the printed representation of Number.
Initially, either Number must be instantiated to a number, or Codes must be instantiated to a proper codes.
If Number is initially instantiated to a number, Codes will be unified with the codes that make up its printed representation.
If Number is uninstantiated, Codes should be instantiated to a codes that corresponds to the correct syntax of a number, and Number will be bound to that number.
instantiation_error
type_error
domain_error
representation_error
syntax_error
| ?- number_codes(foo, L). ! Type error in argument 1 of number_codes/2 ! expected a number, but found foo ! goal: number_codes(foo,_104)
| ?- number_codes(431, L). L = [52,51,49]
| ?- number_codes(X, [102,111,111]). ! Syntax error in number_codes/2 ! number syntax ! in line 0
| ?- number_codes(X, [52,51,49]). X = 431
| ?- number_codes(X, "15.0e+12"). X = 1.5E+13
number_chars/2
.