goby
goby copied to clipboard
VM Float API Implementation
Referenced from the Ruby Ver. 2.4.1. Float data type API:
- [ ] Constant
Float::INFINITE
stands for the number is infinite - [ ] Constant
Float::NAN
stands for "Not a Number"
~~Float#modulo
Synonym to the %
operator (Get the quotient from the divide operation)~~
~~Float#quo
Synonym to the /
operator (Get the quotient from the divide operation)~~
- [ ]
Float#abs
Return positive number of the float. "Formally as the distance between 0 to the number of the float in 1-dimensional axis ..." - [ ]
Float#angle
(andFloat#arg
) If positive -> return 0; else -> return PI - [ ]
Float#ceil
Returns smallest number greater than or equal to the receiver - [ ]
Float#floor
Returns largest number smaller than or equal to the receiver - [ ]
Float#round
Rounds float to a given precision in decimal digits (default 0 digits). Precision may be negative. Returns a floating point number whenn
digits is more than zero. - [ ]
Float#finite?
Returnstrue
if receiver isn't equal toFloat::INFINITE
- [ ]
Float#infinite?
Returnstrue
if receiver is equal toFloat::INFINITE
- [ ]
Float#divmod
Returns array which is in format of [ (Integer) Quotient, (Float) Remainder ] - [ ]
Float#nan?
Returnstrue
if receiver is equal toFloat::NAN
- [ ]
Float#positive?
Returnstrue
if float number is larger than0.0
- [ ]
Float#negative?
Returnstrue
if float number is less than0.0
- [ ]
Float#zero?
Returnstrue
if float number is equal to0.0
- [ ]
Float#rationalize
Convert to something calledRational
data type (Currently not supported but from my point of view, it is worth being addressed in this issue)
I think modulo
and quo
should not be implemented would conflict with Goby's policy of no duplicate methods - @st0012 ?
@saveriomiroddi @Maxwell-Alexius I have tested with some float numbers and seems like modulo
and quo
are really just alias methods. If so then we shouldn't support them.
Then in this case I will cross out those two methods, thanks for the feedback