/usr/share/doc/r5rs-doc/r5rs/Numerical-input-and-output.html is in r5rs-doc 20010328-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | <html lang="en">
<head>
<title>Numerical input and output - Revised(5) Scheme</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Revised(5) Scheme">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Numbers.html#Numbers" title="Numbers">
<link rel="prev" href="Numerical-operations.html#Numerical-operations" title="Numerical operations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Numerical-input-and-output"></a>
<p>
Previous: <a rel="previous" accesskey="p" href="Numerical-operations.html#Numerical-operations">Numerical operations</a>,
Up: <a rel="up" accesskey="u" href="Numbers.html#Numbers">Numbers</a>
<hr>
</div>
<h4 class="subsection">6.2.6 Numerical input and output</h4>
<p><a name="index-g_t_0040w_007bnumerical-input-and-output_007d-291"></a>
<div class="defun">
— procedure: <b>number->string</b><var> z<a name="index-number_002d_003estring-292"></a></var><br>
— procedure: <b>number->string</b><var> z radix<a name="index-number_002d_003estring-293"></a></var><br>
<blockquote>
<p><var>Radix</var> must be an exact integer, either 2, 8, 10, or 16. If omitted,
<var>radix</var> defaults to 10.
The procedure ‘<samp><span class="samp">number->string</span></samp>’ takes a
number and a radix and returns as a string an external representation of
the given number in the given radix such that
<pre class="format"><tt>(let ((number </tt><var>number</var><tt>)
(radix </tt><var>radix</var><tt>))
(eqv? number
(string->number (number->string number
radix)
radix)))
</tt>
</pre>
<p>is true. It is an error if no possible result makes this expression true.
<p>If <var>z</var> is inexact, the radix is 10, and the above expression
can be satisfied by a result that contains a decimal point,
then the result contains a decimal point and is expressed using the
minimum number of digits (exclusive of exponent and trailing
zeroes) needed to make the above expression
true [howtoprint], [howtoread];
otherwise the format of the result is unspecified.
<p>The result returned by ‘<samp><span class="samp">number->string</span></samp>’
never contains an explicit radix prefix.
<blockquote>
<em>Note:</em>
The error case can occur only when <var>z</var> is not a complex number
or is a complex number with a non-rational real or imaginary part.
</blockquote>
<blockquote>
<em>Rationale:</em>
If <var>z</var> is an inexact number represented using flonums, and
the radix is 10, then the above expression is normally satisfied by
a result containing a decimal point. The unspecified case
allows for infinities, NaNs, and non-flonum representations.
</blockquote>
</blockquote></div>
<div class="defun">
— procedure: <b>string->number</b><var> string<a name="index-string_002d_003enumber-294"></a></var><br>
— procedure: <b>string->number</b><var> string radix<a name="index-string_002d_003enumber-295"></a></var><br>
<blockquote>
<!-- %R4%% I didn't include the (string->number string radix exactness) -->
<!-- case, since I haven't heard any resolution of the coding to be used -->
<!-- for the third argument. -->
<p>Returns a number of the maximally precise representation expressed by the
given <var>string</var>. <var>Radix</var> must be an exact integer, either 2, 8, 10,
or 16. If supplied, <var>radix</var> is a default radix that may be overridden
by an explicit radix prefix in <var>string</var> (e.g. <tt>"#o177"</tt>). If <var>radix</var>
is not supplied, then the default radix is 10. If <var>string</var> is not
a syntactically valid notation for a number, then ‘<samp><span class="samp">string->number</span></samp>’
returns <tt>#f</tt>.
<pre class="format"><tt>(string->number "100") ==> 100
(string->number "100" 16) ==> 256
(string->number "1e2") ==> 100.0
(string->number "15##") ==> 1500.0
</tt>
</pre>
<blockquote>
<em>Note:</em>
The domain of ‘<samp><span class="samp">string->number</span></samp>’ may be restricted by implementations
in the following ways. ‘<samp><span class="samp">String->number</span></samp>’ is permitted to return
<tt>#f</tt> whenever <var>string</var> contains an explicit radix prefix.
If all numbers supported by an implementation are real, then
‘<samp><span class="samp">string->number</span></samp>’ is permitted to return <tt>#f</tt> whenever
<var>string</var> uses the polar or rectangular notations for complex
numbers. If all numbers are integers, then
‘<samp><span class="samp">string->number</span></samp>’ may return <tt>#f</tt> whenever
the fractional notation is used. If all numbers are exact, then
‘<samp><span class="samp">string->number</span></samp>’ may return <tt>#f</tt> whenever
an exponent marker or explicit exactness prefix is used, or if
a <tt>#</tt> appears in place of a digit. If all inexact
numbers are integers, then
‘<samp><span class="samp">string->number</span></samp>’ may return <tt>#f</tt> whenever
a decimal point is used.
</blockquote>
</blockquote></div>
</body></html>
|