How to avoid rounding off large Double values?
For converting from String to Double, consider a piece of code as below:
String str = "999999999999999.99999";
Double d = Double.valueOf( str );In this case, d will contain the value 1E15 and not 999999999999999.99999.
Is there any way by which we can avoid this rounding off?
TIA,
Ninad.
> String str = "999999999999999.99999";Note that you have a total of 20 decimal digits here.
A double only has 53 bits to represent the mantissa
so it can only accurately represent about 16 decimal digits.
Similar Messages
-
Rounding off net weight value.
Hi experts,
I want to round off the quantity value to the next integer value.
I am using the FM 'J_1I6_ROUND_TO_NEAREST_AMT' as follows...
call function 'J_1I6_ROUND_TO_NEAREST_AMT'
exporting
i_amount = gross_weight
i_amount1 = net_weight
importing
e_amount = gross_weight
e_amount1 = net_weight.
i want to round off the gross weight and net weight values.
In Global definitions, these are given as of type VEKP-BRGEW. The field BRGEW is of datatype QUAN (length - 15 and decimal -3 )
But when i tried executing i am getting dump .... saying
"The function module interface allows you to specify only
fields of a particular type under "I_AMOUNT".
The field "GROSS_WEIGHT" specified here is a different field type"
Please help me solve this and please let me know how to round off these fields.
Regards
AmmuHi,
the both fm parameters you fill have a currency data element of length 13, while you pass a quantity data element of length 15.
You can't use this fm for your fields.
Regards,
Klaus -
How to use Round off function in TAX Formula
Dear All,
I have to do Round off in the Tax Formula. Hence I was suggested by the SAP Forum Team to use Round off function in the Tax Formulae.
But sir I don't know how to use Round off function in the Tax Formulae.
For Eg. BaseAmt = Total
TaxAmt = BaseAmt * Rate
Now within this Eg. How will i use the Round off function and where i will use it.
Please guide me with example.
Regards
Hitesh ParsawalaHi Hitesh,
you can do like this
Cess_ST_TaxAmt=Round(Cess_ST_BaseAmt*Cess_ST_Rate,0)
where you can introduce rounding function by choosing from dropdown available in Operation and by click on Insert.
It will post following in formulla window
Round (Number, Decimals as Number)
where in parameter you have to give 1.Number-which is to be round and 2.Decimals as Number-as per your requirement like by 2 decimal or 0 decimal
If required give me call,
BR
Samir Gandhi -
How to avoid the Amount and Date values for VOID Cheques
Hi All,
I had created a two window i.e For Amount and Date. If I process the cheque the Amount value and Date should not trigger for VOID CHEQUES.
Can any one tel me how to avoid the Amount and Date values for VOID Cheques
Your help will be greatly appreciated.
Regards
YathishHi,
I dont know which tablel you are referring to, is it PAYR table and the field VOIDR?
If a cheque is voided, it would have a reason and it is stored in VOIDR field of this PAYR table.
Check if the field VOIDR is filled, if it is filled, do not print the amount and date.
Regards
Subramanian -
Not clear with the statement ( A large double value with redundant D )
Hi,
I am not clear about the statment below. What does redundant D means.
*123.4E+306D// A large double value with redundant D*By default any floating-point literal in Java is a double, so the trailing D that specifies that explicitly is redundant.
-
How to achieve round off value in SAP?
here I have given my Query ..I need to calculate rounding off value for this query..
SELECT (CAST($[OBTN.U_Length] AS FLOAT)/CAST($[OBTN.U_Width] as FLOAT) *($[BTNT.Quantity]))Hi Karthick,
I am not sure wheter I understood you, but are you searching for
SELECT FLOOR((CAST($[OBTN.U_Length] AS FLOAT)/CAST($[OBTN.U_Width] as FLOAT) *($[BTNT.Quantity])))
regards,
Maik -
Rounding Off to lower value!
Dear Experts,
Currently am calculating some values, and it returns me the results as such:
If the calculated value is 6.85714, then by default the output value in my integer type variable is 7.
Now, whenever the output results in 6.xxx, even if it is 6.9999 then i want it to round off to 6.
How is it possible?
Please advice!
Regards,
Sundar.Hi
Handle it like this,,,
CLEAR : l_f_kbetr4 , l_f_kbetr5 .
l_f_kbetr4 = l_F_kbetr1 - l_f_kbetr3 .
CHECK = FRAC( l_f_kbetr4 ) .
IF CHECK GE '0.50' .
l_f_kbetr4 = CEIL( l_f_kbetr4 ) .
ELSE .
l_f_kbetr4 = FLOOR( l_f_kbetr4 ) .
ENDIF.
l_f_kbetr5 = l_f_kbetr4 .
Hope it helps.
Praveen -
Problem in Routine after rounding off the condition value
Dear all,
I have attached the routine for rounding off value for condition value for T.Code va02. Routine is working fine but the problem is after the execution of routine it goes in some standard program LV61AA55 where again the rounded value gets changed . Maximum points will be allocated ..
Thanks anr RegardsFORM FRM_KONDI_WERT_925.
*{ INSERT D01K911062 2
data : wa_xkomv like xkomv,
v_kwert like xkomv-kwert,
W_INDEX TYPE SY-TABIX.
read table xkomv into wa_xkomv with key kschl = 'JIN6'.
W_INDEX = SY-TABIX.
v_kwert = 1 * wa_xkomv-kwert / 100.
V_KWERT = WA_XKOMV-KWERT.
read table xkomv with key kschl = 'JHSC'.
CALL FUNCTION 'J_1I6_ROUND_TO_NEAREST_AMT'
EXPORTING
I_AMOUNT = v_kwert
I_AMOUNT1 =
I_AMOUNT2 =
I_AMOUNT3 =
I_AMOUNT4 =
I_AMOUNT5 =
I_EXADDTAX1_AMOUNT =
I_EXADDTAX2_AMOUNT =
I_EXADDTAX3_AMOUNT =
IMPORTING
E_AMOUNT = v_kwert
E_AMOUNT1 =
E_AMOUNT2 =
E_AMOUNT3 =
E_AMOUNT4 =
E_AMOUNT5 =
E_EXADDTAX1_AMOUNT =
E_EXADDTAX2_AMOUNT =
E_EXADDTAX3_AMOUNT =
xkomv-kwert = v_kwert.
xkwert = v_kwert.
modify xkomv INDEX W_INDEX transporting kwert.
*} INSERT
ENDFORM. -
How to avoid turning off the iPhone when its locked.
Hiya,
Wondering if there is any settings to avoid turing off the iPhone when its locked. When the phone is locked with passcode holding the power button on the top provides the option to turn off the phone. So is there any way to restrict it?
Thanks,
SaNNo.
-
How to avoid round of the value in mapping
Hi!
I am trying to pass in mapping value 999999.999, but XI rounds it to 1000000.
How can I avoid this?
I tried to change types of field in Data Type: string, float, same problem.
Any help appreciated.Hi,
try using this function in message mapping
FormatNum
Converts I according to a pattern that you define using the function properties. The possible patterns are the same as in the Java class java.text.DecimalFormat.
Regards,
Kai -
How to get round off values in key figures
Hi,
My report has key figure which is showing as 6.64033 and I want it to be 6.64.
If it is showing 6.64677 I would like to be shown as 6.65.
Please suggest.
Thanks...Why don't you try this. In the Query Designer, set your key figure properties as follow:
Display Tab > Number of Decimal Places > 0.00 -
Rounding off Issue (Net Value not equal to Net Price * quantity)
Dear Gurus,
Here is an interesting issue.The default calculation done in the pricing procedure is two decimal places.Now we consider a real scneario,consider the net value of 324 quantities of an item calculated is 36,049.86 .When it is divided by quantity the resulting value of net price is 111.265 but the system shows 111.27 by rounding it off.
Now here comes the problem,my client needs the rate to be shown on the order script to be two decimal places and the net value should be equal quantity * net price.So if we apply this,
324 * 111.27 = 36051.48
But the net value calculated by the system is 36,049.86.So it can be consluded that:
"Quantity * Net Price Shown is not Equal to Net Value calculated by the System"
Need an urgent resolution,project is stuck on this
Regards,
Sam Ahmed
Edited by: Lakshmipathi on Nov 3, 2011 12:14 PM
Please dont add URGENT in subject or in your postHere is the pricing procedure,
We start with the amount condition types
Unit Price Units Condition Value
ZMRP MRP 1,700.00 10 PAC 55,080.00
ZTRP Trade Price 1,445.00 10 PAC 46,818.00
ZDPR Dist. Price 1,445.00 10 PAC 46,818.00 (GL)
Using Trade Price we apply the product discount of 23%
ZPRD Product Discount 23.000- % 10,768.14-
Then we send discount amount to the gl by using condition type ZDIS
ZDIS Discount Value 100.000- % 10,768.14- (GL)
tHE RESULTING NET VALUE IS 36,049.86 as 46818.00 - 10,768.14
Order Item value 111.27 1 PAC 36,049.86
And the Net Price is 111.27 -
So I have the iphone 4 with the latests update ios7.
So I went on settings > general > accessibility > larger type.
And I clicked "on" for "larger dynamic type"
Now my font is so big I can't even see apps that I have and such
I want to turn it "off" but my screen orientation is locked! (I can't move my phone horizontally) I think if I can move my phone horizontally I'll be able to see the on/off button for larger dynamic type.
I tried sliding the bottom upwards to turn off screen lock orientation but it's not on my screen because my font is set to a really big size that the "screen orientation lock button" didn't make it to the screenTurning on Dynamic type and increasing it shold not have that effect.
Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps BEFORE doing the reset. -
Rounding off to nearest value with formatNumber
Can I use the formatNumber tag to round my numeric value to the nearest value?
Like if it's 15.7 I would like to display 16
And if it's 15.2, I would like to display 15
I could successfully truncate by giving a patteren but Im not sure if I can round it off.
Regards,
LeenaYes you can - the following works on JSTL 1.1 / Tomcat 5.5 :
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head><title></title></head>
<body>
Test Auto Rounding of 16.8 :
<fmt:formatNumber value="16.88" pattern="##"/>
<br/><br/>
Test Auto Rounding of 16.2 :
<fmt:formatNumber value="16.22" pattern="##"/>
</body>
</html>Message was edited by:
appy77 -
How to avoid rounding of plotted data?
Hello
In my program I have an array of 3 data clusters {XY} to plot. The data of the first two clusters has one precision, and of the third another. For the last cluster I've create second axis, but when I assign last plot to this axis I see rounded data according to first axis increment. I think rounding takes a place when I plot all data with the first active axis. How can I avoid this rounding and keep my data precision?This could be happening in any of a number of places. Please post your code (or a fragment or screenshot thereof) and we will try to help you.
This account is no longer active. Contact ShadesOfGray for current posts and information.
Maybe you are looking for
-
MacBook Pro with external display sometimes
I want to use my MacBook Pro with my external display (Apple 23 inch Cinema) when I'm at my office, and to have Spaces set up and optimized for that. When I'm at home or on the road, I want Spaces set up differently, optimized for the MacBook Pro dis
-
I am using Windows XP, & I am running Mozilla Firefox 3.6.16 and keep getting a "Microsoft Feed Synchronization has encountered a problem and needs to close" message.
-
Problem in Uploading Excel Data ! - Urgent
Dear Experts, I am uploading excel data using FM 'TEXT_CONVERT_XLS_TO_SAP' , its directly convert data and store in internal table same as in excel sheet(row , column wise). But the problem is , one of the column having description more then 500 char
-
How to use External Routing in Human Task
Hi, Could you please help me knowing how to create External Routing in Human Task in SOA Composite. Thanks
-
How to deploy an WCF OData Service in windows azure
I am having a WCF OData service in visual studio which i need to deploy in windows azure for accessing in IPad app. thanks in advance