goby icon indicating copy to clipboard operation
goby copied to clipboard

VM Float API Implementation

Open Alexius-Huang opened this issue 7 years ago • 3 comments

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 (and Float#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 when n digits is more than zero.
  • [ ] Float#finite? Returns true if receiver isn't equal to Float::INFINITE
  • [ ] Float#infinite? Returns true if receiver is equal to Float::INFINITE
  • [ ] Float#divmod Returns array which is in format of [ (Integer) Quotient, (Float) Remainder ]
  • [ ] Float#nan? Returns true if receiver is equal to Float::NAN
  • [ ] Float#positive? Returns true if float number is larger than 0.0
  • [ ] Float#negative? Returns true if float number is less than 0.0
  • [ ] Float#zero? Returns true if float number is equal to 0.0
  • [ ] Float#rationalize Convert to something called Rational data type (Currently not supported but from my point of view, it is worth being addressed in this issue)

Alexius-Huang avatar Oct 27 '17 06:10 Alexius-Huang

I think modulo and quo should not be implemented would conflict with Goby's policy of no duplicate methods - @st0012 ?

64kramsystem avatar Oct 27 '17 15:10 64kramsystem

@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.

st0012 avatar Oct 28 '17 12:10 st0012

Then in this case I will cross out those two methods, thanks for the feedback

Alexius-Huang avatar Oct 30 '17 11:10 Alexius-Huang