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