Skip to content

MaxMath v1.2.0

Compare
Choose a tag to compare
@MrUnbelievable92 MrUnbelievable92 released this 07 Jan 05:48

Known Issues

  • half8 "==" and "!=" operators don't conform to the IEEE 754 standard - Unity has not yet reacted to my bug-report in regards to their "half" implementation.

Fixes

  • Added preliminary safety cast to a float of the half value in toboolsafe() until Unity fixes their half '==' and '!=' operators according to IEEE 754

Additions

"quarter" precision floats and vectors

  • "quarter" is an 8-bit IEEE 754 1.3.4.-3 floating point value, often called a "minifloat"
  • It has a very limited range of [-15.5, 15.5] with an epsilon of 0.015625. All integers, aswell as i + 0.5, within that range can be represented as a quarter
  • Type conversion from - and to quarters also conforms to the IEEE 754 standard. In detail, casting to a quarter performs rounding according to a) its' precision and b) whether or not the more precise value is closer to 0 or to quarter.Epsilon. NaN and +/- zero preservation, aswell as preservation of/clamping to +/- infintiy was also implemented
  • "==" and "!=" operators for vectors conforming to the IEEE 754 standard were implemented (unlike, currently, Unity's "half" type). All the other boolean- and arithmetic operators were implemented for the base type only, which will return single precision results (for arithmetic operations). For vectors, quarter vectors are to be (implicitly) cast to single precision vectors first, until/if Unity changes their "half" implementation.
  • Type conversions from - and to all other single value and vector types were implemented
  • Full function implementation within the library was added, including: abs(), isnan(), isinf(), isfinite(), select(), as[s]byte/asquarter(), vrol/r(), vshl/r(), toboolsafe and toquartersafe

Fixed Oversights

  • Added missing type conversions from - and to half8 for (s)byte8, (u)short8 and (u)int8 vectors

  • Added missing type conversions from - and to half8 for booleans and boolean vectors

  • Added half "select" functions

  • Improved the performance of unsafe boolean-to-half/float/double functions

  • added (preliminary?) "abs", "isnan", "isinf" and "isfinite" for half and half vectors, eliminating unnecessary casting