473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

division

oll3i
679 512MB
why double apriori=wszystkieTrojki/liczbaColumn; returns 0.0 if wszystkieTrojki=3 and liczbaColumn=20 should be 0.15 ?
Jul 5 '07 #1
5 1343
oll3i
679 512MB
i fixed it :) :) thank YOU
Jul 5 '07 #2
r035198x
13,262 8TB
why double apriori=wszystkieTrojki/liczbaColumn; returns 0.0 if wszystkieTrojki=3 and liczbaColumn=20 should be 0.15 ?
What types are wszystkieTrojki and liczbaColumn?
If you divide two integers the value is truncated (round down). You need to type cast them to double first, like

Expand|Select|Wrap|Line Numbers
  1. double apriori=wszystkieTrojki/(double)liczbaColumn;
P.S Which language is that?
Jul 5 '07 #3
JosAH
11,448 Expert 8TB
P.S Which language is that?
According to my wife it's Polish (she studied Slavic languages); I'm innocent ;-)

kind regards,

Jos
Jul 5 '07 #4
r035198x
13,262 8TB
According to my wife it's Polish (she studied Slavic languages); I'm innocent ;-)

kind regards,

Jos
Did you see the wszystk.. I wonder how that's pronounced.
Jul 5 '07 #5
JosAH
11,448 Expert 8TB
Did you see the wszystk.. I wonder how that's pronounced.
Beats me; my wife mumbled something like 'w-shatsk-ye' meaning something
with 'three' in it; I'm still innocent ;-)

kind regards,

JoQs (with a silent 'Q')
Jul 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Tim Rowe | last post by:
If I do from __future__ import division then eval(1/2) gives me 0.5 as expected. But if I do print input("enter a sum: ") and enter 1/2 as the sum I get 0 as if I hadn't done the import. I thought...
2
by: Sebastian Haase | last post by:
Hi, I'm interested in having more people in our lab using numarray/NumPy instead of MatLab. For that I have put together a couple useful modules and written many myself. But then I got reminded of...
5
by: Jive | last post by:
I've got a program with Python 2.3 embedded. When I try to run a script containing "from __future__ import division", I get an exception: File "main2.py", line 3 from __future__ import divison...
19
by: Imbaud Pierre | last post by:
integer division and modulo gives different results in c and python, when negative numbers are involved. take gdb as a widely available c interpreter print -2 /3 0 for c, -1 for python. more...
15
by: joel | last post by:
I have a table which I want to update by dividing one field into another. The update runs with no errors, but the results come out as only a positive integer number. The datatype for the result...
9
by: Marcin | last post by:
How I can make division of two numbers placed in arrays, example: short int a = {2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2}; short int b =...
17
by: seb.haase | last post by:
Hi, Is it true that that "Python 3000" is dead ? Honestly I think that e.g. changing 5/2 to be 2.5 (instead of 2) would just break to much code :-( On the otherhand I'm using Python as "Matlab...
10
by: Mike S | last post by:
Does anyone know the logic behind why in VB.NET the result of a floating-point division ('/') is -rounded- on being converted to an integer type, such as with statements like Dim x As Integer =...
2
by: kermit | last post by:
For a long time,, There has been a discussion of trueFor division versus integer division in Python. I myslef prefer that / be used for integer division since almost always, I want the...
13
by: jamesonang | last post by:
Supposed unsigned int(32 bits) is the largest number that computer can represent with a single variable. Now, i have a big integer ( less than 64 bit, but great than 32 bit) . i represent it by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.