[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-14 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16049054#comment-16049054
 ] 

Bruno P. Kinoshita commented on NUMBERS-43:
---

>Here I suggest to remove a utility which has no identified usage (cf. "Commons 
>Math" codebase).

Ack

>Are the float methods defined in Precision helpful tools for those 
>manipulations? In the affirmative, we must keep them. If not, why bother (in 
>v1.0)?

Makes sense.

>What about
>
>Perform the crusade (limited to the yet unreleased "Numbers"...)
>Make a note about it in the "ANNOUNCE" message and in the "RELEASE NOTES"
>
> Then, depending on the feedback, we can go forward with what the user 
> community really needs/wants.

In that case I'm +0 for removing it :-) should any user with a valid argument 
suggests adding the method, we can just proceed and add it then.

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-14 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16049050#comment-16049050
 ] 

Gilles commented on NUMBERS-43:
---

This issue came about because FindBugs signals a problem in the 
{{roundUnscaled}} method.
Amey wanted to implement FindBugs' suggestion, although a comment says that the 
statement is _intentional_.
I don't have the time to try and understand (with additional unit tests and 
benchmarks) whether this is OK or not, even less to figure out where the method 
would still be required/useful.

My proposal is to remove anything and everything that creates (or will create) 
trouble for no reason.
If necessary, this page is tracking history and the code can be recovered from 
the source repository, to be added in 1.x if actual use-cases appear.

Bruno, the discussion you refer to is interesting but beside the point: there, 
they discuss something (the {{float}} type) *used* by libraries, that obviously 
wouldn't work anymore if it were removed from the language. Here I suggest to 
remove a utility which has *no* identified usage (cf. "Commons Math" codebase).

Avoiding creating {{double}} could be a valid argument; but does it mean that 
we intend to actively support {{float}} manipulations, e.g. have classes like 
{{Complex}} provide {{float}} accuracy?  I don't think so; so we'd have a few 
methods which we won't ever remove, even though nobody will ever use them. :(

Passing data to and from a GPU is an interesting use-case (IIRC, Eric Barnhill 
intended to provide some support in the {{o.a.c.numbers.complex}} package). Are 
the {{float}} methods defined in {{Precision}} helpful tools for those 
manipulations? In the affirmative, we must keep them. If not, why bother (in 
v1.0)?


What about 
# Perform the crusade (limited to the yet unreleased "Numbers"...) ;)
# Make a note about it in the "ANNOUNCE" message and in the "RELEASE NOTES"

?

Then, depending on the feedback, we can go forward with what the user community 
really needs/wants.


> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-14 Thread Emmanuel Bourg (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048795#comment-16048795
 ] 

Emmanuel Bourg commented on NUMBERS-43:
---

I also think we should keep the method, we aren't on a crusade to deprecate 
floats in all our components anyway. floats are still there and we don't know 
how people are using them.

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048519#comment-16048519
 ] 

Bruno P. Kinoshita commented on NUMBERS-43:
---

>(in these times where memory is not a scarce resources anymore)?

I think only when performance is an issue, users will want to have methods like 
this available. This 
[thread|https://softwareengineering.stackexchange.com/questions/316822/why-are-floats-still-part-of-the-java-language-when-doubles-are-mostly-recommend]
 for instance contains several examples of why float is still included in the 
JVM. From what I could tell, all the replies are about performance (memory, 
CPU).

I'm -0 to removing the method. I think the cost to maintain it is low, and 
while not really useful most of the times, there could be cases where users 
running code in embedded hardware or - who knows - GPU's would prefer to keep 
the data as float, and avoid creating doubles if necessary.

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048390#comment-16048390
 ] 

Gilles commented on NUMBERS-43:
---

{{roundUnscaled}} is only used by the {{round(float)}} implementation; 
{{round(double)}} delegates to {{BigDecimal}}...

No need to deprecate since there hasn't been any release yet.


> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048329#comment-16048329
 ] 

Amey Jadiye commented on NUMBERS-43:


here.
{code}
 public static float round(float x, int scale, int roundingMethod) {
final float sign = Math.copySign(1f, x);
final float factor = (float) Math.pow(10.0f, scale) * sign;
return (float) roundUnscaled(x * factor, sign, roundingMethod) / 
factor; // its calling method which return double.
}

{code}

bq. The point here is rather whether anyone would be using {{float}}s for 
computations nowadays.

I think now people are using BigDecimal rather than float and double to _(at 
least in finance)_, so should be good to deprecate at this point or completely 
remove, your call.

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048313#comment-16048313
 ] 

Gilles commented on NUMBERS-43:
---

bq. just saw the code and at some point its anyway calling method which return 
double

Hmm, I don't think so; the implementations for {{double}} and {{float}} are 
segregated. Otherwise (IIUC), the semantics of rounding would not be preserved. 
 The point here is rather whether anyone would be using {{float}}s for 
computations nowadays.

Finance is a domain where rounding must be controlled, but is a {{round}} 
method enough to satisfy the constraints of that field?

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048297#comment-16048297
 ] 

Amey Jadiye commented on NUMBERS-43:


Ah, didn't know we have overloaded method for same, just saw the code and at 
some point its anyway calling method which return double typecasting to float, 
+1 to remove this method also its siblings.

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048291#comment-16048291
 ] 

Gilles commented on NUMBERS-43:
---

bq. we might want to round of numbers at certain lengths

Methods that round a {{double}} value will still be available:
{code:java}
public static double round(double x, int scale, int roundingMethod) { /* ... */ 
}
{code}

Which kind of applications would require the {{float}} version rather than the 
{{double}} one?


> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (NUMBERS-43) Remove "round(float)" methods?

2017-06-13 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/NUMBERS-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048123#comment-16048123
 ] 

Amey Jadiye commented on NUMBERS-43:


In financial institutes sometimes we might want to round of numbers at certain 
lengths of number so i think we should keep it.

> Remove "round(float)" methods?
> --
>
> Key: NUMBERS-43
> URL: https://issues.apache.org/jira/browse/NUMBERS-43
> Project: Commons Numbers
>  Issue Type: Wish
>Reporter: Gilles
>  Labels: api, float
> Fix For: 1.0
>
>
> In class {{Precision}}, there are methods for rounding {{float}} values, e.g.
> {code:java}
> public static float round(float x, int scale, int roundingMethod) { /* ... */ 
> }
> {code}
> Is there any use for supporting specific handling of floats (in these times 
> where memory is not a scarce resources anymore)?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)