flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-7161) Fix misusage of Double.MIN_VALUE and Float.MIN_VALUE
Date Thu, 13 Jul 2017 01:18:00 GMT

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

ASF GitHub Bot commented on FLINK-7161:
---------------------------------------

Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4305#discussion_r127109325
  
    --- Diff: flink-core/src/main/java/org/apache/flink/configuration/Configuration.java ---
    @@ -843,11 +843,14 @@ private float convertToFloat(Object o, float defaultValue) {
     		}
     		else if (o.getClass() == Double.class) {
     			double value = ((Double) o);
    -			if (value <= Float.MAX_VALUE && value >= Float.MIN_VALUE) {
    -				return (float) value;
    -			} else {
    +			if (value < -Float.MAX_VALUE
    --- End diff --
    
    I stand corrected. Why not use three checks instead of four (five comparisons instead
of six) with the additional equality check with `0`?


> Fix misusage of Double.MIN_VALUE and Float.MIN_VALUE
> ----------------------------------------------------
>
>                 Key: FLINK-7161
>                 URL: https://issues.apache.org/jira/browse/FLINK-7161
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>            Reporter: Kurt Young
>            Assignee: Kurt Young
>
> In FloatSummaryAggregator and DoubleSummaryAggregator, we used Float.MIN_VALUE and Double.MIN_VALUE
to be the initial values when doing max aggregation which is wrong.



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

Mime
View raw message