Browse Source

update docs about number modes

master
adam j hartz 7 months ago
parent
commit
2d1b57f019
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      source/documentation.html

+ 4
- 4
source/documentation.html View File

@@ -19,18 +19,18 @@ The <tt>tako</tt> language is based on Python, and the <tt>tako</tt> shell uses
19 19
 2
20 20
 </pre>
21 21
 
22
-One place where <tt>tako</tt> differs from Python is in its handling of numbers.  Where possible, <tt>tako</tt> tries to keep an exact representation of a number rather than converting to a <tt>float</tt> (which it will do only if necessary).  For example:
22
+One place where <tt>tako</tt> differs from Python is in its handling of numbers.  When dividing integers, <tt>tako</tt> keeps an exact representation of a number rather than converting to a <tt>float</tt> (it will only convert to a float if necessary).  For example:
23 23
 
24 24
 <pre>
25 25
 ~ $ 3.1
26
-31/10
26
+3.1
27 27
 ~ $ 2 / 3
28 28
 2/3
29
-~ $ float(2)/3
29
+~ $ 2.0/3
30 30
 0.6666666666666666
31 31
 </pre>
32 32
 
33
-(You can turn this behavior off and revert to Python's regular handling of numbers by setting <tt>$TAKO_SETTINGS.number_mode = 'python'</tt>)
33
+(You can turn this behavior off and revert to Python's regular handling of numbers by setting <tt>$TAKO_SETTINGS.number_mode = 'python'</tt>.  You can cause <tt>tako</tt> to convert decimals to rationals as well by setting <tt>$TAKO_SETTINGS.number_mode = 'exact'</tt>).
34 34
 
35 35
 <p>
36 36
 Since <tt>tako</tt> is a superset of Python, you are able import modules, print values, and use other built-in Python functionality directly from the command prompt:

Loading…
Cancel
Save