Most voted "decimal" questions
54 questions
Sort by count of
-
46
votes2
answers45560
viewsWhat is the correct way to use the float, double and decimal types?
Since college I can’t understand the real difference between the type DOUBLE and FLOAT, I ended up meeting the guy DECIMAL which also treats real values. About the type DECIMAL, found the following…
characteristic-language float language-independent decimal doubleasked 7 years, 5 months ago Marconi 17,287 -
13
votes3
answers4364
viewsWhat 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 is like this: <?php // numero decimal $a = 1234; // numero octal (equivalente a 83 em…
hexadecimal decimal numerical-representation octalasked 9 years, 11 months ago João Paulo Vieira da Silva 1,933 -
10
votes3
answers821
viewsWhat 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
-
7
votes1
answer521
viewsHow to correctly multiply the decimal type in C#?
I’m multiplying monetary values in C#, and for that I’m using the type decimal to store these values. I have noticed that in it there is a method called Multiply(), which receives two values and…
-
6
votes2
answers348
viewsRoot with Bigdecimal
I’m racking my brain to turn a root into a code. I know it works kind of like this: Math.pow(625, (1.0/4)) = raiz 4ª de 625 = 5 My headache is that my dice are BigDecimals Sting prazoIn =…
-
5
votes2
answers552
viewsDividing 1/2 in C#
In some videos on numberphile about the Zeno’s Paradox the teacher of the video tried to explain how this paradox worked using hands to hit Palamas (I do not know how to explain this but I will…
-
5
votes1
answer3181
viewsDecimal 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 pass 270.618 only. Thanks in advance…
-
4
votes2
answers2098
viewsDisplay decimals (Currency) is rounding
I have an application where the price should go in format int decimal-free. int Valor = (int)(produto.Valor * 100); //o produto.Valor é um decimal The problem is when I want to display this value in…
-
3
votes2
answers3291
viewsObtain the number of decimals of one decimal
How can I get the number of decimals of a variable decimal? Ex.: If I receive the number: 4.5 - you must return 1 5.65 - you must return 2 6.997 - must return 3 I know what you can do by converting…
-
3
votes3
answers847
viewsConversion of a variable with replace to decimal
I’m having a little doubt, I pass a value 0,05 decimal for a variable A of the kind string. After this variable receives this value, it does the conversion of , to point ., which remains 0.05 After…
-
3
votes2
answers1291
viewsBigdecimal 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…
-
3
votes6
answers22035
viewsCompute the rest of a decimal division in Javascript
I’m working with values (decimal(18,2)) a sale where the sum of the price of the products is to be converted into a number of parcels. So that I can divide the total of the products exactly for the…
javascript mathematics decimal monetary-value divisionasked 8 years, 11 months ago LeandroLuk 4,989 -
3
votes1
answer50
viewsI 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…
-
3
votes1
answer59
viewsConvert a Double with more than 13 decimal places to String without losing values
I have in C# the following number in Double: 124.00767638369544. When I simply put valor.toString(), the value goes to: 124.007676383695, IGNORING the 0,00000000000044. The system I’m making needs…
-
3
votes2
answers4704
viewsComplete decimal places ",00" Javascript
People I have the following function that I am using to use Coin mask <input class="valr-parc" type="text" name="valr-parc" /> <script> String.prototype.Moeda = function() { var v =…
-
2
votes1
answer1608
viewsHow to convert a Decimal value to Datetime?
Can anyone help me with the following question? I have returns of two variables. Examples: 1st - of the type decimal (vdecTotalHoras) and the 2nd - also of the type decimal (vdecMediaAnalise), both…
-
2
votes0
answers43
viewsHow to round a decimal number to another nearest decimal?
So people are having a hard time creating a discount calculator. For example: I want a number x = 2,27 turn 2.3 and x = 2,24 stay 2.2. How to do this?
-
2
votes3
answers5179
viewsFormat decimal places in PHP using point and comma
I have a payment module where I must pass the data without decimals, only number. Examples: 10,00 = 1000 100,30 = 10030 1.000,00 = 100000 I researched some function in php that format decimal…
-
2
votes2
answers4786
viewshow do I remove some numbers after the comma in PHP
How do I remove some numbers after the comma in PHP? ex: 25.523832732732... Then I want you to stay only 25.52
-
2
votes2
answers2032
views -
2
votes1
answer190
viewsWhy suppress zero before the point in decimals, as in 0.5 == . 5?
Sometimes I face a code where the programmer wrote a decimal without zero, like 0.5 being .5, for example: var decimal1 = 0.5; var decimal2 = .5; console.log(decimal1 == decimal2);…
-
2
votes1
answer1132
viewsConvert Float to Python Binary
I’m studying the IEEE 754 standard, and I should create a new 16-bit method. This function is to convert the mantissa that is already in format 1,xxx*2 yyy What may have gone wrong in this code,…
-
2
votes1
answer116
viewsHow to convert 39 hours to 'TIME' type
To accomplish a certain task, I count in my system the time spent of the respective task. Today I came across the following: Data Inicial: 17/12/2018 16:49:14 Data Final: 19/12/2018 08:02:58…
-
1
votes1
answer127
viewsCode displaying decimal value in C# for Java/Android
I have a code that rounds up a value like decimal for homes I want, and would like to implement it on Android in Java however I’m having some difficulties, follows below the code in C#. public…
-
1
votes1
answer928
viewsHow to treat a decimal field with no homes after comma in a jquery mvc c#mask
I have a model with the following definition: [Display(Name = "Quantidade / Volume:")] public Int32 RoQuantidade { set; get; } In my View to fill the data when empty, that is, that have not yet been…
-
1
votes2
answers5037
viewsDecimal to hexadecimal conversion
I need to do a python algorithm to make a decimal to hexadecimal converter. But I can’t use ifs or ready-made functions, like Hex(). I did, but when I went to print the value in hexa I used…
-
1
votes1
answer190
viewsBigdecimal error cannot find Symbol
Given an amount in R$ convert it into dollar. Well, based on this context, the teacher requested that we use the object orientation paradigm. Before I should clarify that I use to order ide Bluej to…
-
1
votes1
answer10784
viewsDecimal in field number (html).
How to put decimal (1.0 and 1.10) in step="0.010" of a type=number field? I tried to do but always zeros stay out, it is not possible to make a height 1.60 for example, the result is always 1,6.…
-
1
votes1
answer143
viewsHow do I add decimals to a counter?
I need a regressive counter but as my acquaintances are still more timid in js, in that code I don’t know how to add "0" in the fields hour, minutes and seconds. As it is returns me only full…
-
1
votes2
answers7160
viewsDecimal to binary conversion in C language
The code below, from the original (http://www.programasprontos.com/algoritmos-conversores/conversao-decimal-para-binario-c/) "prints" a decimal number between 0 and 255 in binary. #include…
-
1
votes0
answers272
viewsC# - 5 significant numbers with at least 2 decimal places
Guys, someone knows a way that I can transform a number with at least 5 significant digits and added to this factor, it should have at least 2 decimal places. Example: -0,00012 >> -0,00012000…
-
1
votes2
answers868
viewsError: Incorrect decimal value: ' for column 'Value' at Row 1
I’m having a problem inserting a die of a maskedTextBox in the Mysql database. Follow the error Incorrect decimal value: ' for column 'Value' at Row 1 The code is this: conexao.Open(); MySqlCommand…
-
1
votes1
answer442
viewsSet decimal numbers in a string list - Python
I hope you can help me! I am on a project where I am creating some Graphics for a system that is used by people from various countries. Because of this, I created a function called formatC that,…
-
1
votes1
answer237
viewsHow to insert values that have "," as decimal separator?
Hello, I am making a product registration using . Net Core 3.1 and I have the following problem: In the product register there is a field to insert the value of the product, however when inserting a…
-
1
votes1
answer16
viewsHow to hide decimals in pascal?
I’m making a currency converter and I’m having trouble with the decimals, for example: "$1.0 equals R$ 0.18248175182481752" I would like to know how to hide the decimals from the second house. The…
-
0
votes0
answers970
viewsFill double zero left in java
I would like to know how to format a doouble with two boxes to the left of the dot and two to the right of the dot. Example: I have double 1.1 I want it formatted to 01.10; input: 10.1 / 1.05 output…
-
0
votes1
answer4362
views1264 Out of range value adjusted for column with decimal field
I have a hotel table in my database with a column estrelas(decimal(1,1)) which receives the hotel grade (from 0.0 to 5.0), however whenever I try to insert or change a field and put a value greater…
-
0
votes3
answers406
viewsInsert decimal variable in Firebird
I am making an Insert in Firebird database in a Value field (decimal), but no decimals appear in the table. Code in C# : public decimal ValorUnitario { get; set; } produto.ValorUnitario =…
-
0
votes0
answers80
viewsHow to calculate +10.5% in a product
How to calculate +10.5% in a product? My calculus is like this: private void txtMargemLucro_Leave(object sender, EventArgs e) { txtPrecoVenda.Text = (Convert.ToDecimal(txtPrecoCusto.Text) *…
-
0
votes2
answers115
viewsLimit decimal places
I’m making a simple program that generates two random numbers and asks the user how much is that number +,-,/,* for another number, and I want them to have decimal numbers as well, but when I use…
-
0
votes1
answer1002
viewsImport decimal with comma
On SQL Server, I’m trying to run a SELECT in a *.csv file as follows: SELECT * FROM OPENROWSET(BULK 'C:\Minha_Pasta\meu_arquivo.csv', FORMATFILE = 'C:\Minha_Pasta\format.xml') AS Contents…
-
0
votes1
answer1118
viewsDecimal to binary conversion in C language using ASCII table
I have to make a program that reads some characters and "transform" each character into its corresponding number in the ASCII table and then turn that number into binary and store it in an array. My…
-
0
votes3
answers866
viewsEntering numerical data in the database
I’m having trouble inserting into the database the field is formatted as DECIMAL(10,2)), when I try to insert the direct monetary value by Mysql works with the endpoint instead of the comma ex:…
-
0
votes0
answers760
viewsASP.NET MVC: Problem when assigning decimal value
Fichaviewmodel.Cs [Required(ErrorMessage = "A altura é obrigatória.")] public decimal Altura { get; set; } fiche.js $("#Altura").mask("9.99"); Fichacontroller.Cs [HttpPost] public ActionResult…
-
0
votes2
answers82
viewsHow to work with binary data
I have a function in C that takes two bytes one with higher significant value (msb) and the other with lower value (lsb) and then converts them to decimal. int get_pea(char *buffer) { char lsb[8],…
-
0
votes1
answer2464
viewsInsert, add and display value (in real) using PHP and Mysql
Hello, I’m a beginner in PHP and Mysql. I would like to have a form where I insert a value (in real, in case), disappear with what I have already saved in the database, and finally display to the…
-
0
votes1
answer93
viewsProblem saving mysql decimal field
Out of nowhere began a problem I found no explanation. Follow my code, explaining the problem. Here I receive the data: $venda = $_POST['f_venda']; //Sim $preco_venda = $_POST['f_preco_venda'];…
-
0
votes1
answer69
viewsSegmentation failure (recorded core image) decimal to binary conversion
#include <stdio.h> int main() { int d; int bits = 8; int vetor[bits]; int a = bits - 1; int b = a; scanf("%d", &d); if(d >= 2) { while(d/2 > 0){ vetor[a] = b % 2; b /= 2; a--; b--; }…
-
0
votes1
answer94
viewsProblem when converting text to decimal in ASP.NET Core deserialization
Hello, I have an ASP.NET Core Api that takes as parameter a raw body object from the request. [HttpPost] public HttpResponseMessage DoIt([FromBody]DoItDto dto) My Doitdto class has a decimal…
-
0
votes1
answer128
viewsPython and the ipaddress module
Hello, I have a TXT file containing 340,000 lines of decimal IP addresses, for example: 16777262. Using the ipaddress module I can convert the decimal to the punctuated format '1.0.0.46'. As…