473,563 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with floats and decimals

thx
I have MySQL 4.0.18 on Windows 2000 and I have a problem with floats
and decimals. The table has floats and decimals fields but when I
enter non-integers in these fields, they get rounded. So if I put
(either via PHP or the console or MySQL Control Center) 155.82 in a
float field, it is stored as 156. WHY IS THIS HAPPENING??

thanks
Jul 20 '05 #1
0 1295

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2929
by: Vio | last post by:
I need to test for equality between simple 2 decimal numbers. For example: if (10 + 15.99) == 25.99: do some stuff... The preceding sentence should be TRUE, but to Python it appears FALSE. Which is wrong. Perhaps because Python translates "25.99" to "25.98999999999999998" and not "25.99", which may be the reason for this error (me...
2
1327
by: kartik | last post by:
Since the Decimal type can represent any given fractional number exactly, including all IEEE binary floating-point numbers, wouldn't it be advisable to use Decimals for all floating point numbers (except possibly for performance)? Thanks, Kartik.
2
2517
by: k | last post by:
I have aproblem when multiplying 2 float 638.9 * 382.8 should = 244570.92 results giving 244570.922 both numbers are float variables , tried using double to much the same effect ..????? any assistance much appreciated
6
8712
by: Mike P | last post by:
Why does this cause the error 'cannot implicitly convert type 'double' to 'float'? Can you not multiply doubles by floats without converting them all to the same datatype? fltPCRateStd = fltPCRateStd * 1.175; Regards, Mike
7
6332
by: Anton81 | last post by:
Hi! When I do simple calculation with float values, they are rarely exactly equal even if they should be. What is the threshold and how can I change it? e.g. "if f1==f2:" will always mean "if abs(f1-f2)<1e-6:" Anton
18
1977
by: atv | last post by:
at least to me it is. I can't figure out for the life what it is i'm doing wrong here. i have a function called assign_coordinate. usually, i pass a malloced pointer to it, then individual pointers are malloced within that function. No problem here. Now i have a situation in this software, where i need to assign new coordinates to all...
23
2225
by: Arnaud Delobelle | last post by:
Hi all, I want to know the precision (number of significant digits) of a float in a platform-independent manner. I have scoured through the docs but I can't find anything about it! At the moment I use this terrible substitute: FLOAT_PREC = repr(1.0/3).count('3')
16
4120
by: luca bertini | last post by:
Hi, i have strings which look like money values (ie 34.45) is there a way to convert them into float variables? everytime i try I get this error: "numb = float(my_line) ValueError: empty string for float()" " here's the code ************
8
3092
by: skanemupp | last post by:
how do i solve power(5,1.3)? def power(nbr, po): if po==0: return 1 if po>0: return nbr*power(nbr, po-1) if po<0: return 1/power(nbr, -1*po)
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.