Questions tagged as 'float'

1
answer

Can you operate with decimals in Bash?

Is there any way to work with decimals in Bash? Do operations, obviously. I've tried with let , but it always throws me an error with the decimal part. Thank you very much.     
asked by 05.09.2018 / 08:50
2
answers

My code stops adding by converting from hexadecimal to decimal

I want to convert a string of 6 bytes in hexadecimal to a float float desencapsularArchivo::hex2dec(string aConvertir) { int cantHex = aConvertir.size(); float decimal = 0; for(int hexNum = 0;hexNum < cantHex; hexNum++)...
asked by 21.02.2018 / 19:38
3
answers

Convert a float or an integer to string in c ++

I wanted to know a simple way to convert a variable float or int in data type string in C++ . Because look in several places and talk about using sprintf , from the library stdio.h but it does not work w...
asked by 21.04.2018 / 16:36
1
answer

Validate FLOAT data entry [duplicate]

I need the program to accept only decimal numbers. The one I did is fine, only accepts decimals, but if you enter for example -23.45jdhsdj . The numbers if you save them, although you ignore the letters and it should not be like that. Yo...
asked by 20.09.2018 / 08:29
1
answer

How to round a float to integer (upwards)?

I have an operation that returns a float for example 6.3 and I need to round it to 7 I have tried with Math.round(6.3) but when the decimal is less than 0.5 it rounds down and when it is bigger it rounds up and I need it to...
asked by 14.06.2018 / 10:34
1
answer

Doubt about float and int

I have a program that reads me file data excel and csv and writes them in txt . The problem I have is that one of the columns that he reads are decimals and when writing them he puts them all as decimal. The issue is that I j...
asked by 15.01.2018 / 13:28
1
answer

How to convert elements of an array from string to float?

I have this array (values string ) locations = [ {lat: "-31.563910", lng: "147.154312"}, {lat: "-33.718234", lng: "150.363181"}, {lat: "-33.727111", lng: "150.371124"} ] and I want the array to be like this...
asked by 10.01.2018 / 17:15
2
answers

Round 2 decimals in Java

Good, I have this method done in Java and the result that returns is a number with many decimals, I would like some way for me to return two decimals only. Code: public static float calcularMedia(int[] notas) { float resultado =...
asked by 28.08.2017 / 12:56
1
answer

C ++ error: 'bool operator () (std :: pairNode &, float, std :: pairNode &, float)' must be a nonstatic member function

I'm using a priority queue consisting of a pair of an object of a class called Nodo and a value of type float (I chose it instead of double, thinking it takes up less bytes). The error I get is in the comparison operator >...
asked by 09.11.2018 / 16:45
3
answers

PHP Unexpected value when comparing floating values

I already saw the problem of floating comparisons with integers and decimals. Here is explained in the red box: link To solve this we have the library: BCMath arbitrary precision math : link And supposedly the function would come from...
asked by 28.09.2018 / 10:31