ArithmeticValue.st
author Claus Gittinger <cg@exept.de>
Mon, 27 May 2013 10:14:43 +0200
changeset 15279 7dd8da92779e
parent 14747 18be9a3c2324
child 16121 7b441c381015
child 18062 014678b4657a
permissions -rw-r--r--
class: ArithmeticValue comment/format in: #mul2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
213
3b56a17534fd *** empty log message ***
claus
parents: 155
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
5948
1fc30f692713 new class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5238
diff changeset
    12
"{ Package: 'stx:libbasic' }"
1fc30f692713 new class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5238
diff changeset
    13
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    14
Magnitude subclass:#ArithmeticValue
1172
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    15
	instanceVariableNames:''
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    16
	classVariableNames:'DivisionByZeroSignal DomainErrorSignal OverflowSignal
6342
fbbe62d5b17c Remove obsolete (since years) AnyArithmeticSignal definitions.
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
    17
		UnderflowSignal ArithmeticSignal UnorderedSignal
fbbe62d5b17c Remove obsolete (since years) AnyArithmeticSignal definitions.
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
    18
		ConversionErrorSignal'
1172
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    19
	poolDictionaries:''
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
    20
	category:'Magnitude-Numbers'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    22
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    23
!ArithmeticValue class methodsFor:'documentation'!
82
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    24
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    25
copyright
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    26
"
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    27
 COPYRIGHT (c) 1993 by Claus Gittinger
213
3b56a17534fd *** empty log message ***
claus
parents: 155
diff changeset
    28
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    29
82
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    30
 This software is furnished under a license and may be used
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    31
 only in accordance with the terms of that license and with the
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    33
 be provided or otherwise made available to, or used by, any
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    34
 other person.  No title to or ownership of the software is
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    35
 hereby transferred.
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    36
"
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    37
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    38
82
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    39
documentation
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    40
"
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    41
    ArithmeticValue is an abstract superclass for all things responding to
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
    42
    arithmetic messages. It was inserted into the hierarchy, to allow objects
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
    43
    like matrices, functions etc. to share the arithmetic methods defined here.
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
    44
5955
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
    45
    Notice, that what used to be signals are now exception classes - the class
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
    46
    variables and signal accessors remain here for backward compatibility.
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
    47
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
    48
    [class variables:]
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    49
	ArithmeticSignal        <Error>         parent of all arithmetic signals
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    50
						(never raised itself)
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    51
						New: now a reference to ArithmeticError
82
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    52
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    53
	DomainErrorSignal       <Error>         raised upon float errors
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    54
						(for example range in trigonometric)
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    55
						New: now a reference to DomainError
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
    56
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    57
	DivisionByZeroSignal    <Error>         raised when division by 0 is attempted
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    58
						New: now a reference to ZeroDivide
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
    59
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    60
	OverflowSignal          <Error>         raised on overflow/underflow conditions
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    61
	UnderflowSignal                         in float arithmetic.
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    62
						Notice: some OperatingSystems do not
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    63
						provide enough information for ST/X to
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    64
						extract the real reason for the floatException
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    65
						thus raising DomainErrorSignal in these cases.
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
    66
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    67
    [author:]
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    68
	Claus Gittinger
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    69
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
    70
    [See also:]
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
    71
	Number
82
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    72
"
0147b4f725ae *** empty log message ***
claus
parents: 77
diff changeset
    73
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    75
!ArithmeticValue class methodsFor:'Signal constants'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    76
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    77
arithmeticSignal
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    78
    "return the parent of all arithmetic signals"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    79
7403
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    80
    ^ ArithmeticError
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    81
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    82
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    83
divisionByZeroSignal
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    84
    "return the signal which is raised on division by zero"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    85
7403
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    86
    ^ ZeroDivide
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    87
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
a27a279701f8 Initial revision
claus
parents:
diff changeset
    89
domainErrorSignal
a27a279701f8 Initial revision
claus
parents:
diff changeset
    90
    "return the signal which is raised on math errors
a27a279701f8 Initial revision
claus
parents:
diff changeset
    91
     (such as log of 0 etc.)"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
7403
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    93
    ^ DomainError
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    94
!
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    95
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    96
imaginaryResultSignal
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    97
    "return the signal which is raised when an imaginary result would be created
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    98
     (such as when taking the sqrt of a negative number)"
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
    99
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
   100
    ^ ImaginaryResultError
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   101
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   102
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   103
operationNotPossibleSignal
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   104
    ^ Error
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   105
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   106
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   107
overflowSignal
a27a279701f8 Initial revision
claus
parents:
diff changeset
   108
    "return the signal which is raised on overflow conditions (in floats)"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   109
7403
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
   110
    ^ OverflowError
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   111
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   112
5955
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
   113
rangeErrorSignal
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
   114
    "return the parent of the overflow/underflow signals"
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
   115
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
   116
    ^ RangeError
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
   117
!
4d973d840a00 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5954
diff changeset
   118
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   119
undefinedResultSignal
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   120
    ^ Error
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   121
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   122
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   123
underflowSignal
a27a279701f8 Initial revision
claus
parents:
diff changeset
   124
    "return the signal which is raised on underflow conditions (in floats)"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   125
7403
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
   126
    ^ UnderflowError
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   127
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   128
345
claus
parents: 326
diff changeset
   129
unorderedSignal
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   130
    "return the signal which is raised when numbers are compared,
345
claus
parents: 326
diff changeset
   131
     for which no ordering is defined (for example: complex numbers)"
claus
parents: 326
diff changeset
   132
7403
857702a5a921 signals vs. errors
Claus Gittinger <cg@exept.de>
parents: 7399
diff changeset
   133
    ^ UnorderedNumbersError
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   135
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   136
!ArithmeticValue class methodsFor:'class initialization'!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   137
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   138
initialize
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   139
    "setup the signals"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   140
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   141
    "/ notice that we now use class based exceptions;
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   142
    "/ however, for backward compatibility, the class variables
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   143
    "/ referring to those are kept for a while, for subclass compatibility.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   144
    "/ Please convert your code to access those via the Signal-constants class
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   145
    "/ messages (accesors) instead of referring to the class variables.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   146
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   147
    ArithmeticSignal := ArithmeticError.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   148
    DomainErrorSignal := DomainError.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   149
    DivisionByZeroSignal := ZeroDivide.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   150
    UnorderedSignal := UnorderedNumbersError.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   151
    ConversionErrorSignal := ConversionError.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   152
    OverflowSignal := OverflowError.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   153
    UnderflowSignal := UnderflowError.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   154
! !
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   155
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   156
!ArithmeticValue class methodsFor:'constants'!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   157
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   158
NaN
8850
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   159
    "return the constant NaN (not a Number)."
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   160
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   161
    ^ NotANumber new
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   162
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   163
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   164
infinity
8850
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   165
    "return something which represents infinity (for my instances)"
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   166
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   167
    ^ Infinity positive
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   168
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   169
7538
dd0131e05cf0 Define #nan for VW-compatibility
Stefan Vogel <sv@exept.de>
parents: 7471
diff changeset
   170
