K kuosda Active Member Licensed User Longtime User Jan 18, 2017 #1 log(NumberFormat2(-0.00000001, 1, 4, 0, False)) → -0 But what I want is 0 not -0 What can I do?
Erel B4X founder Staff member Licensed User Longtime User Jan 18, 2017 #2 Are you only interested in positive values? If so then you can use: B4X: Log(NumberFormat2(Abs(value), 1, 4, 0, False)) Upvote 0
Are you only interested in positive values? If so then you can use: B4X: Log(NumberFormat2(Abs(value), 1, 4, 0, False))
K kuosda Active Member Licensed User Longtime User Jan 19, 2017 #3 log(NumberFormat2(-0.1234, 1, 4, 0, False)) → -0.1234 So you can not use abs () Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 19, 2017 #4 This is why I asked whether you are only interested in positive values. You can add this sub: B4X: Sub RemoveSignedZero(d As Double) As Double If Abs(d) < 0.00001 Then Return 0 Else Return D End SUb B4X: Log(NumberFormat2(RemoveSignedZero(your number), ...)) Upvote 0
This is why I asked whether you are only interested in positive values. You can add this sub: B4X: Sub RemoveSignedZero(d As Double) As Double If Abs(d) < 0.00001 Then Return 0 Else Return D End SUb B4X: Log(NumberFormat2(RemoveSignedZero(your number), ...))