# Questions tagged [rounding]

The tag has no usage guidance.

16 questions
Filter by
Sorted by
Tagged with
1 vote
165 views

### Rounding formula in Omnistudio Dataraptors

I am currently new to Omnistudio and I am using it to do document generation. I am extracting data from the Invoice Object and Invoice Lines Object to create an Invoice PDF. I have a problem ...
455 views

### How to round 21.87499999999994 to 21.88?

I know this is very specific but is just an example, I already tried: Math.round(Math.round(num + "e+2") + "e-2").toFixed(2, 3, 4..) Math.trunc Math.pow.. But nothing works.. How ...
210 views

### Formula field subtraction returning 0.01 instead of 0 with Currency fields

I have two fields on Opportunity: FieldA and FieldB. FieldA is a formula field of type Currency with 2 decimal places. FieldB is a currency field also with two decimal places. Let's assume the value ...
4k views

### rounding to closest integer in Apex

Will someone help me with understanding rounding within Apex? Why when I have a value like 96.7 using Integer result = Math.Floor(96.7) round to 96? I am doing calculation and I need to round up or ...
• 125
1 vote
2k views

### How do I round up a Decimal to the nearest 1000 in Apex code?

I have a Visualforce PDF page with decimal values in it and these need to be rounded to the nearest 1000.00. If I do decimal x = Math.round(x) it just takes it to the nearest value on the left. Eg I ...
• 1,849
1 vote
2k views

### Get full length decimal value of a managed field with decimal places set to 2

I have a Managed field Number(16, 2) of which number of decimal places cannot be edited. For Example, if I enter 1.2391276549 into that field, It is displayed as 1.24 (as we know that salesforce ...
• 91
289 views

### How To Predict Loss Of Precision For Decimal Operations?

How can I predict loss of precision for decimal operations? For example in the below calculation the result is off by .00000000000002 Should I be rounding after each decimal operation? Decimal d1 =...
• 757
1 vote
1k views

### Rounding of hours to the nearest .25 , .50, .70 and 1 hour

Hello if anyone can help me solve this. I am trying to create a process builder that rounds off decimals to the nearest .25 , .50, .70 and 1 hour. For instance a user would log time at .23 then it ...
1 vote
11k views

### Round off an apex variable upto two decimal places

I have apex variable in my visualforce page, which is calculated as below - <apex:variable var="cntFinal" value="{!IF(cntVar1==0,0,(cntVar2+cntVar3)*100/cntVar1)}"/> Now, I want to set this ...
• 43
1 vote
3k views

### Round a number with AMPscript

The output for quantity field: %%=v(@Quantity__c)=%% is a decimal number (2.0 for example), how can I round this value with AMPscript to be just (2)?
1 vote
416 views

### Format and multiply a number without rounding

So I have %%=FormatCurrency( Multiply(@365,339.00,1.5),"en-US",0,"\$" )=%% Which returns \$548,009 The issue with this is that it's rounded the .50 so it now ends in 9 not 8. I've been working on ...
1 vote
633 views

### Help in Formula

I have a currency formula field called USD Total where the Amount is multiplied by GBP exchange rate. USD TOTAL = Amount * 1.22 I'm trying to create a formula where: I can add "USD" prefix AND The ...
• 93
202 views

### Is there any way to maintain a Decimal scale property without rounding for every operation?

Is there a way to maintain the scale of a Decimal across multiple operations? I thought setScale appears to be a normal set method on the Decimal class. Meaning that you can set the scale, and then ...
• 33
2k views

### Ceiling Decimal in apex

I want to get the nearest ceiling for the decimal value. For 1268.0 => I want to get 1300. For 2537.0 => I want to get 2500. It would be like Excel function. I used value.round(roundingMode....
• 1,738
3k views

### Rounding a Formula Field

I have a formula field that is returns a currency and is set to 2 decimals. It displays fine, but when I access the field through the API it returns 6 decimals. 12.493587 should round to 12.49 ...
• 307