float

Can printf() produce "-.5" for the value (-0.5)?

i.e. can printf be told to ignore zero when it precedes the decimal point? ...

Rounding a double or float?

Possible Duplicate: round() for float in C++ In cmath there is floor and ceiling, but I cannot find round. How does one round with the standard library without writing a function and dragging it around into all projects? Thanks ...

IE8 creates an extra floated div

I've been pulling my hair out for days over this one. http://djembefola.com In ie 8 there is 5 columns, even though there is only for 4 subcontentcols in the markup. I've tried removing all the content of the columns and I'm now stumped. Anybody have any ideas? ...

Zend Db Float Problem

Hello, I have a MySQL table structured: float(10,2) For example I insert a row. $value = array('price' => '13539.51'); $db->insert($value); When I check this row with phpmyadmin, everything is fine. But when I read this row with Zend Db, price value like this "13539.509765625". How can i fix this problem. $select = $db->select(); $...

Why this formula works just for 11 characters?

I have a UITextField with number pad keyboard and on Editing Changed event I do this: textField.text = [@"" stringByAppendingFormat:@"%0.2f", [[[textField text] stringByReplacingOccurrencesOfString:@"." withString:@""] floatValue]/100.0]; This is a script found on a site and it works just fine for the first 11 characters, meaning that...

CSS center vertically in 2 floated divs

I have a div with 2 floated divs. On the left 3 buttons and on the right links in a paragraph, single line. When the links on the right become to long (or I decide on more bottons) the paragraph goes multiline and I would like my buttons to center vertically. In my example the bold name "Joe Smith" works fine, but if becomes "Joe Smith ...

floating in list causes trouble in IE6 and IE7

I have a toggle list that causes trouble in old IE browsers, tried to fix it for couple of hours but I failed again and again. Please check out the jsfiddle code: http://jsfiddle.net/vny63/ structure is similar to this: <li class="toggle"> <a class="left" title="gallery">gallery</a> (English) <span class="right float_right">3<...

C++ Converting a float to an unsigned char?

I'm new to C++, and doing a bit of googling I thought sprintf would do the job, but I get an error upon compiling that I can't convert between an unsigned char and a char. I need an unsigned char because I am going to print to an image file (0-255 RGB). unsigned char*** pixels = new unsigned char**[SIZE]; vector<float> pixelColors; .....

C++ floats being converted to ints

I have the following function that should return an average of l1- l7. However, it seems to only return an integer. Why is it doing this, and how do I make it return a float rounded to 2 decimal places? Snippet: int lab_avg(int l1,int l2,int l3,int l4,int l5,int l6,int l7) { float ttl; ttl = l1 + l2 +l3 +l4 +l5 +l6 +l7; re...

Multiple centered floating divs in a liquid layout

I have an idea for a layout I would like to use, but I can't get it to work correctly. I am hoping someone on here might be able to help as I have spent hours searching. The layout is like so. One wrapper div houses 6 child divs. Those child divs must be centered at ALL times regardless of the size of the wrapper div. <html> <head> <t...

Problem with floating CSS containers with variable width

Hi, I have 3 floating containers of unknown width. The surrounding container has a fixed width. ------------- | X | X | X | ------------- Inside the third container there are again floating elements: --------------------------- | X | X | X [ O | O | O ] | --------------------------- What happens when these elements execeed the wid...

How can I put only value after decimal

I have got output and I want to use only three values after decimal. How can i do that in Python? ...

c printf signed float

What is the formatter to make sure that + or - signs are always shown in front of the float value in printf() in C? I haven't done C in a while, so where can I find a good reference on the web, any suggestions are appreciated ...

MySql: convert a float to decimal produce more decimal number then the stored in back.sql file

Hi at all, i want to understand this: i have a dump of a table (a sql script file) from a database that use float 9,2 as default type for numbers. In the backup file i have a value like '4172.08'. I restore this file in a new database and i convert the float to decimal 20,5. Now the value in the field is 4172.08008 ...where come from the...

CSS: tile boxes which come with irregular heights

Hi, I want to tile boxes to look like this picture below, which all the boxes have the same width and height, accept one of them I need to change its height to 500px for certain occasions. But I cannot make it right! http://rokhsanafiaz.co.uk/dump/1.php here is my css, * { margin: 0; padding: 0; } h1,h2,h3,h4,h5,...

iphone Core Data - What type of proprty for a float?

what type should my property be to work properly with core data float variables. For example in order to get my class to work with int32 in core data i had to create NSNumber in my class. how about the float variables in core data? ...

FileSize Problem - Cocoa

Hello, I've written methods that help me get the size of files/folders and translate the result in a human readable string. Problem is, when this size exceeds about 2.1GB, the number returned changes to a random negative number, like "-4324234423 bytes", which is useless. Things I've found out about & done about this issue: 32GB is l...

Why isn't "0f" treated as a floating point literal in C++?

Why isn't 0f treated as a floating point literal in C++? #include <iostream> using namespace std; int main(){ cout << 0f << endl; return 0; } Compiling the above gives me C2509 (syntax error: 'bad suffix on number') using VS2008. ...

Float text over image within table cell

I am trying to float text over an image in the 3rd column of the first row within a table. This cell has an <img> within it (processed by psd slicing) and I want to put text over it. I have tried float: left and position: absolute but nothing seems to work. Any ideas? ...

Adding an integer to a float in PHP rounds the float to 1 decimal place

For example, I have this line of code: echo 10359023529 + 0.2137582935; Why does this return: 10359023529.2 instead of: 10359023529.2137582935 ...