Questions tagged [math.round]

21 questions
0
votes
0 answers

c# asp.net MVC adding string values with rounding

I have a C# application with the following code: foreach(var record in localFundData) { sendData.TotalPlanAssets += Math.Round(double.Parse(record.FPCR_Fund_Value),2); if (record.FPCR_Ref_Fund == localLoanFund) …
Jonathan Small
  • 1,027
  • 3
  • 18
  • 40
0
votes
0 answers

round off numbers and math round method

when use Java NetBeans double purchase = 19.93; double payment = 20.00; double change = payment - purchase; System.out.println(change); the result is : 0.07000000000000028 when I use Math.round method I got result "0" zero! I don't want zero I want…
0
votes
2 answers

vb.net Math.Round drops last 0 in price?

I am using a Math.Round function in my program as follows Math.Round((ProductWeightByType * 4.18), 2) This works perfect except for when the last character is already a 0 then it drops that 0 so example $1.70 becomes $1.7 How do i fix this?
LabRat
  • 1,996
  • 11
  • 56
  • 91
-1
votes
2 answers

JS, Why Math.Round takes 2 Arguments

Inside one JS file I saw: Math.round(timeEngine.timeLeft, 10) I've checked many documentations (some are mentioned here) and all mention that this function takes one argument, so what the second argument (10) is referring…
Maor
  • 1
-2
votes
1 answer

How to add Math.round to .map

data.map(item => item.Points = item.Points / item.Games); so i am pulling this data from an api then i am dividing the 2 numbers and i want to round it to the nearest first decimal after because it comes out as 27.77777777 i want it to just be 27.8
-3
votes
1 answer

Why does Math.Round give me two different values?

class Program { static void Main(string[] args) { double d = 120.5; Console.WriteLine(Math.Round(120.5)); //121 Console.WriteLine(Math.Round(d)); // 120 } } When a variable is passed as an argument into Math.Round it…
Ah Boy
  • 17
  • 3
1
2