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



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

def InfinityClass.new!
  new
end

Instance Method Details

#*(a) ⇒ Object



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

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

#**(a) ⇒ Object



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

def ** (a)
  self
end

#+(a) ⇒ Object



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

def + (a)
 self
end

#-(a) ⇒ Object



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

def - (a)
 self
end

#/(a) ⇒ Object



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

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

#<(other) ⇒ Object



1221
1222
1223
# File 'lib/m500.rb', line 1221

def < (other)
  false
end

#==(other) ⇒ Object



1227
1228
1229
# File 'lib/m500.rb', line 1227

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

#>(other) ⇒ Object



1224
1225
1226
# File 'lib/m500.rb', line 1224

def > (other)
  true
end

#coerce(a) ⇒ Object



1230
1231
1232
# File 'lib/m500.rb', line 1230

def coerce(a)
  [infinity, infinity]
end

#is_0?Boolean

Returns:

  • (Boolean)


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

def is_0?
  false
end

#nextObject



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

def next
  self
end

#succObject



1218
1219
1220
# File 'lib/m500.rb', line 1218

def succ
  self
end

#to_DecObject



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

def to_Dec
  self
end

#to_fObject



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

def to_f
  nil
end

#to_FracObject



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

def to_Frac
  self
end

#to_iObject



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

def to_i
  nil
end

#to_NObject



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

def to_N
  self
end

#to_QObject



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

def to_Q
  self
end

#to_RObject



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

def to_R
  self
end

#to_sObject



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

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

#to_sgmlObject



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

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

#to_ZObject



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

def to_Z
  self
end