float

Problem converting from int to float

There is a strange behavior I cannot understand. Agreed that float point number are approximations, so even operations that are obviously returning a number without decimal numbers can be approximated to something with decimals. I'm doing this: int num = (int)(195.95F * 100); and since it's a floating point operation I get 19594 inst...

CSS float: centered workaround possible?

Hi, I have a tagcloud in wich the tags (in Divs) should float centered. There is no float: center so I'm looking for a clean solution. My HTML looks something like this: <div id="tagcloud"> <div class="tag">Tag 1</div> <div class="tag">Tag 2</div> <div class="tag">Tag 3</div> <div class="tag">Tag 4</div> </div> The Divs shoul...

Force a floated or absolutely position element to stay "in the flow" with CSS

I'm looking for a way to force floated or absolutely positioned elements to stay in the flow in css. I'm pretty much thinking css is stupid for not having something like flow:on flow:off to keep it in the flow or take it out. The issue is that I want to have a div element with a variable height, I have a floated image on the left in th...

Convert BYTE buffer (0-255) to float buffer (0.0-1.0)

How can I convert a BYTE buffer (from 0 to 255) to a float buffer (from 0.0 to 1.0)? Of course there should be a relation between the two values, eg: 0 in byte buffer will be .0.f in float buffer, 128 in byte buffer will be .5f in float buffer, 255 in byte buffer will be 1.f in float buffer. Actually this is the code that I have: for (...

CSS Image Gallery Float BUG

This is new one, I'm having problem with an Archive page i've made. It seems like a fairly straight forward floated div image gallery... but for some reason the there's a bunch of line breaks randomly throughout the divs. I thought it may have been a problem with Cufon or IE.JS etc but I disabled all JS and it still bugs out. See: htt...

Should I use double or float ?

What are the advantages and disadvantages of using one instead of the other in C++? ...

64 bit floating point porting issues

I'm porting my application from 32 bit to 64 bit. Currently, the code compiles under both architectures, but the results are different. For various reasons, I'm using floats instead of doubles. I assume that there is some implicit upconverting from float to double happening on one machine and not the other. Is there a way to control ...

Ruby round float to_int if whole number

In ruby, I want to convert a float to an int if it's a whole number. For example a = 1.0 b = 2.5 a.to_int_if_whole # => 1 b.to_int_if_whole # => 2.5 Basically I'm trying to avoid displaying ".0" on any number that doesn't have a decimal. I'm looking for an elegant (or built-in) way to do def to_int_if_whole(float) (float % 1 ==...

Subfigs of a figure on multiple pages

Dear All I am facing problem of stacking many figures The problem is the stack figure is overriding the page dimension vertically and placing all the figure in one page and not changing the page as the limitation of page is reached. How can page be changed while stacking all the figures. \usepackage{subfig} \usepackage{float} \begin{...

How do I get around the IE CSS percentage rounding problem?

I'm trying to create a dynamic site where I have three floating boxes next to eachother. They are 33.33% in width each. The container div around them is 75% in width. I've found an article about the problem here: CSS: Jumping columns I've also found an example of the same problem here: Jumping columns example Drag the window size to ...

Floated List Margin in CSS

I have a div that is 320px wide. I'm floating list items to the left, each with a width of 100px. I then want to have a right margin of 10px to the right of each list item. All other margins and padding has been removed. So, I bascially want 3 list items per row before it goes onto the next line. But because there is a margin-right on t...

Which is better for left-to-right layout: float or display:inline?

I have some icons inside divs and needed to lay them out with a left-to-right structure instead of the default top-to-bottom layout that seems to come with divs. It's probably not news to most people who know CSS but I figured out (with a little help) that I could cause the divs to layout left-to-right using either: float: left/right ...

Html layout and have the body content extend past the set width and remain on same line

I have a layout with header, footer, body content. It is a pretty standard layout. We have reports that sometimes extend past the hard coded width' But we need the left nav and the body content to the same line. With this HTML code below, if the width extends too far (say there is a content in the body that has more than 900+ width) ...

PHP - Serialize floating points

Hi, I am generating 10 random floats between 6 and 8 (all for good reason), and writing them to a mysql database in a serialized form. But one quirk seems to emerge at the storage time: Before storing I'm just outputting the same data to see what it looks like, and this is the result I get a:10:{i:0;d:6.20000000000000017763568394002504...

Floating div problem

I have a floating div with dynamic content in it. In the first row i need four divs, similarly in 2nd, 3rd ,4th etc... i need four divs. I can assign a class to a single div and it will automatically generate the rest of the divs. My problem is i can set the min-height to a div, but i cannot set the max height as the content is dynamical...

Keeping divs floating next to each other when overflow

Hi! I hope to explain my problem simple in order to get good feedback :) Imagine this scenario: One DIV wrapper within two floating DIVs, next to each other, with fixed width. All of them with overflow hidden. But when decreasing the width of the wrapper (or increasing the children's) the last DIV collapsed instead of hide. Please, ch...

IE 7 and IE 8 do not render 2 consequent divs with float:left on the same line if there is a table in one of the DIVs

IE 7 and IE 8 do not render 2 consequent divs with float:left on the same line if there is a table in one of the DIVs which is 100% width + non-zero margin: <html> <head> <title>IE float left bug</title> <style type="text/css"> .inttable { width: 100%; margin: 9px; } .multicolumn { margin: 0px; border: 0px; padding...

Problems with sticky footer - CSS - main content wont go 100% height (float)

I'm trying to implement hxxp://www.cssstickyfooter.com however I am having a few problems! See screenshot: hxxp://img22.imageshack.us/img22/2654/71161106.jpg The div "Content" contains both left and right columns. On smaller resolutions this is working as expected however once the user starts to increase there resolution the content does...

div that stays on top of status bar

hello Sir i have been searching over a month for a solution like this,,, the div on website below that have search at the bottom and it always remain sticked above status bar if u scroll down. http://www.outlawdesignblog.com/ can u kindly point me to a solution ...

Looking for an easier way to use floats in C#

For a number of reasons, I have to use floats in my code instead of doubles. To use a literal in my code, I have to write something like: float f = 0.75F; or the compiler will barf since it treats just "0.75" as a double. Is there anything I can put in my code or set in Visual Studio that will make it treat a literal like "0.75" as ...