float

Xcode Obj-C Why is 7/10 not 0.7

int a=7 int b=10 float answer = (float)a/b; answer=0.699999988 ( I expect 0.7 ??) ...

Dynamic Float top positions

Hi All, I have an example of a dynamic number of divs all floating left: ...but would like the new row to be tucked up under the previous as in my example desired output: I know using columns might be the best way to go but am having trouble with exactly how to go about that. A CSS solution would be great. I do know how many b...

Floating a child in a overflowed parent with ie7

Hi, So I got some divs... The aim here is to play with some hide-show effects. <div class="container"> <div class="move"> Some dynamic content... </div> </div> .container { width:100px; height:100%; owerflow-y:hidden; } .move { width:300px; height:100%; float:right; } The issue is that in ...

compare floats in php

I want to compare two floats in php, below is a sample code $a = 0.17; $b = 0.17; if($a == $b ){ echo 'a and b are same'; } else { echo 'a and b are not same'; } In this code it return result of else condition instead of if condition ,even $a and $ b are same. Is there any special way to handle/compare float in php. If yes then ple...

WebKit's percent-sized floats bug: are there any workarounds?

I'm experiencing what appears to be a bug in WebKit's rendering of floating elements' width when they have margins. The following renders as one would expect in Firefox (3.6) and WebKit (Chromium 5.0): <div style="width: 100%; background-color: green;"> <div style="background-color: red; float: left; width: 50%;">n</div> <div s...

JavaScript displaying a float to 2 decimal places

I wanted to display a number with 2 decimal places. I thought I could use toPrecision(2) in JavaScript . However, if the number is 0.05, I get 0.0500. I'd rather it stay the same. What is the best way to do this? I can think of coding a few solutions, but I'd imagine (I hope) something like this is built in? Thanks Update See it o...

Image not positioning properly under floated divs in IE8

I'm trying to build a dynamic chart using images, and it looks fine in standards-compliant browsers, but in IE8 the baseline and everything below it is jumping up to the side of the chart. Anything in particular I could do to keep it in its proper place? <html> <head> <style type="text/css"> div.float { float: left; } .float i...

keep div floating to the left if browser window gets smaller

Hi, I am trying to make some sort of timeline, but I can not keep the div floating horizontally. I have a div container with overflow hidden. Inside the container I have divs floating to the left. Inside those div's are ul's with a fixed width. If I resize the browser, I want the div to be gracefully cut off from the right side. The ...

Ada: constant declaration

Hi, I'm reading Norman Cohen's Ada 95 book and on page 129 we have the constant declarations: Pi: constant Float := 3.1415926536 and Pi: constant := 3.1415926536 The second declaration is said to be interpreted as, I quote: "any floating-point of fixed-point type with the appropriate range". My question is say one is working w...

Convert byte array to float in Lua [Float Data Structure]

I have the ability to read the memory with Lua, but I've run into a problem. I want to read a float value. I have, what I presume to be a float, in the memory which looks like this. Byte Array 65 B6 40 43 EC 35 87 41 51 04 9E 3F Float Value 192.712478637695 I know the float value because I'm using a memory editor. In Lua I have a fun...

CSS - simple two columns

Hi. I have a fluid page (100% width) with this inside: [image-fixed-width] | [text-fluid-width -----------------------------------] | ----------------------------------------------------- | ----------------------------------------------------- I need the text next to the image not to wrap around...

In the .NET framework, why are there PointF (float) and no "PointD" (double)?

Can anyone explain why, in the .NET framework, there are PointF structures (using the single-precision float type) and no "PointD" (using the double-precision double type)? Did they establish that such precision would never make sense in the System.Drawing namespace? Is there any other reason? ...

universal parsing of strings into float

In the environment that my program is going to run, people use ',' and '.' as decimal separators randomly on PCs with ',' and '.' separators. How would you implements such a floatparse(string) function? I tried this one: try { d = float.Parse(s); } catch { try { d = float.Parse(s...

std::vector<float> and double* - How safe is this?

Is it safe to do this? double darray[10]; vector<float> fvector; fvector.insert(fvector.begin(), darray, darray + 10); // double to float conversion // now work with fvector VS2008 gives me a warning about the double to float conversion. How do I get rid of this warning? I don't think it makes sense to cast darray to float* as that...

C++ double operator+

Possible Duplicates: Incorrect floating point math? Float compile-time calculation not happening? Strange stuff going on today, I'm about to lose it... #include <iomanip> #include <iostream> using namespace std; int main() { cout << setprecision(14); cout << (1/9+1/9+4/9) << endl; } This code outputs 0 on MSVC 9....

Clear inside div A is clearing the float of div B, which is outside of div A

This is a problem I've had several times when trying to create layouts with a sidebar. I made an example here: http://samutz.com/div.html #content has stuff inside it that needs to float and then clear within #content only. But when I try to clear inside #content, it clears the #sidebar's float as well, despite #sidebar being outside o...

How do you get a float[] out of an ArrayList in Java

I have gotten a float array stuck inside of a ArrayList. the arraylist contains a Boolean and the afore mentioned float array. my courrent code to get it out (which doesn't work) is (float)((Float)((Number)(DXY.get(0)); I would prefer to not have to change the things inside, but if absolutely necessary I could pass the Boolean as a 1...

ruby float parse

like a float: if i == 2.0 i want to get: 2 if i == 2.3 or 2.23 i want to get: 2.3 or 2.23 thanks ...

Problem with array assignment

Hey guys, I've got the following problem with an array assignment... I've got a global float array in Global.java declared as... public static float camObjCoord[] = new float[8000]; I'm then filling its contents with. public void addcube(float highx, float lowx, float highz, float lowz){ //Constructing new cube... Sy...

Problem dynamically drawing a cube

Hey guys, I've got a float array camObjCoord declared as.. public static float camObjCoord[] = new float[8000]; I'm then filling its indexes in a class that does something like the following.. public void addcube(float highx, float lowx, float highz, float lowz){ //Constructing new cube... System.out.pri...