LPReal.st
author Claus Gittinger <cg@exept.de>
Tue, 07 Jan 1997 12:02:05 +0100
changeset 2072 e84dbf5e5424
parent 1893 c66af5c46272
child 2141 bba0027204fd
permissions -rw-r--r--
removed package-change info message
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     1
"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
     3
	      All Rights Reserved
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     4
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    11
"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    12
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    13
Number subclass:#LimitedPrecisionReal
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    14
	instanceVariableNames:''
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    15
	classVariableNames:''
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    16
	poolDictionaries:''
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    17
	category:'Magnitude-Numbers'
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    18
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    19
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    20
!LimitedPrecisionReal class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    21
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    24
 COPYRIGHT (c) 1994 by Claus Gittinger
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
    25
	      All Rights Reserved
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    26
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
!
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    35
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
documentation
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
    Abstract superclass for single and double (and maybe more) 
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
    precision real numbers (i.e. Float and Double).
92
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
    40
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
    41
    Due to historic reasons, ST/X's Floats are what Doubles are in ST-80.
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
    42
    This may change soon (implementing LPReal is a first step towards this).
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    43
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    44
    [author:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1201
diff changeset
    45
        Claus Gittinger
1893
c66af5c46272 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
    46
c66af5c46272 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
    47
    [see also:]
c66af5c46272 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
    48
        Fraction FixedPoint
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    49
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    50
! !
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    51
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    52
!LimitedPrecisionReal class methodsFor:'instance creation'!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    53
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    54
new:aNumber
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    55
    "catch this message - not allowed for floats/doubles"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    56
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    57
    self error:'Floats/Doubles cannot be created with new:'
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    58
! !
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    59
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    60
!LimitedPrecisionReal methodsFor:'accessing'!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    61
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    62
at:index
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    63
    "redefined to prevent access to individual bytes in a real."
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    64
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    65
    self error:'not allowed for floats/doubles'
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    66
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    67
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    68
at:index put:aValue
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    69
    "redefined to prevent access to individual bytes in a real"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    70
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    71
    self error:'not allowed for floats/doubles'
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    72
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    73
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    74
size
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    75
   "redefined since reals are kludgy (ByteArry)"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    76
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    77
   ^ 0
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    78
! !
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    79
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    80
!LimitedPrecisionReal methodsFor:'arithmetic'!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    81
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    82
* aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    83
    "return the product of the receiver and the argument, aNumber"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    84
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    85
"/ as soon as Float are float & Double are doubles,
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    86
"/ use:
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    87
"/    ^ aNumber productFromDouble:self asDouble
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    88
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    89
    ^ aNumber productFromFloat:self asFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    90
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    91
    "Modified: 17.4.1996 / 12:35:36 / cg"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    92
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    93
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    94
+ aNumber
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    95
    "return the sum of the receiver and the argument, aNumber"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
    96
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    97
"/ as soon as Float are float & Double are doubles,
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    98
"/ use:
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    99
"/    ^ aNumber sumFromDouble:self asDouble
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   100
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   101
    ^ aNumber sumFromFloat:self asFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   102
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   103
    "Modified: 17.4.1996 / 12:35:55 / cg"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   104
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   105
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   106
- aNumber
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   107
    "return the difference of the receiver and the argument, aNumber"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   108
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   109
"/ as soon as Float are float & Double are doubles,
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   110
"/ use:
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   111
"/    ^ aNumber differenceFromDouble:self asDouble
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   112
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   113
    ^ aNumber differenceFromFloat:self asFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   114
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   115
    "Modified: 17.4.1996 / 12:36:07 / cg"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   116
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   117
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   118
/ aNumber
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   119
    "return the quotient of the receiver and the argument, aNumber"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   120
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   121
    ((aNumber == 0) or:[aNumber = 0.0]) ifTrue:[
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   122
        ^ DivisionByZeroSignal raise.
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   123
    ].
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   124
"/ as soon as Float are float & Double are doubles,
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   125
"/ use:
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   126
"/    ^ aNumber quotientFromDouble:self asDouble
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   127
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   128
    ^ aNumber quotientFromFloat:self asFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   129
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   130
    "Modified: 17.4.1996 / 12:36:21 / cg"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   131
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   132
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   133
// aNumber
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   134
    "return the integer quotient of dividing the receiver by aNumber with
1882
f5f8a2f201e5 fixed #//
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   135
     truncation towards negative infinity."
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   136
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   137
    ^ (self / aNumber) floor asInteger
1882
f5f8a2f201e5 fixed #//
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   138
f5f8a2f201e5 fixed #//
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   139
    "Modified: 5.11.1996 / 11:45:37 / cg"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   140
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   141
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   142
\\ aNumber
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   143
    "return the integer remainder of dividing the receiver by aNumber with
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   144
    truncation towards negative infinity."
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   145
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   146
    ^ (self - ((self / aNumber) floor * aNumber)) floor asInteger
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   147
! !
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   148
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   149
!LimitedPrecisionReal methodsFor:'coercion and converting'!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   150
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   151
asFraction
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   152
    "return a corresponding fraction
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   153
     - notice, that 'aFract asFloat asFraction' does not always return
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   154
     a good fraction ... due to rounding errors when converting to float"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   155
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   156
    |fract digits power num denom|
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   157
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   158
    "we (indirectly) use printf which knows the precision of floats"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   159
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   160
    fract := self fractionPart.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   161
    digits := fract printString copyFrom:3.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   162
    power := digits size.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   163
    num := (self - fract) asInteger.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   164
    denom := (10 raisedToInteger:power).
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   165
    num := num * denom.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   166
    num := num + (Integer readFromString:digits).
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   167
    ^ (Fraction numerator:num denominator:denom) reduced
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   168
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   169
    "0.3 asFraction"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   170
    "0.5 asFraction"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   171
    "(1/5) asFloat asFraction"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   172
    "(1/8) asFloat asFraction"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   173
    "(1/13) asFloat asFraction -> inexact result due to rounding errors"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   174
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   175
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   176
asInteger
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   177
    "return an integer with same value - might truncate"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   178
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   179
    |l v sign|
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   180
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   181
    "this is stupid code - rounding errors accumulate; fix later"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   182
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   183
    sign := self sign.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   184
    v := self abs.
85
claus
parents: 55
diff changeset
   185
    (v >= 10.0) ifTrue:[
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
   186
	l := (v / 10.0) asInteger * 10
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   187
    ] ifFalse:[
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
   188
	l := 0
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   189
    ].
85
claus
parents: 55
diff changeset
   190
    v := v - ((v / 10.0) floor * 10) floor.
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   191
    l := l + v truncated.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   192
    ^ l * sign
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   193
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   194
    "12345.0 asInteger"
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   195
    "1e15 asInteger"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   196
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   197
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   198
coerce:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   199
    "return aNumber converted into receivers type"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   200
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   201
"/ as soon as Float are float & Double are doubles,
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   202
"/ use:
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   203
"/    ^ aNumber asDouble
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   204
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   205
    ^ aNumber asFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   206
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   207
    "Modified: 17.4.1996 / 12:36:46 / cg"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   208
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   209
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   210
generality
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   211
    "return the generality value - see ArithmeticValue>>retry:coercing:"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   212
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   213
    ^ 80
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   214
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   215
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   216
!LimitedPrecisionReal methodsFor:'comparing'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   217
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   218
< aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   219
    "return true, if the argument is greater"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   220
1201
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   221
"/ as soon as Float are float & Double are doubles,
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   222
"/ use:
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   223
"/    ^ aNumber lessFromDouble:self asDouble
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   224
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   225
    ^ aNumber lessFromFloat:self asFloat
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   226
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   227
    "Modified: 17.4.1996 / 13:34:50 / cg"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   228
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   229
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   230
<= aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   231
    "return true, if the argument is greater or equal"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   232
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   233
    ^ self retry:#<= coercing:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   234
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   235
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   236
= aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   237
    "return true, if the arguments value are equal"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   238
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   239
    ^ self retry:#= coercing:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   240
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   241
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   242
> aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   243
    "return true, if the argument is less"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   244
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   245
    ^ self retry:#> coercing:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   246
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   247
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   248
>= aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   249
    "return true, if the argument is less or equal"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   250
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   251
    ^ self retry:#>= coercing:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   252
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   253
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   254
~= aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   255
    "return true, if the arguments value are not equal"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   256
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   257
    ^ self retry:#~= coercing:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   258
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   259
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   260
!LimitedPrecisionReal methodsFor:'copying'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   261
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   262
deepCopy
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   263
    "return a deep copy of myself
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   264
     - because storing into floats is not recommended/allowed, its ok to return the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   265
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   266
    ^ self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   267
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   268
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   269
deepCopyUsing:aDictionary
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   270
    "return a deep copy of myself
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   271
     - because storing into floats is not recommended/allowed, its ok to return the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   272
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   273
    ^ self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   274
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   275
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   276
shallowCopy
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   277
    "return a shallow copy of the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   278
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   279
    ^ self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   280
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   281
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   282
simpleDeepCopy
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   283
    "return a deep copy of the receiver
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   284
     - because storing into floats is not recommended/allowed, its ok to return the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   285
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   286
    ^ self
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   287
! !
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   288
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   289
!LimitedPrecisionReal methodsFor:'double dispatching'!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   290
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   291
differenceFromFraction:aFraction
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
   292
    "sent when a fraction does not know how to subtract the receiver, a float"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   293
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   294
    |d|
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   295
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   296
    d := aFraction denominator.
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   297
    ^ (aFraction numerator - (self * d)) / d
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   298
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   299
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   300
productFromFraction:aFraction
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
   301
    "sent when a fraction does not know how to multiply the receiver, a float"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   302
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   303
    ^ self * aFraction numerator / aFraction denominator
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   304
!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   305
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   306
quotientFromFraction:aFraction
213
3b56a17534fd *** empty log message ***
claus
parents: 112
diff changeset
   307
    "sent when a fraction does not know how to divide by the receiver, a float"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   308
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   309
    ^ aFraction numerator / (self * aFraction denominator)
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   310
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   311
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   312
sumFromFraction:aFraction
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   313
    "sent when a fraction does not know how to add the receiver, a float"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   314
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   315
    |d|
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   316
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   317
    d := aFraction denominator.
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   318
    ^ (self * d + aFraction numerator) / d
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   319
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   320
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   321
!LimitedPrecisionReal methodsFor:'printing & storing'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   322
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   323
printOn:aStream
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   324
    "append a printed representation of the receiver to
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   325
     the argument, aStream"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   326
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   327
    aStream nextPutAll:self printString
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   328
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   329
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   330
printString
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   331
    "return a printed representation of the receiver"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   332
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   333
    ^ self subclassResponsibility
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   334
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   335
    "Created: 17.4.1996 / 12:12:20 / cg"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   336
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   337
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   338
!LimitedPrecisionReal methodsFor:'testing'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   339
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   340
isReal
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   341
    "return true, if the receiver is some kind of real number;
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   342
     false is returned here - the method is redefined from Object."
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   343
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   344
    ^ true
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   345
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   346
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   347
negative
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   348
    "return true if the receiver is less than zero"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   349
1201
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   350
"/ as soon as Float are float & Double are doubles,
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   351
"/ use:
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   352
"/    ^ self asDouble negative
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   353
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   354
    ^ self asFloat negative
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   355
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   356
    "Modified: 17.4.1996 / 13:35:00 / cg"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   357
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   358
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   359
positive
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   360
    "return true if the receiver is greater or equal to zero"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   361
1201
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   362
"/ as soon as Float are float & Double are doubles,
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   363
"/ use:
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   364
"/    ^ self asDouble positive
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   365
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   366
    ^ self asFloat positive
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   367
24a5faa7e305 oops - asDouble is not yet there
Claus Gittinger <cg@exept.de>
parents: 1200
diff changeset
   368
    "Modified: 17.4.1996 / 13:35:10 / cg"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   369
! !
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   370
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   371
!LimitedPrecisionReal methodsFor:'truncation and rounding'!
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   372
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   373
fractionPart
1865
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   374
    "return a float with value from digits after the decimal point.
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   375
     (i.e. the receiver minus its truncated value)"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   376
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   377
    ^ self - self truncated asFloat
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   378
1865
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   379
    "
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   380
     1234.56789 fractionPart
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   381
     1.2345e6 fractionPart  
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   382
    "
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   383
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   384
    "Modified: 4.11.1996 / 20:26:54 / cg"
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   385
!
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   386
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   387
integerPart
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   388
    "return a float with value from digits before the decimal point
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   389
     (i.e. the truncated value)"
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   390
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   391
    ^ self truncated asFloat
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   392
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   393
    "
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   394
     1234.56789 integerPart 
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   395
     1.2345e6 integerPart   
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   396
    "
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   397
5168897c326f added integerPart for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   398
    "Modified: 4.11.1996 / 20:26:21 / cg"
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   399
! !
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   400
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   401
!LimitedPrecisionReal class methodsFor:'documentation'!
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   402
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   403
version
1893
c66af5c46272 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
   404
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/LPReal.st,v 1.17 1996-11-05 18:38:50 cg Exp $'
55
4a82f332c3f8 Initial revision
claus
parents:
diff changeset
   405
! !