1  ------------------------------------------------------------------
  2  -- This file was autogenerated by 'writeNumbers', do not modify --
  3  ------------------------------------------------------------------
  4  
  5  package frost.core
  6  
  7  ===
  8  A 64-bit floating point number.
  9  ===
 10  class Real64 : Value, HashKey<Real64>, Comparable<Real64>, Formattable {
 11      constant PI := 3.14159265358979323846
 12      constant E := 2.71828182845904523536
 13  
 14      @package
 15      def value:builtin_float64
 16  
 17      ===@hidden===
 18      @implicit
 19      init(value:builtin_float64) {
 20          self.value := value
 21      }
 22  
 23      ===@hidden===
 24      @implicit
 25      @priority(-6)
 26      init(value:Int8) {
 27          self.value := value.value->builtin_float64
 28      }
 29  
 30      ===@hidden===
 31      @implicit
 32      @priority(-5)
 33      init(value:Int16) {
 34          self.value := value.value->builtin_float64
 35      }
 36  
 37      ===@hidden===
 38      @implicit
 39      @priority(-4)
 40      init(value:Int32) {
 41          self.value := value.value->builtin_float64
 42      }
 43  
 44      ===@hidden===
 45      @implicit
 46      @priority(-3)
 47      init(value:Int64) {
 48          self.value := value.value->builtin_float64
 49      }
 50  
 51      ===@hidden===
 52      @implicit
 53      @priority(-4)
 54      init(value:Int) {
 55          self.value := value.value->builtin_float64
 56      }
 57  
 58      ===@hidden===
 59      @implicit
 60      @priority(-3)
 61      init(value:UInt8) {
 62          self.value := value.value->builtin_float64
 63      }
 64  
 65      ===@hidden===
 66      @implicit
 67      @priority(-2)
 68      init(value:UInt16) {
 69          self.value := value.value->builtin_float64
 70      }
 71  
 72      ===@hidden===
 73      @implicit
 74      @priority(-1)
 75      init(value:UInt32) {
 76          self.value := value.value->builtin_float64
 77      }
 78  
 79      ===@hidden===
 80      @implicit
 81      @priority(0)
 82      init(value:UInt64) {
 83          self.value := value.value->builtin_float64
 84      }
 85  
 86      ===@hidden===
 87      @implicit
 88      @priority(-1)
 89      init(value:UInt) {
 90          self.value := value.value->builtin_float64
 91      }
 92  
 93      ===@hidden===
 94      @implicit
 95      @priority(-4)
 96      init(value:Real32) {
 97          self.value := value.value->builtin_float64
 98      }
 99  
100      ===Adds another number to this number.===
101      @priority(20)
102      function +(other:Real64):Real64 {
103          return value + other.value
104      }
105  
106      ===Subtracts another number from this number.===
107      @priority(20)
108      function -(other:Real64):Real64 {
109          return value - other.value
110      }
111  
112      ===Returns the negation (additive inverse) of this number===
113      function -():Real64 {
114          return Real64(-value)
115      }
116  
117      ===Multiplies this number by another number.===
118      @priority(20)
119      function *(other:Real64):Real64 {
120          return value * other.value
121      }
122  
123      ===Divides this number by another number.===
124      @priority(12)
125      function /(other:Int8):Real64 {
126          return value / other.value->builtin_float64
127      }
128  
129      ===Divides this number by another number.===
130      @priority(14)
131      function /(other:Int16):Real64 {
132          return value / other.value->builtin_float64
133      }
134  
135      ===Divides this number by another number.===
136      @priority(16)
137      function /(other:Int32):Real64 {
138          return value / other.value->builtin_float64
139      }
140  
141      ===Divides this number by another number.===
142      @priority(18)
143      function /(other:Int64):Real64 {
144          return value / other.value->builtin_float64
145      }
146  
147      ===Divides this number by another number.===
148      @priority(11)
149      function /(other:UInt8):Real64 {
150          return value / other.value->builtin_float64
151      }
152  
153      ===Divides this number by another number.===
154      @priority(13)
155      function /(other:UInt16):Real64 {
156          return value / other.value->builtin_float64
157      }
158  
159      ===Divides this number by another number.===
160      @priority(15)
161      function /(other:UInt32):Real64 {
162          return value / other.value->builtin_float64
163      }
164  
165      ===Divides this number by another number.===
166      @priority(17)
167      function /(other:UInt64):Real64 {
168          return value / other.value->builtin_float64
169      }
170  
171      ===Divides this number by another number.===
172      @priority(21)
173      function /(other:Real32):Real64 {
174          return value / other.value->builtin_float64
175      }
176  
177      ===Divides this number by another number.===
178      @priority(20)
179      function /(other:Real64):Real64 {
180          return value / other.value
181      }
182  
183      ===Returns `true` if this number is equal to the given number.===
184      @priority(21)
185      function =(other:Real32):Bit {
186          return value = other.value->builtin_float64
187      }
188  
189      ===Returns `true` if this number is equal to the given number.===
190      @override
191      @priority(20)
192      function =(other:Real64):Bit {
193          return value = other.value
194      }
195  
196      ===Returns `true` if this number is not equal to the given number.===
197      @priority(21)
198      function !=(other:Real32):Bit {
199          return value != other.value->builtin_float64
200      }
201  
202      ===Returns `true` if this number is not equal to the given number.===
203      @override
204      @priority(20)
205      function !=(other:Real64):Bit {
206          return value != other.value
207      }
208  
209      ===Returns `true` if this number is less than the given number.===
210      @priority(21)
211      function <(other:Real32):Bit {
212          return value < other.value->< other.value->builtin_float64
213      }
214  
215      ===Returns `true` if this number is less than the given number.===
216      @override
217      @priority(20)
218      function <(other:Real64):Bit {
219          return value < other.value
220      }< other.value
221      }
222  
223      ===Returns `true` if this number is greater than the given number.===
224      @priority(21)
225      function >(other:Real32):Bit {
226          return value > other.value->builtin_float64
227      }
228  
229      ===Returns `true` if this number is greater than the given number.===
230      @override
231      @priority(20)
232      function >(other:Real64):Bit {
233          return value > other.value
234      }
235  
236      ===Returns `true` if this number is greater than or equal to the given number.===
237      @priority(21)
238      function >=(other:Real32):Bit {
239          return value >= other.value->builtin_float64
240      }
241  
242      ===Returns `true` if this number is greater than or equal to the given number.===
243      @override
244      @priority(20)
245      function >=(other:Real64):Bit {
246          return value >= other.value
247      }
248  
249      ===Returns `true` if this number is less than or equal to the given number.===
250      @priority(21)
251      function <=(other:Real32):Bit {
252          return value <= other.value->builtin_float64
253      }
254  
255      ===Returns `true` if this number is less than or equal to the given number.===
256      @override
257      @priority(20)
258      function <=(other:Real64):Bit {
259          return value <= other.value
260      }
261  
262      ===The absolute value of this number.===
263      property abs:Real64
264      function get_abs():Real64 {
265          if self < 0 {
266              return -self
267          }
268          return self
269      }
270  
271      ===Returns the smaller (closest to negative infinity) of this number and another number.===
272      @priority(12)
273      function min(other:Int8):Real64 {
274          if value < other.value->< other.value->builtin_float64 {
275              return value
276          }
277          return other.value->builtin_float64
278      }
279  
280      ===Returns the smaller (closest to negative infinity) of this number and another number.===
281      @priority(14)
282      function min(other:Int16):Real64 {
283          if value < other.value->< other.value->builtin_float64 {
284              return value
285          }
286          return other.value->builtin_float64
287      }
288  
289      ===Returns the smaller (closest to negative infinity) of this number and another number.===
290      @priority(16)
291      function min(other:Int32):Real64 {
292          if value < other.value->< other.value->builtin_float64 {
293              return value
294          }
295          return other.value->builtin_float64
296      }
297  
298      ===Returns the smaller (closest to negative infinity) of this number and another number.===
299      @priority(18)
300      function min(other:Int64):Real64 {
301          if value < other.value->< other.value->builtin_float64 {
302              return value
303          }
304          return other.value->builtin_float64
305      }
306  
307      ===Returns the smaller (closest to negative infinity) of this number and another number.===
308      @priority(20)
309      function min(other:Int):Real64 {
310          if value < other.value->< other.value->builtin_float64 {
311              return value
312          }
313          return other.value->builtin_float64
314      }
315  
316      ===Returns the smaller (closest to negative infinity) of this number and another number.===
317      @priority(11)
318      function min(other:UInt8):Real64 {
319          if value < other.value->< other.value->builtin_float64 {
320              return value
321          }
322          return other.value->builtin_float64
323      }
324  
325      ===Returns the smaller (closest to negative infinity) of this number and another number.===
326      @priority(13)
327      function min(other:UInt16):Real64 {
328          if value < other.value->< other.value->builtin_float64 {
329              return value
330          }
331          return other.value->builtin_float64
332      }
333  
334      ===Returns the smaller (closest to negative infinity) of this number and another number.===
335      @priority(15)
336      function min(other:UInt32):Real64 {
337          if value < other.value->< other.value->builtin_float64 {
338              return value
339          }
340          return other.value->builtin_float64
341      }
342  
343      ===Returns the smaller (closest to negative infinity) of this number and another number.===
344      @priority(17)
345      function min(other:UInt64):Real64 {
346          if value < other.value->< other.value->builtin_float64 {
347              return value
348          }
349          return other.value->builtin_float64
350      }
351  
352      ===Returns the smaller (closest to negative infinity) of this number and another number.===
353      @priority(19)
354      function min(other:UInt):Real64 {
355          if value < other.value->< other.value->builtin_float64 {
356              return value
357          }
358          return other.value->builtin_float64
359      }
360  
361      ===Returns the larger (closest to positive infinity) of this number and another number.===
362      @priority(12)
363      function max(other:Int8):Real64 {
364          if value > other.value->builtin_float64 {
365              return value
366          }
367          return other.value->builtin_float64
368      }
369  
370      ===Returns the larger (closest to positive infinity) of this number and another number.===
371      @priority(14)
372      function max(other:Int16):Real64 {
373          if value > other.value->builtin_float64 {
374              return value
375          }
376          return other.value->builtin_float64
377      }
378  
379      ===Returns the larger (closest to positive infinity) of this number and another number.===
380      @priority(16)
381      function max(other:Int32):Real64 {
382          if value > other.value->builtin_float64 {
383              return value
384          }
385          return other.value->builtin_float64
386      }
387  
388      ===Returns the larger (closest to positive infinity) of this number and another number.===
389      @priority(18)
390      function max(other:Int64):Real64 {
391          if value > other.value->builtin_float64 {
392              return value
393          }
394          return other.value->builtin_float64
395      }
396  
397      ===Returns the larger (closest to positive infinity) of this number and another number.===
398      @priority(20)
399      function max(other:Int):Real64 {
400          if value > other.value->builtin_float64 {
401              return value
402          }
403          return other.value->builtin_float64
404      }
405  
406      ===Returns the larger (closest to positive infinity) of this number and another number.===
407      @priority(11)
408      function max(other:UInt8):Real64 {
409          if value > other.value->builtin_float64 {
410              return value
411          }
412          return other.value->builtin_float64
413      }
414  
415      ===Returns the larger (closest to positive infinity) of this number and another number.===
416      @priority(13)
417      function max(other:UInt16):Real64 {
418          if value > other.value->builtin_float64 {
419              return value
420          }
421          return other.value->builtin_float64
422      }
423  
424      ===Returns the larger (closest to positive infinity) of this number and another number.===
425      @priority(15)
426      function max(other:UInt32):Real64 {
427          if value > other.value->builtin_float64 {
428              return value
429          }
430          return other.value->builtin_float64
431      }
432  
433      ===Returns the larger (closest to positive infinity) of this number and another number.===
434      @priority(17)
435      function max(other:UInt64):Real64 {
436          if value > other.value->builtin_float64 {
437              return value
438          }
439          return other.value->builtin_float64
440      }
441  
442      ===Returns the larger (closest to positive infinity) of this number and another number.===
443      @priority(19)
444      function max(other:UInt):Real64 {
445          if value > other.value->builtin_float64 {
446              return value
447          }
448          return other.value->builtin_float64
449      }
450  
451      ===This number rounded down (that is, in the direction of negative infinity) to the nearest integer.===
452      property floor:Real64
453      @external(frostReal64_get_floor)
454      function get_floor():Real64
455  
456      ===This number rounded up (that is, in the direction of positive infinity) to the nearest integer.===
457      property ceiling:Real64
458      @external(frostReal64_get_ceiling)
459      function get_ceiling():Real64
460  
461      ===The square root of this number.===
462      property sqrt:Real64
463      @external(frostReal64_get_sqrt)
464      function get_sqrt():Real64
465  
466      ===The trigonometric sine of this number.===
467      property sin:Real64
468      @external(frostReal64_get_sin)
469      function get_sin():Real64
470  
471      ===The trigonometric cosine of this number.===
472      property cos:Real64
473      @external(frostReal64_get_cos)
474      function get_cos():Real64
475  
476      ===The trigonometric tangent of this number.===
477      property tan:Real64
478      @external(frostReal64_get_tan)
479      function get_tan():Real64
480  
481      ===The trigonometric arcsine of this number.===
482      property asin:Real64
483      @external(frostReal64_get_asin)
484      function get_asin():Real64
485  
486      ===The trigonometric arccosine of this number.===
487      property acos:Real64
488      @external(frostReal64_get_acos)
489      function get_acos():Real64
490  
491      ===The trigonometric arctangent of this number.===
492      property atan:Real64
493      @external(frostReal64_get_atan)
494      function get_atan():Real64
495      ===
496      Returns the counterclockwise angle in radians between the X axis 
497      and the point (x, y).
498      ===
499      @class
500      @external(frostReal64_atan2)
501      function atan2(y:Real64, x:Real64):Real64
502  
503  
504      @override
505      function get_hash():Int {
506          return Int(value->builtin_int)
507      }
508  
509      ===
510      This number converted to an Int.
511  If this number cannot be exactly represented as an Int, a safety violation occurs.
512      ===
513      property asInt:Int
514      @post(@return.toReal64 = self)
515      function get_asInt():Int {
516          return Int(value->builtin_int)
517      }
518  
519      ===
520      This number converted to an Int.
521      ===
522      property toInt:Int
523      function get_toInt():Int {
524          return Int(value->builtin_int)
525      }
526  
527      ===
528      This number converted to an 8 bit signed number.
529  If this number cannot be exactly represented as an 8 bit signed number, a safety violation occurs.
530      ===
531      property asInt8:Int8
532      @post(@return.toReal64 = self)
533      function get_asInt8():Int8 {
534          return Int8(value->builtin_int8)
535      }
536  
537      ===
538      This number converted to an 8 bit signed number.
539      ===
540      property toInt8:Int8
541      function get_toInt8():Int8 {
542          return Int8(value->builtin_int8)
543      }
544  
545      ===
546      This number converted to a 16 bit signed number.
547  If this number cannot be exactly represented as a 16 bit signed number, a safety violation occurs.
548      ===
549      property asInt16:Int16
550      @post(@return.toReal64 = self)
551      function get_asInt16():Int16 {
552          return Int16(value->builtin_int16)
553      }
554  
555      ===
556      This number converted to a 16 bit signed number.
557      ===
558      property toInt16:Int16
559      function get_toInt16():Int16 {
560          return Int16(value->builtin_int16)
561      }
562  
563      ===
564      This number converted to a 32 bit signed number.
565  If this number cannot be exactly represented as a 32 bit signed number, a safety violation occurs.
566      ===
567      property asInt32:Int32
568      @post(@return.toReal64 = self)
569      function get_asInt32():Int32 {
570          return Int32(value->builtin_int32)
571      }
572  
573      ===
574      This number converted to a 32 bit signed number.
575      ===
576      property toInt32:Int32
577      function get_toInt32():Int32 {
578          return Int32(value->builtin_int32)
579      }
580  
581      ===
582      This number converted to a 64 bit signed number.
583  If this number cannot be exactly represented as a 64 bit signed number, a safety violation occurs.
584      ===
585      property asInt64:Int64
586      function get_asInt64():Int64 {
587          return Int64(value->builtin_int64)
588      }
589  
590      ===
591      This number converted to a 64 bit signed number.
592      ===
593      property toInt64:Int64
594      function get_toInt64():Int64 {
595          return Int64(value->builtin_int64)
596      }
597  
598      ===
599      This number converted to a UInt.
600  If this number cannot be exactly represented as a UInt, a safety violation occurs.
601      ===
602      property asUInt:UInt
603      @post(@return.toReal64 = self)
604      function get_asUInt():UInt {
605          return UInt(value->builtin_uint)
606      }
607  
608      ===
609      This number converted to a UInt.
610      ===
611      property toUInt:UInt
612      function get_toUInt():UInt {
613          return UInt(value->builtin_uint)
614      }
615  
616      ===
617      This number converted to an 8 bit unsigned number.
618  If this number cannot be exactly represented as an 8 bit unsigned number, a safety violation occurs.
619      ===
620      property asUInt8:UInt8
621      @post(@return.toReal64 = self)
622      function get_asUInt8():UInt8 {
623          return UInt8(value->builtin_uint8)
624      }
625  
626      ===
627      This number converted to an 8 bit unsigned number.
628      ===
629      property toUInt8:UInt8
630      function get_toUInt8():UInt8 {
631          return UInt8(value->builtin_uint8)
632      }
633  
634      ===
635      This number converted to a 16 bit unsigned number.
636  If this number cannot be exactly represented as a 16 bit unsigned number, a safety violation occurs.
637      ===
638      property asUInt16:UInt16
639      @post(@return.toReal64 = self)
640      function get_asUInt16():UInt16 {
641          return UInt16(value->builtin_uint16)
642      }
643  
644      ===
645      This number converted to a 16 bit unsigned number.
646      ===
647      property toUInt16:UInt16
648      function get_toUInt16():UInt16 {
649          return UInt16(value->builtin_uint16)
650      }
651  
652      ===
653      This number converted to a 32 bit unsigned number.
654  If this number cannot be exactly represented as a 32 bit unsigned number, a safety violation occurs.
655      ===
656      property asUInt32:UInt32
657      @post(@return.toReal64 = self)
658      function get_asUInt32():UInt32 {
659          return UInt32(value->builtin_uint32)
660      }
661  
662      ===
663      This number converted to a 32 bit unsigned number.
664      ===
665      property toUInt32:UInt32
666      function get_toUInt32():UInt32 {
667          return UInt32(value->builtin_uint32)
668      }
669  
670      ===
671      This number converted to a 64 bit unsigned number.
672  If this number cannot be exactly represented as a 64 bit unsigned number, a safety violation occurs.
673      ===
674      property asUInt64:UInt64
675      @post(@return.toReal64 = self)
676      function get_asUInt64():UInt64 {
677          return UInt64(value->builtin_uint64)
678      }
679  
680      ===
681      This number converted to a 64 bit unsigned number.
682      ===
683      property toUInt64:UInt64
684      function get_toUInt64():UInt64 {
685          return UInt64(value->builtin_uint64)
686      }
687  
688      ===
689      This number converted to a 32 bit floating point number.
690      ===
691      property asReal32:Real32
692      function get_asReal32():Real32 {
693          return Real32(value->builtin_float32)
694      }
695  
696      ===
697      This number converted to a 32 bit floating point number.
698      ===
699      property toReal32:Real32
700      function get_toReal32():Real32 {
701          return Real32(value->builtin_float32)
702      }
703  
704      ===
705      This number converted to a 64 bit floating point number.
706      ===
707      property asReal64:Real64
708      function get_asReal64():Real64 {
709          return Real64(value->builtin_float64)
710      }
711  
712      ===
713      This number converted to a 64 bit floating point number.
714      ===
715      property toReal64:Real64
716      function get_toReal64():Real64 {
717          return Real64(value->builtin_float64)
718      }
719  
720      @override
721      @external(frostReal64ToString)
722      function get_toString():String
723  
724      === Returns a formatted representation of this number. Supported format strings are `""`, `"d"`, or `"D"` for decimal, `"b"` or `"B"` for binary, `"o"` or `"O"` for octal, `"x"` for lowercase hexadecimal, and `"X"` for uppercase hexadecimal. ===
725      @override
726      function format(fmt:String):String {
727          return Frost.format(value < 0< 0, abs.toUInt64, 0xFFFFFFFFFFFFFFFF, fmt)
728      }
729  }
730