nan
dd0131e05cf0 Define #nan for VW-compatibility
Stefan Vogel <sv@exept.de>
parents: 7471
diff changeset
   171
    "VW compatibility"
dd0131e05cf0 Define #nan for VW-compatibility
Stefan Vogel <sv@exept.de>
parents: 7471
diff changeset
   172
dd0131e05cf0 Define #nan for VW-compatibility
Stefan Vogel <sv@exept.de>
parents: 7471
diff changeset
   173
    ^ self NaN
dd0131e05cf0 Define #nan for VW-compatibility
Stefan Vogel <sv@exept.de>
parents: 7471
diff changeset
   174
!
dd0131e05cf0 Define #nan for VW-compatibility
Stefan Vogel <sv@exept.de>
parents: 7471
diff changeset
   175
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   176
negativeInfinity
8850
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   177
    "return something which represents negative infinity (for my instances)"
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   178
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   179
    ^ Infinity negative
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   180
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   181
7726
a3bb3ae6c02e Define #unity
Stefan Vogel <sv@exept.de>
parents: 7635
diff changeset
   182
unity
11467
f2bdc4080cac comments
Claus Gittinger <cg@exept.de>
parents: 11227
diff changeset
   183
    "return something which represents the unity element (for my instances).
f2bdc4080cac comments
Claus Gittinger <cg@exept.de>
parents: 11227
diff changeset
   184
     That is the neutral element for multiplication."
8850
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   185
7726
a3bb3ae6c02e Define #unity
Stefan Vogel <sv@exept.de>
parents: 7635
diff changeset
   186
    self subclassResponsibility
a3bb3ae6c02e Define #unity
Stefan Vogel <sv@exept.de>
parents: 7635
diff changeset
   187
!
a3bb3ae6c02e Define #unity
Stefan Vogel <sv@exept.de>
parents: 7635
diff changeset
   188
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   189
zero
11467
f2bdc4080cac comments
Claus Gittinger <cg@exept.de>
parents: 11227
diff changeset
   190
    "return something which represents the zero element (for my instances).
f2bdc4080cac comments
Claus Gittinger <cg@exept.de>
parents: 11227
diff changeset
   191
     That is the neutral element for addition."
8850
b9a04c753bfa comments
Claus Gittinger <cg@exept.de>
parents: 8757
diff changeset
   192
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   193
    self subclassResponsibility
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   194
! !
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   195
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8850
diff changeset
   196
!ArithmeticValue class methodsFor:'queries'!
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8850
diff changeset
   197
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8850
diff changeset
   198
isAbstract
11227
c4f57b8aca5a comment
Claus Gittinger <cg@exept.de>
parents: 11133
diff changeset
   199
    "Return if this class is an abstract class.
c4f57b8aca5a comment
Claus Gittinger <cg@exept.de>
parents: 11133
diff changeset
   200
     True is returned for ArithmeticValue here; false for subclasses.
c4f57b8aca5a comment
Claus Gittinger <cg@exept.de>
parents: 11133
diff changeset
   201
     Abstract subclasses must redefine again."
c4f57b8aca5a comment
Claus Gittinger <cg@exept.de>
parents: 11133
diff changeset
   202
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8850
diff changeset
   203
    ^ self == ArithmeticValue
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8850
diff changeset
   204
! !
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8850
diff changeset
   205
15279
7dd8da92779e class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14747
diff changeset
   206
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   207
!ArithmeticValue methodsFor:'arithmetic'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   208
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   209
* something
11735
60aa644effbe comment
Claus Gittinger <cg@exept.de>
parents: 11725
diff changeset
   210
    "return the product of the receiver and the argument."
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   211
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   212
    ^ self subclassResponsibility
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   213
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   214
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   215
+ something
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   216
    "return the sum of the receiver and the argument"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   217
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   218
    ^ self subclassResponsibility
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   219
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   220
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   221
- something
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   222
    "return the difference of the receiver and the argument"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   223
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   224
    ^ self subclassResponsibility
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   225
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   226
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   227
/ something
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   228
    "return the quotient of the receiver and the argument"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   229
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   230
    ^ self subclassResponsibility
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   231
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   232
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   233
// something
1881
0c6ba2c134c1 fixed #rounded
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   234
    "return the integer quotient of dividing the receiver by aNumber with
0c6ba2c134c1 fixed #rounded
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   235
     truncation towards negative infinity."
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   236
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   237
    "/ Note: '^ (self / something) floor' may lead to infinite recursion
1172
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   238
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   239
    ^ self subclassResponsibility
b135d4ae4bf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   240
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   241
    "Modified: / 5.11.1996 / 11:46:27 / cg"
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   242
    "Modified: / 12.2.1998 / 16:31:36 / stefan"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   243
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   244
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
\\ something
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   246
    "return the receiver modulo something.
