You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by GitBox <gi...@apache.org> on 2020/09/25 07:49:52 UTC

[GitHub] [plc4x] chrisdutz commented on a change in pull request #191: Implement WriteBuffer float, double and BigInteger functions

chrisdutz commented on a change in pull request #191:
URL: https://github.com/apache/plc4x/pull/191#discussion_r494808810



##########
File path: plc4j/drivers/knxnetip/src/main/java/org/apache/plc4x/java/knxnetip/utils/KnxHelper.java
##########
@@ -46,9 +46,16 @@ public static void f16toBytes(WriteBuffer io, Object param) {
             boolean negative = value < 0;
             final int exponent = Math.getExponent(value);
             final double mantissa = value / Math.pow(2, exponent);
+            //io.writeBit(negative);
+            //io.writeInt(4, exponent);
+            //io.writeDouble(11, Math.getExponent(mantissa), mantissa); //Don't think this works BH
+
+            String mantissaString = Double.toString(mantissa);
+            int mantissaInteger = Integer.parseInt(mantissaString.substring(mantissaString.indexOf('.')));

Review comment:
       What's the String conversion for? I think in this case a simple double-to-int-cast should do the trick ....




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org