The Rational Type
Amit Yaron <[email protected]> Wed, 1 Jan 2020 20:45:32 +0200
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-charset-is-forced="true">
Hi,<br>
<br>
I've found that Scheme48 prints the results of dividing one integer
by another in a fraction notation. So, I tried the function
'rational?', which returns true when the operand is a number, even
if it is a known irrational one.<br>
Following are some results:<br>
<blockquote type="cite">(rational? (sqrt 2))<br>
</blockquote>
#t<br>
<blockquote type="cite">(rational? (exp 1))<br>
</blockquote>
#t<br>
6> (define pi (* 2 (asin 1)))<br>
; no values returned<br>
6> pi<br>
3.141592653589793<br>
6> (rational? pi)<br>
#t<br>
<br>
Is it supposed to work this way?<br>
<br>
</body>
</html>