6067
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   247
     The remainder has the same sign as something.
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   248
     The following is always true:
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   249
	(receiver // something) * something + (receiver \\ something) = receiver
6067
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   250
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   251
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   252
    ^ self - ((self // something) * something)
3134
22c7071ff004 Fix typo.
Stefan Vogel <sv@exept.de>
parents: 1888
diff changeset
   253
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   254
   "
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   255
     0.9 \\ 0.4
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   256
     0.9 \\ -0.4
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   257
    -0.9 \\ 0.4
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   258
    -0.9 \\ -0.4
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   259
   "
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   260
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   261
    "Modified: / 12.2.1998 / 19:14:37 / stefan"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   262
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   263
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   264
abs
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   265
    "return the absolute value of the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   266
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   267
    (self negative) ifTrue:[^ self negated].
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   268
    ^ self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   269
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   270
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   271
dist:arg
8757
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   272
    "return the distance between arg and the receiver."
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   273
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   274
    ^ (arg - self) abs
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   275
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   276
    "
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   277
     (1%1) dist:(0%0)
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   278
     (1@1) dist:(0@0)
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   279
     (1) dist:(0)
8757
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   280
    "
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   281
!
Claus Gittinger <cg@exept.de>
parents: 8633
diff changeset
   282
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   283
negated
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   284
    "return the receiver negated"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   285
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   286
    ^ self class zero - self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   287
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   288
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   289
quo:something
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   290
    "Return the integer quotient of dividing the receiver by the argument
6067
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   291
     with truncation towards zero.
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   292
     The following is always true:
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   293
	(receiver quo: aNumber) * aNumber + (receiver rem: aNumber) = receiver
6067
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   294
    "
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   295
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   296
    ^ (self / something) truncated
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   297
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   298
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   299
reciprocal
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   300
    "return the receivers reciprocal"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   301
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   302
    ^ self class unity / self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   303
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   304
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   305
rem:something
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   306
    "Return the integer remainder of dividing the receiver by the argument
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   307
     with truncation towards zero.
6067
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   308
     The remainder has the same sign as the receiver.
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   309
     The following is always true:
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   310
	(receiver quo: something) * something + (receiver rem: something) = receiver
6067
e4c03d14a5de comment
Claus Gittinger <cg@exept.de>
parents: 5987
diff changeset
   311
    "
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   312
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   313
    ^ self - ((self quo:something) * something)
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   314
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   315
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   316
uncheckedDivide:aNumber
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   317
    "return the quotient of the receiver and the argument, aNumber.
7471
c5d4bd612d9f comments
Claus Gittinger <cg@exept.de>
parents: 7468
diff changeset
   318
     Do not check for divide by zero (return NaN or Infinity).
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   319
     This operation is provided for emulators of other languages/semantics,
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   320
     where no exception is raised for these results (i.e. Java).
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   321
     Its only defined if the arguments type is the same as the receivers."
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   322
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   323
    aNumber isZero ifTrue:[
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   324
	self isZero ifTrue:[^ self class NaN].
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   325
	self negative ifTrue:[^ self class negativeInfinity].
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   326
	^ self class infinity.
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   327
    ].
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   328
    ^ self / aNumber
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   329
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   330
12578
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   331
!ArithmeticValue methodsFor:'arithmetic destructive'!
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   332
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   333
*= aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   334
    "Return the product of self multiplied by aNumber.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   335
     The receiver MAY, but NEED NOT be changed to contain the product.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   336
     So this method must be used as: 'a := a *= 5'.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   337
     This method can be redefined for constructed datatypes to do optimisations"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   338
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   339
    ^ self * aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   340
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   341
    "Created: / 28.4.1999 / 11:46:11 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   342
    "Modified: / 28.4.1999 / 11:53:28 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   343
!
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   344
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   345
+= aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   346
    "Return the sum of self and aNumber.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   347
     The receiver MAY, but NEED NOT be changed to contain the sum.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   348
     So this method must be used as: 'a := a += 5'.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   349
     This method can be redefined for constructed datatypes to do optimisations"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   350
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   351
    ^ self + aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   352
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   353
    "Created: / 28.4.1999 / 10:13:41 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   354
    "Modified: / 28.4.1999 / 11:54:11 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   355
!
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   356
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   357
-= aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   358
    "Return the difference of self and aNumber.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   359
     The receiver MAY, but NEED NOT be changed to contain the difference.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   360
     So this method must be used as: 'a := a -= 5'.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   361
     This method can be redefined for constructed datatypes to do optimisations"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   362
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   363
    ^ self - aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   364
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   365
    "Created: / 28.4.1999 / 10:13:58 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   366
    "Modified: / 28.4.1999 / 11:54:37 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   367
!
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   368
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   369
/= aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   370
    "Return the quotient of self and aNumber.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   371
     The receiver MAY, but NEED NOT be changed to contain the quotient.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   372
     So this method must be used as: 'a := a /= 5'.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   373
     This method can be redefined for constructed datatypes to do optimisations"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   374
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   375
    ^ self / aNumber
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   376
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   377
    "Created: / 28.4.1999 / 11:46:22 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   378
    "Modified: / 28.4.1999 / 11:55:06 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   379
!
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   380
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   381
div2
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   382
    "Return the quotient of self divided by 2.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   383
     The receiver MAY, but NEED NOT be changed to contain the result.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   384
     So this method must be used as: 'a := a div2.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   385
     This method can be redefined for constructed datatypes to do optimisations"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   386
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   387
    ^ self // 2
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   388
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   389
    "Created: / 28.4.1999 / 10:12:44 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   390
    "Modified: / 28.4.1999 / 11:56:09 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   391
!
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   392
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   393
mul2
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   394
    "Return the product of self multiplied by 2.
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   395
     The receiver MAY, but NEED NOT be changed to contain the result.
15279
7dd8da92779e class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14747
diff changeset
   396
     So this method must be used as: a := a mul2.
12578
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   397
     This method can be redefined for constructed datatypes to do optimisations"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   398
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   399
    ^ self * 2
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   400
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   401
    "Created: / 28.4.1999 / 10:12:55 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   402
    "Modified: / 28.4.1999 / 11:56:38 / stefan"
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   403
! !
6cb12eb8eb59 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 12576
diff changeset
   404
5238
f7a816a660a3 categories
Claus Gittinger <cg@exept.de>
parents: 4995
diff changeset
   405
!ArithmeticValue methodsFor:'coercing & converting'!
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   406
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   407
coerce:aNumber
11725
ad5591683279 comment
Claus Gittinger <cg@exept.de>
parents: 11467
diff changeset
   408
    "convert the argument aNumber into an instance of the receivers class and return it."
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   409
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   410
    ^ self subclassResponsibility
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   411
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   412
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   413
generality
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   414
    "return a number giving the receivers generality, that number is
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   415
     used to convert one of the arguments in a mixed expression.
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   416
     The generality has to be defined in subclasses,
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   417
     such that gen(a) > gen(b) iff, conversion of b into a's class
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   418
     does not cut precision. For example, Integer has 40, Float has 80,
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   419
     meaning that if we convert a Float to an Integer, some precision may
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   420
     be lost. The generality is used by ArithmeticValue>>retry:coercing:,
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   421
     which converts the lower-precision number to the higher precision
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   422
     numbers class, when mixed-type arithmetic is performed."
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   423
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   424
    ^ self subclassResponsibility
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   425
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   426
    "Modified: / 5.11.1996 / 15:05:30 / cg"
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   427
    "Modified: / 13.2.1998 / 15:36:01 / stefan"
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   428
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   429
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   430
retry:aSymbol coercing:aNumber
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   431
    "arithmetic represented by the binary operator, aSymbol,
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   432
     could not be performed with the receiver and the argument, aNumber,
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   433
     because of the differences in representation.
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   434
     Coerce either the receiver or the argument, depending on which has higher
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   435
     generality, and try again.
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   436
     If the operation is compare for same value (=), return false if
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   437
     the argument is not a Number.
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   438
     If the generalities are the same, create an error message, since this
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   439
     means that a subclass has not been fully implemented."
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   440
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   441
    |hasGenerality myGenerality otherGenerality|
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   442
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   443
    hasGenerality := aNumber respondsTo:#generality.
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   444
    hasGenerality ifFalse:[
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   445
	(aSymbol == #=) ifTrue:[
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   446
	    ^ false
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   447
	].
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   448
	(aSymbol == #~=) ifTrue:[
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   449
	    ^ true
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   450
	].
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   451
	^ self error:'retry:coercing: argument is not a number'.
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   452
    ].
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   453
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   454
    myGenerality := self generality.
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   455
    otherGenerality := aNumber generality.
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   456
    (myGenerality > otherGenerality) ifTrue:[
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   457
	^ self perform:aSymbol with:(self coerce:aNumber)
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   458
    ].
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   459
    (myGenerality < otherGenerality) ifTrue:[
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   460
	^ (aNumber coerce:self) perform:aSymbol with:aNumber
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   461
    ].
10324
25973c64a974 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10315
diff changeset
   462
    self error:'retry:coercing: oops - same generality; retry should not happen'
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   463
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   464
    "Modified: 5.11.1996 / 15:03:38 / cg"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   465
! !
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   466
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   467
!ArithmeticValue methodsFor:'converting'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   468
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   469
asDouble
7429
3efb092371a3 comment
Claus Gittinger <cg@exept.de>
parents: 7416
diff changeset
   470
    "ST80 compatibility: return a double with receivers value.
3efb092371a3 comment
Claus Gittinger <cg@exept.de>
parents: 7416
diff changeset
   471
     our floats are the identical to ST80 doubles"
3982
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   472
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   473
   ^ self asFloat
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   474
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   475
    "Created: / 13.2.1998 / 15:40:14 / stefan"
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   476
!
22fdd79b2d9d Define asDouble for ST80 compatibility.
Stefan Vogel <sv@exept.de>
parents: 3654
diff changeset
   477
8202
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   478
asFixedPoint
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   479
    "return the receiver as fixedPoint number.
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   480
     Q: what should the scale be here ?"
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   481
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   482
    ^ self asFraction asFixedPoint
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   483
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   484
    "
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   485
     0.3 asFixedPoint
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   486
     0.5 asFixedPoint
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   487
     (1/5) asFloat asFixedPoint
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   488
     (1/3) asFloat asFixedPoint
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   489
     (2/3) asFloat asFixedPoint
8202
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   490
     (1/8) asFloat asFixedPoint
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   491
     3.14159 asFixedPoint
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   492
     0.0000001 asFraction
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   493
     0.0000001 asFixedPoint
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   494
    "
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   495
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   496
    "Modified: / 25.10.1997 / 15:36:54 / cg"
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   497
!
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   498
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   499
asFixedPoint:scale
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   500
    "return the receiver as fixedPoint number with the given
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   501
     number of post-decimal-digits."
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   502
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   503
    ^ self asFraction asFixedPoint:scale
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   504
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   505
    "
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   506
     0.3 asFixedPoint:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   507
     0.3 asFixedPoint:3
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   508
     0.3 asFixedPoint:2
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   509
     0.3 asFixedPoint:1
8202
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   510
     0.3 asFixedPoint:0
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   511
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   512
     0.5 asFixedPoint:3
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   513
     (1/5) asFloat asFixedPoint:1
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   514
     (1/8) asFloat asFixedPoint:1
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   515
     1.0 asFixedPoint:2
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   516
     3.14159 asFixedPoint:2
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   517
     3.14159 asFixedPoint:3
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
   518
     (3.14159 asFixedPoint:2) asFixedPoint:5
8202
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   519
    "
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   520
!
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
   521
12980
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   522
asFixedPointRoundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   523
    "return the receiver as fixedPoint number, rounded to its scale."
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   524
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   525
    ^ self asFixedPoint roundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   526
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   527
    "
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   528
     0.3 asFixedPoint
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   529
     0.5 asFixedPoint
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   530
     (2/3) asFloat asFixedPoint
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   531
     (1/8) asFloat asFixedPoint
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   532
     3.14159 asFixedPoint
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   533
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   534
     0.3 asFixedPointRoundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   535
     0.5 asFixedPointRoundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   536
     (2/3) asFloat asFixedPointRoundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   537
     (1/8) asFloat asFixedPointRoundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   538
     3.14159 asFixedPointRoundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   539
    "
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   540
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   541
    "Created: / 02-08-2010 / 13:32:16 / cg"
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   542
!
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   543
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   544
asFixedPointRoundedToScale:scale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   545
    "return the receiver as fixedPoint number with the given
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   546
     number of post-decimal-digits, rounded to its scale"
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   547
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   548
    ^ (self asFixedPoint:scale) roundedToScale
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   549
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   550
    "Created: / 02-08-2010 / 13:33:11 / cg"
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   551
!
Claus Gittinger <cg@exept.de>
parents: 12760
diff changeset
   552
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   553
asFloat
a27a279701f8 Initial revision
claus
parents:
diff changeset
   554
    "return a float with same value"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   555
a27a279701f8 Initial revision
claus
parents:
diff changeset
   556
   ^ self subclassResponsibility
a27a279701f8 Initial revision
claus
parents:
diff changeset
   557
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   558
5986
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   559
asFloatD
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   560
    "return a double precision float with same value.
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   561
     Added for ANSI compatibility"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   562
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   563
   ^ self asFloat
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   564
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   565
    "Created: / 7.9.2001 / 13:36:48 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   566
    "Modified: / 7.9.2001 / 13:38:10 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   567
!
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   568
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   569
asFloatE
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   570
    "return a single precision float with same value.
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   571
     Added for ANSI compatibility"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   572
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   573
   ^ self asShortFloat
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   574
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   575
    "Created: / 7.9.2001 / 13:37:06 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   576
    "Modified: / 7.9.2001 / 13:38:15 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   577
!
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   578
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   579
asFloatQ
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   580
    "return a quad precision float with same value.
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   581
     Added for ANSI compatibility"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   582
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   583
   ^ self asLongFloat
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   584
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   585
    "Created: / 7.9.2001 / 13:38:44 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   586
!
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   587
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   588
asFraction
a27a279701f8 Initial revision
claus
parents:
diff changeset
   589
    "return a fraction with same value"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   590
a27a279701f8 Initial revision
claus
parents:
diff changeset
   591
   ^ self subclassResponsibility
a27a279701f8 Initial revision
claus
parents:
diff changeset
   592
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   593
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   594
asInteger
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   595
    "return an integer with same value - might truncate"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   596
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   597
    ^ self truncated
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   598
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   599
7378
e71a28f6b712 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7355
diff changeset
   600
asLimitedPrecisionReal
e71a28f6b712 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7355
diff changeset
   601
    "return a float of any precision with same value"
e71a28f6b712 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7355
diff changeset
   602
e71a28f6b712 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7355
diff changeset
   603
   ^ self asFloat
e71a28f6b712 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7355
diff changeset
   604
!
e71a28f6b712 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7355
diff changeset
   605
5986
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   606
asLongFloat
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   607
    "return a longFloat with same value"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   608
10315
4be6dacc89ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9443
diff changeset
   609
    "WARNING: could loose precision here, if not redefined in concrete classes which
4be6dacc89ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9443
diff changeset
   610
     have more than float precision (i.e. LargeIntegers and Fractions)"
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   611
10315
4be6dacc89ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9443
diff changeset
   612
    ^ self asFloat asLongFloat "/ subclassResponsibility
5986
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   613
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   614
    "Modified: / 17.4.1996 / 12:21:35 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   615
    "Created: / 7.9.2001 / 13:39:31 / cg"
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   616
!
3d8c2676e913 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5957
diff changeset
   617
5987
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   618
asScaledDecimal:scale
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   619
    "return a fixedPoint approximating the receivers value"
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   620
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   621
    ^ self asFixedPoint:scale
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   622
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   623
    "
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   624
     1.234 asScaledDecimal:2
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   625
    "
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   626
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   627
    "Created: / 7.9.2001 / 13:46:26 / cg"
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   628
    "Modified: / 7.9.2001 / 13:46:44 / cg"
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   629
!
Claus Gittinger <cg@exept.de>
parents: 5986
diff changeset
   630
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   631
asShortFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   632
    "return a shortFloat with same value"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   633
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   634
   ^ self asFloat asShortFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   635
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   636
    "Modified: 17.4.1996 / 12:21:35 / cg"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   637
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   638
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   639
degreesToRadians
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   640
    "interpreting the receiver as radians, return the degrees"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   641
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   642
    ^ self asFloat degreesToRadians
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   643
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   644
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   645
radiansToDegrees
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   646
    "interpreting the receiver as degrees, return the radians"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   647
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   648
    ^ self asFloat radiansToDegrees
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   649
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   650
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   651
!ArithmeticValue methodsFor:'double dispatching'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   652
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   653
differenceFromComplex:aComplex
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   654
    "the receiver does not know how to subtract from a complex -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   655
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   656
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   657
    ^ aComplex retry:#- coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   658
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   659
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   660
differenceFromFixedPoint:aFixedPoint
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   661
    "the receiver does not know how to subtract from a fixedPoint number -
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   662
     retry the operation by coercing to higher generality"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   663
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   664
    ^ aFixedPoint retry:#- coercing:self
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   665
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   666
    "Created: 5.11.1996 / 14:55:51 / cg"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   667
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   668
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   669
differenceFromFloat:aFloat
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   670
    "the receiver does not know how to subtract from a float -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   671
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   672
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   673
    ^ aFloat retry:#- coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   674
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   675
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   676
differenceFromFraction:aFraction
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   677
    "the receiver does not know how to subtract from a fraction -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   678
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   679
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   680
    ^ aFraction retry:#- coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   681
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   682
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   683
differenceFromInteger:anInteger
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   684
    "the receiver does not know how to subtract from an integer -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   685
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   686
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   687
    ^ anInteger retry:#- coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   688
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   689
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   690
differenceFromLargeFloat:aLargeFloat
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   691
    "the receiver does not know how to subtract from a largeFloat -
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   692
     retry the operation by coercing to higher generality"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   693
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   694
    ^ aLargeFloat retry:#- coercing:self
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   695
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   696
7399
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   697
differenceFromLongFloat:aLongFloat
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   698
    "the receiver does not know how to subtract from a longFloat -
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   699
     retry the operation by coercing to higher generality"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   700
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   701
    ^ aLongFloat retry:#- coercing:self
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   702
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   703
    "Created: 17.4.1996 / 12:33:16 / cg"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   704
!
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   705
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   706
differenceFromShortFloat:aShortFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   707
    "the receiver does not know how to subtract from a shortFloat -
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   708
     retry the operation by coercing to higher generality"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   709
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   710
    ^ aShortFloat retry:#- coercing:self
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   711
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   712
    "Created: 17.4.1996 / 12:33:16 / cg"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   713
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   714
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   715
equalFromComplex:aComplex
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   716
    "the receiver does not know how to compare to a complex number -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   717
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   718
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   719
    ^ aComplex retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   720
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   721
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   722
equalFromFixedPoint:aFixedPoint
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   723
    "the receiver does not know how to compare to a fixed point -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   724
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   725
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   726
    ^ aFixedPoint retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   727
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   728
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   729
equalFromFloat:aFloat
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   730
    "the receiver does not know how to compare to a float -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   731
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   732
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   733
    ^ aFloat retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   734
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   735
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   736
equalFromFraction:aFraction
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   737
    "the receiver does not know how to compare to a fraction -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   738
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   739
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   740
    ^ aFraction retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   741
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   742
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   743
equalFromInteger:anInteger
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   744
    "the receiver does not know how to compare to an integer -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   745
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   746
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   747
    ^ anInteger retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   748
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   749
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   750
equalFromLargeFloat:aLargeFloat
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   751
    "the receiver does not know how to compare to a large float -
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   752
     retry the operation by coercing to higher generality"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   753
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   754
    ^ aLargeFloat retry:#= coercing:self
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   755
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   756
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   757
equalFromLongFloat:aLongFloat
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   758
    "the receiver does not know how to compare to a long float -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   759
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   760
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   761
    ^ aLongFloat retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   762
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   763
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   764
equalFromShortFloat:aShortFloat
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   765
    "the receiver does not know how to compare to a short float -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   766
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   767
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   768
    ^ aShortFloat retry:#= coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   769
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   770
13007
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   771
integerQuotientFromInteger:anInteger
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   772
    "anInteger does not know how to divide by the receiver -
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   773
     retry the operation by coercing to higher generality"
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   774
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   775
    ^ anInteger retry:#// coercing:self
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   776
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   777
    "Created: / 09-08-2010 / 19:49:26 / cg"
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   778
!
Claus Gittinger <cg@exept.de>
parents: 12980
diff changeset
   779
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   780
lessFromFixedPoint:aFixedPoint
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   781
    "the receiver does not know how to compare to a fixedPoint number -
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   782
     retry the operation by coercing to higher generality"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   783
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   784
    ^ aFixedPoint retry:#< coercing:self
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   785
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   786
    "Created: 5.11.1996 / 14:56:12 / cg"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   787
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   788
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   789
lessFromFloat:aFloat
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   790
    "the receiver does not know how to compare to a float -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   791
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   792
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   793
    ^ aFloat retry:#< coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   794
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   795
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   796
lessFromFraction:aFraction
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   797
    "the receiver does not know how to compare to a fraction -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   798
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   799
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   800
    ^ aFraction retry:#< coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   801
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   802
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   803
lessFromInteger:anInteger
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   804
    "the receiver does not know how to compare to an integer -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   805
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   806
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   807
    ^ anInteger retry:#< coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   808
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   809
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   810
lessFromLargeFloat:aLargeFloat
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   811
    "the receiver does not know how to compare to a largeFloat -
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   812
     retry the operation by coercing to higher generality"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   813
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   814
    ^ aLargeFloat retry:#< coercing:self
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   815
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   816
7399
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   817
lessFromLongFloat:aLongFloat
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   818
    "the receiver does not know how to compare to a longFloat -
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   819
     retry the operation by coercing to higher generality"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   820
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   821
    ^ aLongFloat retry:#< coercing:self
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   822
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   823
    "Modified: 17.4.1996 / 12:33:33 / cg"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   824
!
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   825
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   826
lessFromShortFloat:aShortFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   827
    "the receiver does not know how to compare to a shortFloat -
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   828
     retry the operation by coercing to higher generality"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   829
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   830
    ^ aShortFloat retry:#< coercing:self
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   831
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   832
    "Modified: 17.4.1996 / 12:33:33 / cg"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   833
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   834
14002
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   835
moduloFromInteger:anInteger
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   836
    "anInteger does not know how to compute the modulo from the receiver -
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   837
     retry the operation by coercing to higher generality"
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   838
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   839
    ^ anInteger retry:#\\ coercing:self
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   840
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   841
    "Created: / 12-02-2012 / 20:38:13 / cg"
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   842
!
0f1ef36dc1b6 added: #moduloFromInteger:
Claus Gittinger <cg@exept.de>
parents: 14001
diff changeset
   843
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   844
productFromComplex:aComplex
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   845
    "the receiver does not know how to multiply a complex -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   846
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   847
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   848
    ^ aComplex retry:#* coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   849
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   850
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   851
productFromFixedPoint:aFixedPoint
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   852
    "the receiver does not know how to multiply a fixed point number -
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   853
     retry the operation by coercing to higher generality"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   854
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   855
    ^ aFixedPoint retry:#* coercing:self
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   856
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   857
    "Created: 5.11.1996 / 14:56:28 / cg"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   858
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   859
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   860
productFromFloat:aFloat
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   861
    "the receiver does not know how to multiply a float -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   862
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   863
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   864
    ^ aFloat retry:#* coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   865
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   866
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   867
productFromFraction:aFraction
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   868
    "the receiver does not know how to multiply a fraction -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   869
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   870
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   871
    ^ aFraction retry:#* coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   872
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   873
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   874
productFromInteger:anInteger
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   875
    "the receiver does not know how to multiply an integer -
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   876
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   877
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   878
    ^ anInteger retry:#* coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   879
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   880
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   881
productFromLargeFloat:aLargeFloat
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   882
    "the receiver does not know how to multiply a largeFloat -
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   883
     retry the operation by coercing to higher generality"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   884
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   885
    ^ aLargeFloat retry:#* coercing:self
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   886
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   887
    "Created: 17.4.1996 / 12:33:48 / cg"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   888
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   889
7399
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   890
productFromLongFloat:aLongFloat
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   891
    "the receiver does not know how to multiply a longFloat -
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   892
     retry the operation by coercing to higher generality"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   893
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   894
    ^ aLongFloat retry:#* coercing:self
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   895
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   896
    "Created: 17.4.1996 / 12:33:48 / cg"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   897
!
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   898
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   899
productFromShortFloat:aShortFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   900
    "the receiver does not know how to multiply a shortFloat -
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   901
     retry the operation by coercing to higher generality"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   902
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   903
    ^ aShortFloat retry:#* coercing:self
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   904
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   905
    "Created: 17.4.1996 / 12:33:48 / cg"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   906
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   907
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   908
quotientFromComplex:aComplex
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   909
    "aComplex does not know how to divide by the receiver -
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   910
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   911
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   912
    ^ aComplex retry:#/ coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   913
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   914
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   915
quotientFromFixedPoint:aFixedPoint
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   916
    "aFixedPoint does not know how to divide by the receiver -
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   917
     retry the operation by coercing to higher generality"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   918
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   919
    ^ aFixedPoint retry:#/ coercing:self
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   920
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   921
    "Created: 5.11.1996 / 14:56:41 / cg"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   922
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   923
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   924
quotientFromFloat:aFloat
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   925
    "aFloat does not know how to divide by the receiver -
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   926
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   927
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   928
    ^ aFloat retry:#/ coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   929
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   930
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   931
quotientFromFraction:aFraction
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   932
    "aFraction does not know how to divide by the receiver -
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   933
     retry the operation by coercing to higher generality"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   934
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   935
    ^ aFraction retry:#/ coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   936
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   937
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   938
quotientFromInteger:anInteger
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   939
    "anInteger does not know how to divide by the receiver -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   940
     retry the operation by coercing to higher generality"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   941
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   942
    ^ anInteger retry:#/ coercing:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   943
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   944
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   945
quotientFromLargeFloat:aLargeFloat
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   946
    "aLargeFloat does not know how to divide by the receiver -
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   947
     retry the operation by coercing to higher generality"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   948
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   949
    ^ aLargeFloat retry:#/ coercing:self
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   950
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   951
    "Created: 17.4.1996 / 12:34:00 / cg"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   952
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   953
7399
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   954
quotientFromLongFloat:aLongFloat
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   955
    "aLongFloat does not know how to divide by the receiver -
7399
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   956
     retry the operation by coercing to higher generality"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   957
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   958
    ^ aLongFloat retry:#/ coercing:self
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   959
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   960
    "Created: 17.4.1996 / 12:34:00 / cg"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   961
!
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
   962
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   963
quotientFromShortFloat:aShortFloat
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
   964
    "aShortFloat does not know how to divide by the receiver -
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   965
     retry the operation by coercing to higher generality"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   966
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   967
    ^ aShortFloat retry:#/ coercing:self
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   968
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   969
    "Created: 17.4.1996 / 12:34:00 / cg"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   970
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   971
14747
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   972
remainderFromFloat:aFloat
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   973
    "aFloat does not know how to compute the remainder with the receiver -
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   974
     retry the operation by coercing to higher generality"
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   975
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   976
    ^ aFloat retry:#rem: coercing:self
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   977
!
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   978
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   979
remainderFromShortFloat:aShortFloat
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   980
    "aShortFloat does not know how to compute the remainder with the receiver -
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   981
     retry the operation by coercing to higher generality"
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   982
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   983
    ^ aShortFloat retry:#rem: coercing:self
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   984
!
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
   985
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   986
sumFromComplex:aComplex
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   987
    "the receiver does not know how to add a complex -
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   988
     retry the operation by coercing to higher generality"
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   989
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   990
    ^ aComplex retry:#+ coercing:self
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   991
!
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
   992
1888
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   993
sumFromFixedPoint:aFixedPoint
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   994
    "the receiver does not know how to add a fixed point number -
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   995
     retry the operation by coercing to higher generality"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   996
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   997
    ^ aFixedPoint retry:#+ coercing:self
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   998
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   999
    "Created: 5.11.1996 / 14:56:56 / cg"
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
  1000
!
463d49ca22e3 fixedPoint support
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
  1001
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1002
sumFromFloat:aFloat
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1003
    "the receiver does not know how to add a float -
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1004
     retry the operation by coercing to higher generality"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1005
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1006
    ^ aFloat retry:#+ coercing:self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1007
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1008
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1009
sumFromFraction:aFraction
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1010
    "the receiver does not know how to add a fraction -
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1011
     retry the operation by coercing to higher generality"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1012
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1013
    ^ aFraction retry:#+ coercing:self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1014
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1015
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1016
sumFromInteger:anInteger
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1017
    "the receiver does not know how to add an integer -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1018
     retry the operation by coercing to higher generality"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1019
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1020
    ^ anInteger retry:#+ coercing:self
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1021
!
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1022
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1023
sumFromLargeFloat:aLargeFloat
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1024
    "the receiver does not know how to add a largeFloat -
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1025
     retry the operation by coercing to higher generality"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1026
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1027
    ^ aLargeFloat retry:#+ coercing:self
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1028
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1029
    "Created: 17.4.1996 / 12:34:10 / cg"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1030
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1031
7399
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1032
sumFromLongFloat:aLongFloat
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1033
    "the receiver does not know how to add a longFloat -
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1034
     retry the operation by coercing to higher generality"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1035
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1036
    ^ aLongFloat retry:#+ coercing:self
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1037
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1038
    "Created: 17.4.1996 / 12:34:10 / cg"
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1039
!
43d62fad41b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7393
diff changeset
  1040
1200
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1041
sumFromShortFloat:aShortFloat
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1042
    "the receiver does not know how to add a shortFloat -
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1043
     retry the operation by coercing to higher generality"
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1044
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1045
    ^ aShortFloat retry:#+ coercing:self
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1046
cc16f7a00b52 limited shortFloat support
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
  1047
    "Created: 17.4.1996 / 12:34:10 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1048
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1049
7384
ae6b11a3b4d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7378
diff changeset
  1050
!ArithmeticValue methodsFor:'mathematical functions'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1051
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1052
** aNumber
9443
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1053
    "Answer the receiver raised to the power of the argument, aNumber."
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1054
    "same as Number>>raisedTo:"
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1055
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1056
    ^self raisedTo: aNumber
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1057
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1058
    "Created: / 15-07-2006 / 15:11:05 / cg"
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1059
    "Modified: / 17-07-2006 / 12:51:33 / cg"
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1060
!
5d3f32a6f43e added **
Claus Gittinger <cg@exept.de>
parents: 9400
diff changeset
  1061
7635
fbe7cf11ac9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7538
diff changeset
  1062
raisedTo: aNumber
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1063
    aNumber isInteger ifTrue:[
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1064
	^ self raisedToInteger:aNumber
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1065
    ].
7635
fbe7cf11ac9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7538
diff changeset
  1066
    ^ self subclassResponsibility
6858
13919a7544b6 raisedToInteger pushed up
Claus Gittinger <cg@exept.de>
parents: 6691
diff changeset
  1067
!
13919a7544b6 raisedToInteger pushed up
Claus Gittinger <cg@exept.de>
parents: 6691
diff changeset
  1068
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1069
raisedToInteger:exp
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1070
    "return the receiver raised to exp"
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1071
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1072
    |result e t|
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1073
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1074
    "use the addition chaining algorithm,
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1075
     which is much faster for big exp-arguments"
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1076
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1077
    result := 1.
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1078
    t := self.
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1079
    exp < 0 ifTrue:[
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1080
        e := exp negated.
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1081
    ] ifFalse:[
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1082
        e := exp.
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1083
    ].
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1084
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1085
    [e ~~ 0] whileTrue:[
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1086
        [(e bitAnd:1) == 0] whileTrue:[
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1087
            e := e bitShift:-1.
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1088
            t := t * t.
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1089
        ].
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1090
        e := e - 1.
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1091
        result := result * t.
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1092
    ].
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1093
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1094
    (exp < 0) ifTrue:[
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1095
        ^ 1 / result
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1096
    ].
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1097
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1098
    ^ result
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1099
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1100
    "
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1101
     (2 raisedToInteger:216)
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1102
     (2 raisedTo:216)
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1103
            -> 105312291668557186697918027683670432318895095400549111254310977536
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1104
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1105
     (2 raisedToInteger:216) asFloat
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1106
     (2 raisedTo:216) asFloat
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1107
            -> 1.05312E+65
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1108
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1109
     (2 raisedToInteger:500)
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1110
     (2 raisedTo:500)
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1111
            -> 3273390607896141870013189696827599152216642046043064789483291368096133796404674554883270092325904157150886684127560071009217256545885393053328527589376
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1112
     2 raisedToInteger:10
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1113
            -> 1024
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1114
    -2 raisedToInteger:10
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1115
            -> 1024
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1116
     -2 raisedToInteger:9
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1117
            -> -512
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1118
     10 raisedToInteger:-10
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1119
            -> (1/10000000000)
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1120
     2 raisedToInteger:0
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1121
            -> 1
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1122
     2 raisedToInteger:-1
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1123
            -> (1/2)
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1124
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1125
     Time millisecondsToRun:[
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1126
        10000 timesRepeat:[
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1127
            (2 raisedToInteger:500)
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1128
        ]
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1129
     ]
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1130
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1131
     Time millisecondsToRun:[
12760
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1132
        |bigNum|
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1133
        bigNum := 2 raisedToInteger:500.
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1134
        10 timesRepeat:[
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1135
            (bigNum raisedToInteger:500)
6482afd031af comment/format in: #raisedToInteger:
Claus Gittinger <cg@exept.de>
parents: 12578
diff changeset
  1136
        ]
8633
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1137
     ]
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1138
    "
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1139
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1140
    "Created: / 27.4.1999 / 15:19:22 / stefan"
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1141
    "Modified: / 27.4.1999 / 16:16:11 / stefan"
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1142
!
239f2bd03afe raisedTo: / raisedToInteger: moved up
Claus Gittinger <cg@exept.de>
parents: 8449
diff changeset
  1143
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1144
squared
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1145
    "return receiver * receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1146
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1147
    ^ self * self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1148
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1149
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1150
!ArithmeticValue methodsFor:'queries'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1151
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1152
respondsToArithmetic
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1153
    "return true, if the receiver responds to arithmetic messages"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1154
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1155
    ^ true
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1156
! !
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1157
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1158
!ArithmeticValue methodsFor:'testing'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1159
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1160
denominator
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1161
    "return the denominator of the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1162
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1163
    ^ 1
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1164
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1165
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1166
even
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1167
    "return true if the receiver is divisible by 2"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1168
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1169
    ^ self truncated asInteger even
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1170
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1171
3635
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1172
isComplex
7355
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
  1173
    "Answer whether the receiver has an imaginary part
96f466eeddf5 double dispatching fixed;
Claus Gittinger <cg@exept.de>
parents: 7228
diff changeset
  1174
     (i.e. if it is a complex number). Always false here."
3635
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1175
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1176
    ^ false
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1177
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1178
    "Modified: / 9.7.1998 / 10:19:27 / cg"
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1179
!
3fcccef48db3 complex conversion stuff
Claus Gittinger <cg@exept.de>
parents: 3393
diff changeset
  1180
8979
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1181
isFinite
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1182
    "return true, if the receiver is finite
9400
e3d6f81078ce comment
Stefan Vogel <sv@exept.de>
parents: 8979
diff changeset
  1183
     i.e. it can be represented as a rational number."
e3d6f81078ce comment
Stefan Vogel <sv@exept.de>
parents: 8979
diff changeset
  1184
8979
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1185
    ^ true
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1186
!
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1187
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1188
isInfinite
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1189
    ^ false
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1190
!
869510c58b9c Move #isFinite and #isInfinite from Number to ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8892
diff changeset
  1191
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1192
isNegativeInfinity
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1193
    ^ self negative and:[self isInfinite]
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1194
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1195
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1196
isNegativeZero
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1197
    "return false - must be redefined by subclasses which can represent a negative zero
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1198
     (i.e. limitedPrecisionReal classes)"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1199
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1200
    ^ false
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1201
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1202
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1203
isPositiveInfinity
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1204
    ^ self positive and:[self isInfinite]
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1205
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1206
6156
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1207
isReal
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1208
    "return true, if the receiver is some kind of real number (as opposed to a complex);
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1209
     false is returned here - the method is only redefined in Number (and Complex)."
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1210
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1211
    ^ false
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1212
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1213
    "Modified: / 6.11.2001 / 13:20:20 / cg"
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1214
    "Created: / 6.11.2001 / 13:26:29 / cg"
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1215
!
ff2df95a69bf isReal moved
Claus Gittinger <cg@exept.de>
parents: 6067
diff changeset
  1216
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1217
isZero
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1218
    "return false - must be redefined by subclasses which can represent a negative zero
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1219
     (i.e. limitedPrecisionReal classes)"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1220
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1221
    ^ self = self class zero
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1222
!
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1223
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1224
negative
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1225
    "return true if the receiver is less than zero"
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1226
8202
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
  1227
    ^ self < self class zero
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1228
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1229
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1230
numerator
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1231
    "return the numerator of the receiver."
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1232
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1233
    ^ self
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1234
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1235
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1236
odd
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1237
    "return true if the receiver is not divisible by 2"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1238
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1239
    ^ self even not
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1240
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1241
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1242
positive
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1243
    "return true, if the receiver is >= 0"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1244
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1245
    ^ self negative not
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1246
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1247
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1248
sign
7471
c5d4bd612d9f comments
Claus Gittinger <cg@exept.de>
parents: 7468
diff changeset
  1249
    "return the sign of the receiver (-1, 0 or 1)"
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1250
7440
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1251
    |zero|
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1252
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1253
    zero := self class zero.
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1254
    (self < zero) ifTrue:[^ -1].
d96bfc80e75e double dispatching
Claus Gittinger <cg@exept.de>
parents: 7429
diff changeset
  1255
    (zero < self) ifTrue:[^ 1].
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1256
    ^ 0
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1257
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1258
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1259
strictlyPositive
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1260
    "return true, if the receiver is > 0"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1261
8202
2a6c8d1e26cb Define #asFixedPoint in ArithmethicValue
Stefan Vogel <sv@exept.de>
parents: 8184
diff changeset
  1262
    ^ self class zero < self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1263
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1264
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1265
!ArithmeticValue methodsFor:'truncation & rounding'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1266
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1267
ceiling
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1268
    "return the integer nearest the receiver towards positive infinity."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1269
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1270
    |anInteger|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1271
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1272
    anInteger := self // 1.       "truncates towards negative infinity"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1273
    anInteger = self ifTrue:[^ anInteger].
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1274
    ^ anInteger + 1
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1275
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1276
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1277
floor
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1278
    "return the receiver truncated towards negative infinity"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1279
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1280
    ^ self // 1
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1281
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1282
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1283
roundTo:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1284
    "return the receiver rounded to multiples of aNumber"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1285
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1286
    ^ (self / aNumber) rounded * aNumber
8449
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1287
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1288
    "
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1289
     0 roundTo:4
8449
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1290
     1 roundTo:4
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1291
     2 roundTo:4
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1292
     3 roundTo:4
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1293
     4 roundTo:4
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1294
     5 roundTo:4
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1295
     6 roundTo:4
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1296
     7 roundTo:4
14497
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1297
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1298
     7.123 roundTo:0.1
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1299
     7.523 roundTo:0.1
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1300
     7.583 roundTo:0.1 
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1301
     7.623 roundTo:0.1
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1302
     7.623 roundTo:0.01 
211259d933cb class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14002
diff changeset
  1303
     7.628 roundTo:0.01 
8449
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1304
    "
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1305
!
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1306
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1307
roundUpTo:aNumber
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1308
    "return the receiver rounded up to the next multiple of aNumber"
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1309
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1310
    ^ (self / aNumber) ceiling * aNumber
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1311
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1312
    "
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1313
     0 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1314
     1 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1315
     2 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1316
     3 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1317
     4 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1318
     5 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1319
     6 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1320
     7 roundUpTo:4
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1321
     8 roundUpTo:4
10911
38e7677d10a7 comment added
Claus Gittinger <cg@exept.de>
parents: 10326
diff changeset
  1322
     (3@4) roundUpTo:8
38e7677d10a7 comment added
Claus Gittinger <cg@exept.de>
parents: 10326
diff changeset
  1323
     (3@4) roundUpTo:(5 @ 4)
38e7677d10a7 comment added
Claus Gittinger <cg@exept.de>
parents: 10326
diff changeset
  1324
     (3@3) roundUpTo:(5 @ 4) 
8449
9ec3ade5a78b +roundUpTo
Claus Gittinger <cg@exept.de>
parents: 8202
diff changeset
  1325
    "
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1326
!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1327
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1328
rounded
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1329
    "return the integer nearest the receiver"
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1330
1881
0c6ba2c134c1 fixed #rounded
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1331
    self negative ifTrue:[
10326
b1103ad3581f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10324
diff changeset
  1332
	^ (self - 0.5) ceiling
1881
0c6ba2c134c1 fixed #rounded
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1333
    ].
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1334
    ^ (self + 0.5) floor
1881
0c6ba2c134c1 fixed #rounded
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1335
0c6ba2c134c1 fixed #rounded
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1336
    "Modified: 5.11.1996 / 11:31:59 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1337
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1338
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1339
truncateTo:aNumber
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1340
    "return the receiver truncated to multiples of aNumber"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1341
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1342
    ^ ((self / aNumber) floor * aNumber) asInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1343
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1344
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1345
truncated
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1346
    "return the receiver truncated towards zero"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1347
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1348
    self negative ifTrue:[
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1349
	^ self ceiling
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1350
    ].
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1351
    ^ self floor
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1352
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1353
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1354
!ArithmeticValue class methodsFor:'documentation'!
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1355
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1356
version
15279
7dd8da92779e class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14747
diff changeset
  1357
    ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.92 2013-05-27 08:14:43 cg Exp $'
12576
47985f127034 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 11735
diff changeset
  1358
!
47985f127034 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 11735
diff changeset
  1359
47985f127034 category of:6 methods
Claus Gittinger <cg@exept.de>
parents: 11735
diff changeset
  1360
version_CVS
15279
7dd8da92779e class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14747
diff changeset
  1361
    ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.92 2013-05-27 08:14:43 cg Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1362
! !
6858
13919a7544b6 raisedToInteger pushed up
Claus Gittinger <cg@exept.de>
parents: 6691
diff changeset
  1363
14747
18be9a3c2324 class: ArithmeticValue
Claus Gittinger <cg@exept.de>
parents: 14497
diff changeset
  1364
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1365
ArithmeticValue initialize!