float

Platform-independent way to obtain maximum C++ float value

What’s the best, platform-independent way to obtain the maximum value that can be stored in a float in C++? ...

Floating DIVs in IE7 vs. IE8, Firefox, Chrome and Safari

Hi folks, I'm a bit stumped on this one. I am referring to this page - http://savitarbernese.com/welcome.aspx. At the moment it looks okay on IE7 but I can't seem to get it to work on other browsers. As it stands now I had to wrap a couple of DIVs within tables to make the background extend behind the full content. I'm guessing this has...

Why is the number 16 converted to float(6.1026988574311E_320) by PHP using Zend_Amf

The Zend_Amf specification states that a Number type returned from flash will map to a float in PHP. Fine. But why does the number 16 get returned as 6.1026988574311E_320 ? PHP version is 5.2.9 running on OS X. I have tried forcing a cast to integer in PHP (the above value gets rounded to 0) and also from Actionscript using int(16) - th...

Wrapping text around a div

Hi, I have a layout like this: Header div divLeft divRight Footer div divLeft is a bunch of text and divRight is a div with some stuff in it. divLeft is a lot longer and I would like the text to wrap under divright. right now it's just making two columns and there's a lot of white space under divRight. Help? Thanks! ...

How do I set a float without using an OGNL converter?

I have a class that looks like this: public class Foobar { private float value; public void setValue(float value) { this.value = value; } } I then have a webpage (Struts2) that passed in a variable foobar.value. <input type="text" name="foobar.value" value="123.456"> I then get this error: ognl.MethodFailedException...

Ruby: counting digits in a float number

Is there any worthy Ruby method to count the number of digits in a float? Also, how do I specify the precise when to_s float numbers? ...

Using iPhone/Objective C CGFloats: Is 0.1 okay, or should it be 0.1f?

Hi there, When using an iPhone Objective C method that accepts CGFloats, e.g. [UIColor colorWithRed:green:blue:], is it important to append a f to constant arguments to specifiy them explicitly as floats, e.g. should I always type 0.1f rather than 0.1 in such cases? Or does the compiler automatically cast 0.1 (which is a double in gener...

Operations for Long and Float in Python

I'm trying to compute this: from scipy import * 3600**3400 * (exp(-3600)) / factorial(3400) the error: unsupported long and float ...

How do I change my float into a two decimal number with a comma as a decimal point separator in python?

I have a float: 1.2333333 How do I change it into a two decimal number with a comma as a decimal point separator, eg 1,23? ...

Confusing type conversion - 2 Bytes to Double

I was recently asked to take over a project in which waveform data is sampled from a power converter and sent to an intelligent agent where calculations are done and the appropriate actions are taken based on the results. The following (java)snippet is what the previous coder used to convert the byte array into an array of doubles: ...

jQuery input validation for double/float

Hi What's the best method to mask an input field to only allow float/double, without any jquery plugin. Acutally i'm doing it like this: $("#defaultvalue").bind("keypress", function(e) { if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; } ...

Double & Float method parameters execution when called in C#

Hi there. Here's a small snippet of code, when called it outputs 'double'. Why? What's the reasoning behind this. Why doesn't it print 'float'? class source { static void Main() { Receiver r = new Receiver(); r.Method1(1.1); } } class Receiver { public virtual void Method1(double f) { Debug.Print("d...

efficient function to convert float/double to string

Right now, the only function that I am aware of is _snprintf_s like the following double dMyValue = <some value>; _snprintf_s(pszMyBuffer, sizeof(pszMyBuffer), 12, "%.10f", dMyValue); ...

Width of float no longer shrinks to fit when contents wrap to multiple lines

Here is a test file. Resize the window to be wide enough to hold all four boxes. Notice the container is no wider than the boxes, as intended. Resize the window to be small enough that the boxes are on more than one line. Notice the container is the full width of the page (this is unintended). Why? Is it possible to prevent this in a ...

Easy pretty printing of floats in python?

I have a list of floats. If I simply print it, it shows up like this: [9.0, 0.052999999999999999, 0.032575399999999997, 0.010892799999999999, 0.055702500000000002, 0.079330300000000006] I could use print "%.2f", but that would require a for loop to traverse the list, which I consider to be ugly. I believe that there must be a better s...

How to use CSS float without hiding parts of a DIV

When CSS float is used on a DIV, other DIVs that are not floated continue to occupy the space of the floated DIV. While I am sure this is intentional, I do not know how to achieve the effect I am looking for. Please consider this example: <html> <div style="width:400px"> <div style="width:150px;float:right;border:thin black solid"> ...

IE7 versus FF floating issue

The following code renders differently in IE7 and FF3 (NEW CODE POSTED OLD CODE WAS MISLEADING - sorry for confusion) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html> <head> <style> #boxr1{ background-color:#FFFFFF; border:3px solid #DDDDCA; float:ri...

Float "edit" link to right of Heading (must keep heading tag block)

Given the following html <div class="module"> <div class="header"> <h1>Test Heading</h1> <a href="">edit</a> </div> <div class="body"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu lacus at augue tristique dignissim. Nunc...

Float left somehow being broken

Take a look at http://new.reyniersaudio.com/test.html The idea here is that I want the container "modelInfoRightCol" to wrap around "modelInfoRightCol (the picture of the case and pricing info)". What am I doing that's preventing this from happening. Thanks! ...

Trying to left float a left curly quote but having some issues.

I'm trying to float a large left curly quote so that the blockquote sits just to the left of it. I'm having a couple of issues though. 1) The text in the p tag continues to wrap around the quote symbol even though I declare clear: right; on the blockquote. I have never understood how floats are supposed to work so can someone offer some...