Skip to main content

Questions tagged [rounding]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
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 ...
Teach Suppors's user avatar
-2 votes
3 answers
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 ...
Alexia Ribeiro's user avatar
0 votes
3 answers
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 ...
Abhishek Kumar's user avatar
-2 votes
1 answer
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 ...
Phuc's user avatar
  • 125
1 vote
2 answers
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 ...
Irene's user avatar
  • 1,849
1 vote
1 answer
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 ...
Divya's user avatar
  • 91
0 votes
2 answers
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 =...
bafuda's user avatar
  • 757
1 vote
2 answers
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 ...
Andrew Sean Baldwin's user avatar
1 vote
3 answers
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 ...
Pramit's user avatar
  • 43
1 vote
1 answer
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)?
Sarah Bezi's user avatar
1 vote
1 answer
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 ...
Luke Harrison's user avatar
1 vote
1 answer
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 ...
Sam's user avatar
  • 93
3 votes
2 answers
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 ...
adm's user avatar
  • 33
0 votes
1 answer
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....
kitokid's user avatar
  • 1,738
7 votes
2 answers
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 ...
Jose Chama's user avatar
7 votes
1 answer
1k views

The Do's and Don'ts of currency calculations in Apex

Ok, I am not a math expert, but I know about the basics of rounding problematics in programming languages. In one of my apps, I do some quite complex (math-wise and infrastructure -wise) currency ...
Robert Sösemann's user avatar