Questions tagged as 'float'

4
answers

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
3
answers

Get value Integer in end .00 and float value in .01 to 0.9

I have this code below that is from a calculator, however I have a problem: I wanted to return a float value when dividing 5/2 = 2.5 and returning an integer value when dividing 4/2 = 2 and not 2.0 ! Can anyone help me with this? The c...
asked by 20.06.2018 / 03:38
3
answers

Doubt with float

#include<stdio.h> int main ( void ){ float y = 12.0809; printf("The number %.2f is a float\n"); return 0; } I know that %.2f is used to consider only two decimal places, but I'd like to know what an integer serves before the peri...
asked by 07.01.2017 / 03:37
1
answer

Problem with float vector

I created a code for a college exercise that was running right, but I forgot that one of the variables of struct was a vector, and when I made a simple change everything changed. Virtually all functions are giving error. I do not find the...
asked by 19.06.2015 / 05:41
1
answer

Problem with float python (uri 1098)

I'm trying to solve this problem and when I run the code, at some point it stops working correctly . I think it's because of rounding, but when that part is removed, the code executes to infinity. i = 0 j = 1 while(i != 2.2): print('I=%...
asked by 21.08.2016 / 00:42
1
answer

Float to string conversion - how to display two or more decimal places?

I have the following code, which returns values of type float . How can I make the result appear with two or more decimal places? private void btnDividirActionPerformed(java.awt.event.ActionEvent evt) {...
asked by 17.02.2018 / 17:15
4
answers

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
1
answer

Fields aligned in form

Good evening, I used 'float: right;' to put some fields in a side-by-side form, but they go down one field. 'Full Name' and 'Date of Birth' should be side by side, but the date field descends. Picture: Codes:Registrationpage link CSS li...
asked by 24.05.2015 / 01:21
1
answer

How to add two floats interacting with the UI?

I wanted to add two floats, but I put the first decimal number in EditText and when I add another decimal number, I put it in EditText frame in CheckBox and it continues the same number as I put it in CheckBox . Ex...
asked by 29.09.2014 / 23:52
2
answers

"for" with step "float": TypeError: 'float' object can not be interpreted as an integer

I want to loop from 0 to 100 with step 0.1: for x in range(0, 100, 0.1): a = cos(radians(x)) But I get this error:    TypeError: 'float' object can not be interpreted as an integer How can I loop through step float?     
asked by 08.10.2018 / 20:06