float

Converting byte-stream into numeric data-type

Let's say I have a byte-stream in which I know the location of a 64-bit value (a 64-bit nonce). The byte-order is Little-Endian. As PHP's integer data-type is limited to 32-bit (at least on 32-bit operating systems) how would I convert the byte-sequence into a PHP numeric representation (float would be sufficient I think)? $serverChalle...

Printing thousand seperated floats with GAWK

I must process some huge file with gawk. My main problem is that I have to print some floats using thousand separators. E.g.: 10000 should appear as 10.000 and 10000,01 as 10.000,01 in the output. I (and Google) come up with this function, but this fails for floats: function commas(n) { gsub(/,/,"",n) point = index(n,".") - 1 if ...

Putting 2 divs side by side / Internet Explorer 6/7 float and padding (?) bug fix

Hi everyone, I need to put 2 divs side by side. But what's more important, I want this to display correctly in IE6/7. I have managed to succeed this with Firefox though. My code: #container{ padding:10px; } #left{ float:left; width:500px; } #right{ width: 300px; float:right; padding:7px; background-color:#F...

Why is floating point arithmetic in C# imprecise?

Why does the following program print what it prints? class Program { static void Main(string[] args) { float f1 = 0.09f*100f; float f2 = 0.09f*99.999999f; Console.WriteLine(f1 > f2); } } ...

Parse four bytes to floating-point in C

How do I take four received data bytes and assemble them into a floating-point number? Right now I have the bytes stored in an array, which would be, received_data[1] ... received_data[4]. I would like to store these four bytes as a single 32-bit single precision float. -Thanks I'm actually receiving a packet with 19 bytes in it and...

How can I convert four characters into a 32-bit IEEE-754 float in Perl?

I have a project where a function receives four 8-bit characters and needs to convert the resulting 32-bit IEEE-754 float to a regular Perl number. Seems like there should be a faster way than the working code below, but I have not been able to figure out a simpler pack function that works. does not work - seems like it is close $floa...

CSS floats with unknown widths don't wrap whitespace with doctype

Two divs, floated left, of unknown width. One of them has more content than fits the page, so it moves below the first (except in IE): http://corexii.com/floatproblem/float.html Add display:inline-table; and the big one wraps its content (consistently across browsers): http://corexii.com/floatproblem/table.html But introduce a doctyp...

How to make "text-overflow: ellipsis" for both "float:left" and "float:right" div?

I have a web design requirement to have a header like this: +-------------------------------------------------------------+ | +---------------------+ +-------++------------------------+| | | float left DIV A | | DIV C || float right DIV B || | +---------------------+ +-------++------------------------+| +---------------------...

IE not clearing subsequent floats

I'm trying to get two divs to float to opposite sides of the page, with text flowing between them. The top of the second (left-aligned) div should be even with the bottom of the first (right-aligned) div. The code below works fine in FF, Chrome, Opera, etc. fine, but they do not clear properly in IE. Both divs appear at the top of the...

keeping same formatting for floating point values

I have a python program that reads floating point values using the following regular expression (-?\d+\.\d+) once I extract the value using float(match.group(1)), I get the actual floating point number. However, I am not able to distinguish if the number was 1.2345678 or 1.234 or 1.2340000. The problem I am facing is to print out th...

What's the difference between a single precision and double precision floating point operation?

Hi All, Just wondering what the difference between a signle precision floating point operation and double precision floating operation is. I'm especially interested in practical terms in relation to video game consoles, for example does the nintendo 64 have a 64 bit processor and if it does then would that mean it was capable of double...

Make outer div be automaticly the same height as its floating content.

I want the outer div, which is black to wrap its divs floating within it. How can this be be done? I dont want to use "style='height: 200px' in the div with the 'outerdiv' id as I want it to be automatically the height of its content (eg, the floating divs). <div id='outerdiv' style='border: 1px solid black;background-color: black;'> <d...

Jython: parsing text to float containing commas

How can I parse a float scanned from a sheet as text, containing commas? txt = "1,903.44" value = float(txt) # This fails due to ',' in string UPDATE: Sorry I wasn't clear. I'm using jython 2.5, which doesn't have the locale module. ...

IE 7/8 rendering Iinline (Floated Divs) as block: widths do not adjust to content?

I have a block element (DIV) who stretches across an entire page. It contains multiple floated DIVs of variable width. This element can live on many web pages (anyone can put it on their website). In FF on all sites it is rendered correctly and the floated DIVs are only as wide as their inner contents. In IE, it works sometimes- but on o...

Casting an array of unsigned chars to an array of floats

Hi. What is the best way of converting a unsigned char array to a float array in c++? I presently have a for loop as follows for (i=0 ;i< len; i++) float_buff[i]= (float) char_buff[i]; I also need to reverse the procedure, i.e convert from unsigned char to float (float to 8bit conversion) for (i=0 ;i< len; i++) char_buff[i]...

C# Input validation for a Textbox: float

This supposedly easy task gave me some headache. I simply want to let the user enter any text that succeeds float.TryParse into a Textboxish control. I could use a normal TextBox and check the Text in some btnOK_Click, but this is obviously lame. Also, there is a nice built-in MaskedTextBox control, but I failed to set it's mask to be e...

CSS2 DIV Presentation Issue

i need to create a page that has quotes side-by-side for a large number of rows. i am looking for a clean CSS2 presentation where the quotes of each row line up vertically and don't run below each other. also, i am looking for a solution with the least amount of code and preferably one that doesn't float DIVs and does utilize the displ...

Floating another div next to a main centered div

Ok so I have a website and the entire thing is wrapped in a container. This container is centered with margin:auto. I would like to float a piece of content to the right of this centered container and have it sort of stick to the side of it no matter if the user resizes the browser window, etc. I'm wondering if there's a real simple way...

Floating an image right and left in text box weird spacing in IE

My example is here The logos look fine when told to align right or left in FF and they seem to wrap properly with the text, but in IE a huge gap shows up after the first line of text. I have also created float right and left styles and tried to apply to the logos but got the same effect. I know this is an issue in IE, but I haven't fou...

Internet Explorer 6 and 7: floated elements expand to 100% width when they contain a child element floated right. Is there a workaround?

I've got a parent div floated left, with two child divs that I need to float right. The parent div should (if I understand the spec correctly) be as wide as needed to contain the child divs, and this is how it behaves in Firefox et al. In IE, the parent div expands to 100% width. This seems to be an issue with floated elements that hav...