# Questions tagged as 'float'

4

## Mathematical division needs

On the Windows calculator: 9 / 3,0001 = 2,999 ... In my program: 9 / 3,0001 = 3; I would like to get this level of precision using C. See excerpts from my program: double op(double num1, double num2, char c) { if(c == '/')...
asked by 25.10.2014 / 18:23
2

## Float decimal places

I'm developing an application to track product sales. However, sometimes the added value of reports does not beat the decimal places. It gives small differences. How do float stop giving these problems? I always use only two decimal place...
asked by 11.11.2014 / 13:02
1

## JavaScript generating float with several decimal places

When creating an ordering system (quantity x value) I noticed that in some cases when adding broken values, JavaScript returns numbers with many more decimal places than expected. Example: (123*1.23)+(312*3.26) //retorna 1168.4099999999999...
asked by 17.08.2014 / 21:18
2

## What kind of data (double, float) should I use when representing a temperature?

My question is regarding the use of Double and Float in Java exercises when having to declare a temperature (Celsius scale). Which one should I use in this case? I declare as Double , but the teacher correcting the exercis...
asked by 07.09.2018 / 21:00
4

## Converting float to char array in C / C ++

Recently I ran a test and there was an issue that asked for a number like 123.456 to be displayed as 321.456 . I thought the best solution would be to convert this to an array of char and then create an algorithm to print pos...
asked by 03.04.2014 / 18:42
2

## Error: object of type 'float' has no len

I was debugging simple operations in the Python interpreter, and the following command made me curious: >>> b = 3.12; len(b) With the following error:    Traceback (most recent call last):       File "", line 1, in       Type...
asked by 05.01.2016 / 22:50
2

## What does float ("NaN") and float ("inf") mean in Python?

I've seen a code like this: def _min(*args): res = float('inf') for value in args: if value < res: res = value return res I would like to know what is a float ("inf") and a float ("NaN").
asked by 07.04.2018 / 03:01
1

## Float rounding in C

I need to return a value float with 1 decimal place, however it is returning with the value rounded. I have the following code: float n1 = 4; float n2 = 9; float total = n2 / n1 ; printf("Media: %.1f ", total ); //aqui, o resultado é 2....
asked by 23.05.2014 / 20:21
1