ryu icon indicating copy to clipboard operation
ryu copied to clipboard

Java: Decimal places and other feature requests

Open ghost opened this issue 5 years ago • 0 comments
trafficstars

Feature request to add a parameter that can control the number of decimal places returned. For example:

  • doubleToString( -0.331678f, 2 ) returns "-0.33".
  • doubleToString( -0.331678f, 5 ) returns "-0.33167".

Perhaps something like:

    index = min( index,
                 abs( index - (olength - (vplength + e10)) + decimals ) );
    return new String( result, 0, index );

Not sure about the feasibility of the next requests:

  • A version that always rounds (to remove the enum and eliminate the extra parameter).
  • A version without scientific notation (to eliminate a conditional statement).

ghost avatar Sep 07 '20 17:09 ghost