Questions tagged as 'decimal'

3
answers

What are Decimal, Hexadecimal and Octal notation numbers?

What are Decimal (base 10), Hexadecimal (base 16), and Octal (base 8) notation numbers? In the book the code looks like this: <?php // numero decimal $a = 1234; // numero octal (equivalente a 83 em decimal) $a = 0123;...
asked by 22.01.2015 / 13:53
3
answers

What is the difference between "decimal.Divide" and the traditional "/" in C #?

decimal a = 10/5; Returns 2 decimal b = decimal.Divide(10,5); Returns 2     
asked by 26.04.2016 / 23:45
2
answers

Dividing 1/2 in C #

In some videos in numberphile on the Zeno's Paradox the teacher of the video tried to explain how this paradox worked using the hands to beat palamas (I'm not sure how to explain this but I'll leave the video there in question, please watch...
asked by 15.01.2015 / 14:38
2
answers

Display decimal places (Currency) is rounding

I have an application where the price should go in int format without decimals. int Valor = (int)(produto.Valor * 100); //o produto.Valor é um decimal The problem is when I want to display this value in View For products like 0....
asked by 12.04.2016 / 18:41
6
answers

Calculate the rest of a division of decimal numbers in JavaScript

I'm working with values ( decimal(18,2) ) of a sale where the sum of the price of the products should turn into a certain number of parcels. So that I can divide the total of the products exactly for the parcels, I also have to calculate t...
asked by 08.01.2016 / 14:08
2
answers

BigDecimal Comparison Returns Unexpected Result

In one of my methods I make the following comparison, as in the example below: public static void main(String[] args) { BigDecimal valor = new BigDecimal("100"); exemplo(valor); } public static void exemplo(BigDecimal valor) { i...
asked by 27.03.2016 / 01:09
2
answers

Get the number of decimal places of a decimal

How can I get the number of decimal places of a decimal variable? Eg: If I receive the number:    4.5 - should return 1   5.65 - should return 2   6.997 - should return 3 I know you can do this by converting to string...
asked by 05.10.2015 / 19:49
1
answer

Decimal places c #

I have a variable of decimal type returning me the value 270.61864847349717630804948048 how do I return with only 3 houses after the comma, in case I pass 270.618 only. Thank you in advance     
asked by 12.04.2018 / 20:41
1
answer

Why suppress zero before the decimal point, as in 0.5 == .5?

Sometimes I see a code in which the programmer has written a non-zero decimal, such as 0.5 being .5 , for example: var decimal1 = 0.5; var decimal2 = .5; console.log(decimal1 == decimal2); console.log(decimal1, decimal2);...
asked by 17.07.2018 / 15:15
1
answer

I get different results when I convert from Character to Decimal in PHP and Java

When I convert á to decimal I get the result 225 with this code in Java: public static int charToDec(String text){return (int) text.charAt(0);} When I convert á to decimal I get the result 195 with this code in P...
asked by 29.07.2017 / 23:16