Class: InfinityClass

Inherits:
Object
  • Object
show all
Includes:
SGML
Defined in:
lib/m500.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SGML

#sgml_id, #tog_sgml_id

Class Method Details

.new!Object



1144
1145
1146
# File 'lib/m500.rb', line 1144

def InfinityClass.new!
  new
end

Instance Method Details

#*(a) ⇒ Object



1160
1161
1162
# File 'lib/m500.rb', line 1160

def * (a)
  a === infinity ? nan : self
end

#**(a) ⇒ Object



1166
1167
1168
# File 'lib/m500.rb', line 1166

def ** (a)
  self
end

#+(a) ⇒ Object



1154
1155
1156
# File 'lib/m500.rb', line 1154

def + (a)
 self
end

#-(a) ⇒ Object



1157
1158
1159
# File 'lib/m500.rb', line 1157

def - (a)
 self
end

#/(a) ⇒ Object



1163
1164
1165
# File 'lib/m500.rb', line 1163

def / (a)
  a === infinity ? nan : 0 # infinitesimal
end

#<(other) ⇒ Object



1205
1206
1207
# File 'lib/m500.rb', line 1205

def < (other)
  false
end

#==(other) ⇒ Object



1211
1212
1213
# File 'lib/m500.rb', line 1211

def == (other)
  other.kind_of?(InfinityClass) ? true : false
end

#>(other) ⇒ Object



1208
1209
1210
# File 'lib/m500.rb', line 1208

def > (other)
  true
end

#coerce(a) ⇒ Object



1214
1215
1216
# File 'lib/m500.rb', line 1214

def coerce(a)
  [infinity, infinity]
end

#is_0?Boolean

Returns:

  • (Boolean)


1151
1152
1153
# File 'lib/m500.rb', line 1151

def is_0?
  false
end

#nextObject



1199
1200
1201
# File 'lib/m500.rb', line 1199

def next
  self
end

#succObject



1202
1203
1204
# File 'lib/m500.rb', line 1202

def succ
  self
end

#to_DecObject



1193
1194
1195
# File 'lib/m500.rb', line 1193

def to_Dec
  self
end

#to_fObject



1172
1173
1174
# File 'lib/m500.rb', line 1172

def to_f
  nil
end

#to_FracObject



1187
1188
1189
# File 'lib/m500.rb', line 1187

def to_Frac
  self
end

#to_iObject



1169
1170
1171
# File 'lib/m500.rb', line 1169

def to_i
  nil
end

#to_NObject



1181
1182
1183
# File 'lib/m500.rb', line 1181

def to_N
  self
end

#to_QObject



1190
1191
1192
# File 'lib/m500.rb', line 1190

def to_Q
  self
end

#to_RObject



1196
1197
1198
# File 'lib/m500.rb', line 1196

def to_R
  self
end

#to_sObject



1178
1179
1180
# File 'lib/m500.rb', line 1178

def to_s
  "\u221E".encode('utf-8')
end

#to_s!Object



1175
1176
1177
# File 'lib/m500.rb', line 1175

def to_s!
  "infinity"
end

#to_sgmlObject



1141
1142
1143
# File 'lib/m500.rb', line 1141

def to_sgml
  "<mn #{sgml_id}class='infinity'>&infin</mn>"
end

#to_ZObject



1184
1185
1186
# File 'lib/m500.rb', line 1184

def to_Z
  self
end