Author Topic: Does O2 has an integer function ?  (Read 1225 times)

0 Members and 1 Guest are viewing this topic.

Offline Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
    • Charles Pegge
Re: Does O2 has an integer function ?
« Reply #15 on: May 17, 2018, 03:04:00 PM »
In OxygenBasic, all numeric values are passed on the 80bit FPU stack for conversion to Ascii Decimal. It is currently configured to cut off at 17 digits precision, independent of the decimal point position.

in 32bit mode, Extended values can be passed to functions directly, and occupy 12 bytes on the stack. However, in 64bit mode, this is currently not allowed, and the values must be passed by reference.

I doubt that NASA would require any outputs above single precision, since, in the real world, physical factors at every level, such as multiple gravitational fields, and thermal expansion would out-scale it.
« Last Edit: May 17, 2018, 03:18:08 PM by Charles Pegge »

Offline Mike Lobanovsky

  • Jr. Member
  • **
  • Posts: 93
Re: Does O2 has an integer function ?
« Reply #16 on: May 17, 2018, 06:00:49 PM »
Lisp and its descendants support the notion of precise and imprecise numbers. Floating-point whole numbers and decimal fractions are imprecise while whole integers and common fractions are precise. The n/d common fraction format allows any number to be represented with absolute precision, and it also allows any mathematical operation to be performed (separately on the fraction numerator and denominator) without intermediate conversions and thus without loss in absolute precision.

I'd say half-float precision (that's 3 places after decimal point) is sufficient to describe the real world phenomena decently enough. At least most contemporary game consoles where all the GPU cores support half-float calc natively, are pretty good at rendering animated 3D objects with picture perfect quality and stunning natural looking lighting and physics.

NASA and DoD were mentioned not so much in relation to precision but more from the perspective of reliability and consistency of the language, and the adequacy and self-discipline of its creators.


(IIRC, MASM supports REAL10 and TBYTE descriptors to directly define the 80-bit floating-point precision type and storage size, respectively, and thus doesn't waste a byte of its resources)
« Last Edit: May 17, 2018, 06:28:46 PM by Mike Lobanovsky »
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)