OTWO-1213 Works around lost encoding in Ruby/C binding layer
[ohcount] / test / detect_files / example.st
1 "======================================================================
2 |
3 |   Benchmark for floats
4 |
5 |
6  ======================================================================"
7
8
9 "======================================================================
10 |
11 | Copyright (C) 2003  Free Software Foundation.
12 | Written by Paolo Bonzini
13 |
14 | This file is part of GNU Smalltalk.
15 |
16 | GNU Smalltalk is free software; you can redistribute it and/or modify it
17 | under the terms of the GNU General Public License as published by the Free
18 | Software Foundation; either version 2, or (at your option) any later version.
19 |
20 | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
21 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22 | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
23 | details.
24 |
25 | You should have received a copy of the GNU General Public License along with
26 | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
27 | Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 |
29  ======================================================================"
30
31 Smalltalk at: #Last put: 42!
32
33 !Number methodsFor: 'testing'!
34
35 nextRandom
36         Last := Last * 3877 + 29573 rem: 139968.
37         ^self * Last asFloatD / 139968d! !
38
39 | n |
40 n := Smalltalk arguments isEmpty
41         ifTrue: [ 1000 ]
42         ifFalse: [ 1 max: Smalltalk arguments first asInteger ].
43
44 n timesRepeat: [ 100d nextRandom ].
45 ((100d nextRandom + 0.5d-9) printString copyFrom: 1 to: 11) displayNl!