| 936 | } |
| 937 | |
| 938 | function bigfloat_to_string(a, radix) { |
| 939 | var s; |
| 940 | if (!BigFloat.isFinite(a)) { |
| 941 | /* NaN, Infinite */ |
| 942 | if (eval_mode !== "math") { |
| 943 | return "BigFloat(" + a.toString() + ")"; |
| 944 | } else { |
| 945 | return a.toString(); |
| 946 | } |
| 947 | } else { |
| 948 | if (a == 0) { |
| 949 | if (1 / a < 0) |
| 950 | s = "-0"; |
| 951 | else |
| 952 | s = "0"; |
| 953 | } else { |
| 954 | if (radix == 16) { |
| 955 | var s; |
| 956 | if (a < 0) { |
| 957 | a = -a; |
| 958 | s = "-"; |
| 959 | } else { |
| 960 | s = ""; |
| 961 | } |
| 962 | s += "0x" + a.toString(16); |
| 963 | } else { |
| 964 | s = a.toString(); |
| 965 | } |
| 966 | } |
| 967 | if (typeof a === "bigfloat" && eval_mode !== "math") { |
| 968 | s += "l"; |
| 969 | } else if (eval_mode !== "std" && s.indexOf(".") < 0 && |
| 970 | ((radix == 16 && s.indexOf("p") < 0) || |
| 971 | (radix == 10 && s.indexOf("e") < 0))) { |
| 972 | /* add a decimal point so that the floating point type |
| 973 | is visible */ |
| 974 | s += ".0"; |
| 975 | } |
| 976 | return s; |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | function bigint_to_string(a, radix) { |
| 981 | var s; |