Search Results

Search found 22308 results on 893 pages for 'floating point'.

Page 31/893 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Read half precision float (float16 IEEE 754r) binary data in matlab

    - by Michael
    you have been a great help last time, i hope you can give me some advise this time, too. I read a binary file into matlab with bit16 (format = bitn) and i get a string of ones and zeros. bin = '1 00011 1111111111' (16 bits: 1. sign, 2-6. exponent, 7-16. mantissa) According to ftp://www.fox-toolkit.org/pub/fasthalffloatconversion.pdf it can be 'converted' like out = (-1)^bin(1) * 2^(bin(2:6)-15) * 1.bin(7:16) [are exponent and mantissa still binary?] Can someone help me out and tell me how to deal with the 'eeeee' and '1.mmmmmmmmmm' as mentioned in the pdf, please. Thanks a lot! Michael

    Read the article

  • dividing double by double gives weird results - Java

    - by Aly
    Hi, I am trying to do the following 33.33333333333333/100.0 to get 0.333333333333333 however when I run System.out.println(33.33333333333333/100.0); I get 0.33333333333333326 as the output, similarly when I run System.out.println(33.33333333333333/1000.0); I get 0.033333333333333326 as the output. Does anyone know why, and how I can get the correct value (without loss of decimal places). Thanks

    Read the article

  • Controlling FPU behavior in an OpenMP program?

    - by STingRaySC
    I have a large C++ program that modifies the FPU control word (using _controlfp()). It unmasks some FPU exceptions and installs a SEHTranslator to produce typed C++ exceptions. I am using VC++ 9.0. I would like to use OpenMP (v.2.0) to parallelize some of our computational loops. I've already successfully applied it to one, but the numerical results are slightly different (though I understand it could also be due to calculations being performed in a different order). I'm assuming this is because the FPU state is thread-specific. Is there some way to have the OpenMP threads inherit that state from the master thread? Or is there some way to specify using OpenMP that new threads execute a particular function that sets up the correct state? What is the idiomatic way to deal with this situation?

    Read the article

  • CUDA: accumulate data into a large histogram of floats

    - by shoosh
    I'm trying to think of a way to implement the following algorithm using CUDA: Working on a large volume of voxels, for each voxel I calculate an index i and a value c. after the calculation I need to perform histogram[i] += c c is a float value and the histogram can have up to 15,000 bins. I'm looking for a way to implement this efficiently using CUDA. The first obvious problem is that with compute capabilities 1.3 which is what I'm using I can't even do an atomicAdd() of floats so how can I accumulate anything reliably? This example by nVidia does something somewhat simpler. The histograms are saved in the shared memory (which I can't do due to its size) and it only accumulates integers. Can this approach be generalized to my case?

    Read the article

  • Horizontal menu vertical padding on anchor tag doesn't take affect

    - by Levi
    I am wondering why in the following example the top and bottom padding has no affect on the anchor tag while the left and right does? <ul id="nav"> <li><a href="#">One</a></li> <li><a href="#">Two</a></li> <li><a href="#">Three</a></li> <li><a href="#">Four</a></li> <li><a href="#">Five</a></li> </ul> #nav{ list-style:none; } #nav li{ border:1px solid #666; display:inline; /*If you do it this way you need to set the top and bottom padding to be the same here as under #nav li a padding:8px 0; */ } #nav li a{ padding:8px 16px; } Example: Link So my main question is, why does the top and bottom padding not have an effect on the list items while the left and right do? I did try this out with a float instead of a display:inline on the list item and it worked as I expected it to. So I guess if I had a secondary question it would be what is the difference between a float:left; and a display:inline? I was reading the float spec and it sounds like a float is still a box online inline so somewhat like inline-block? I appreciate any input, this isn't really something I need to know to finish a project or anything, but I would like to know why. Thanks Levi

    Read the article

  • CSS Fluid Grid Layout Problem

    - by Fuego DeBassi
    I have a max-width em based container for my layout. Within it I have many floated fixed width boxes, at 230px to be exact. At the max-width the container will expand to 90em's. This fit's 6 boxes per line perfectly. As the window sizes down and boxes are bumped to lower rows it leaves an ugly gap with the navigation above. I would like to force the container of the boxes to center them at all times. To illustrate: At full width: http://cl.ly/7393a462f44b8315aaba At smaller width: http://cl.ly/ff48a18d39c4f57c3513 How I would like smaller width to work: http://cl.ly/ae9c3fd04df515253b2d (Photoshoped) My markup looks like this: Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. My CSS, is: div#bricks { margin:0 auto; background:red; width:100%; } div.brick { background:#181c21; width:230px; margin:0 5px 10px 5px; position:relative; float:left; } div.brick img { background:#666; max-width:230px; } The #bricks is inside a #main, which looks like: div#main { margin:0 auto; padding:0 50px; position:relative; max-width:90em; } Would love some ideas!

    Read the article

  • AudioQueue recording as float

    - by niklassaers
    Hi guys, I would like to have the result from my recording as a float in the range [0.0, 1.0], alternatively [-1.0, 1.0] because of a bit of math I want to do on it. When I set my recordingformat to be in float, like this: mRecordFormat.mFormatFlags = kLinearPCMFormatFlagIsFloat; I get: Error: AudioQueueNewInput failed ('fmt?') Does this mean the hardware doesn't support recording to floats? If not, how do I set it to record in floats? If so, are there any processor-friendly ways I can convert a signed integer array to a float array? Cheers Nik

    Read the article

  • Convert ieee 754 float to hex with c - printf

    - by Michael
    Ideally the following code would take a float in IEEE 754 representation and convert it into hexadecimal void convert() //gets the float input from user and turns it into hexadecimal { float f; printf("Enter float: "); scanf("%f", &f); printf("hex is %x", f); } I'm not too sure what's going wrong. It's converting the number into a hexadecimal number, but a very wrong one. 123.1443 gives 40000000 43.3 gives 60000000 8 gives 0 so it's doing something, I'm just not too sure what. Help would be appreciated

    Read the article

  • sprintf() to truncate and not round a float to x decimal places?

    - by jerrygarciuh
    Hi folks, When calculating a golf handicap differential you are supposed to truncate the answer to 1 decimal place without rounding. No idea why but... I know how to do this using TRUNCATE() in mySQL SELECT TRUNCATE( 2.365, 1 ); // outputs 2.3 but I was wondering if sprintf() could do this? The only way I know to work with decimal places in a float is ... echo sprintf("%.1f", 2.365); // outputs 2.4 TIA JG

    Read the article

  • Heuristic to identify if a series of 4 bytes chunks of data are integers or floats

    - by flint
    What's the best heuristic I can use to identify whether a chunk of X 4-bytes are integers or floats? A human can do this easily, but I wanted to do it programmatically. I realize that since every combination of bits will result in a valid integer and (almost?) all of them will also result in a valid float, there is no way to know for sure. But I still would like to identify the most likely candidate (which will virtually always be correct; or at least, a human can do it). For example, let's take a series of 4-bytes raw data and print them as integers first and then as floats: 1 1.4013e-45 10 1.4013e-44 44 6.16571e-44 5000 7.00649e-42 1024 1.43493e-42 0 0 0 0 -5 -nan 11 1.54143e-44 Obviously they will be integers. Now, another example: 1065353216 1 1084227584 5 1085276160 5.5 1068149391 1.33333 1083179008 4.5 1120403456 100 0 0 -1110651699 -0.1 1195593728 50000 These will obviously be floats. PS: I'm using C++ but you can answer in any language, pseudo code or just in english.

    Read the article

  • how should I order my divs?

    - by aslum
    Here's the basic layout of a page I'm working on: What would be the best/easiest way to order the divs? C may or may not be visible (it's a news alert that only displays when there is news). A = Header, B = Menu, E&F = standard content columns, D = latest blog post. I'm thinking ABCEFD might make the most sense, but I could also see ABCDEF. Either of those should be fairly easy to do right using floats... is there a better way? Maybe put CEF inside a "middle column" div?

    Read the article

  • Significant figures in the decimal module

    - by Jason Baker
    So I've decided to try to solve my physics homework by writing some python scripts to solve problems for me. One problem that I'm running into is that significant figures don't always seem to come out properly. For example this handles significant figures properly: from decimal import Decimal >>> Decimal('1.0') + Decimal('2.0') Decimal("3.0") But this doesn't: >>> Decimal('1.00') / Decimal('3.00') Decimal("0.3333333333333333333333333333") So two questions: Am I right that this isn't the expected amount of significant digits, or do I need to brush up on significant digit math? Is there any way to do this without having to set the decimal precision manually? Granted, I'm sure I can use numpy to do this, but I just want to know if there's a way to do this with the decimal module out of curiosity.

    Read the article

  • How can I encode four unsigned bytes (0-255) to a float and back again using HLSL?

    - by Statement
    Hello! I am facing a task where one of my hlsl shaders require multiple texture lookups per pixel. My 2d textures are fixed to 256*256, so two bytes should be sufficient to address any given texel given this constraint. My idea is then to put two xy-coordinates in each float, giving me eight xy-coordinates in pixel space when packed in a Vector4 format image. These eight coordinates are then used to sample another texture(s). The reason for doing this is to save graphics memory and an attempt to optimize processing time, since then I don't require multiple texture lookups. By the way: Does anyone know if encoding/decoding 16 bytes from/to 4 floats using 1 sampling is slower than 4 samplings with unencoded data?

    Read the article

  • CSS: "float:left" doesn't work as expected

    - by Patrick
    hi, I want to display 2 columns of images using "float:left", and I dunno why the 3rd image is on the right. See screenshot:http://dl.dropbox.com/u/72686/imagesFloat.png See HTML: <div class="field-item odd"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%202.png" title=""><br> <span>description1</span> </div> <div class="field-item even"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%203.png" title=""><br> <span>description2</span> </div> <div class="field-item odd"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%204.png" title=""><br> <span>description3</span> </div> <div class="field-item even"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%205.png" title=""><br> <span></span> </div> see CSS: .field-field-image .odd { padding-right:20px; } .field-field-image .even { padding-left:20px; } .field-field-image .field-item { float:left; } thanks

    Read the article

  • php calculate float HELP!!

    - by apis17
    help!! i have weird math calculation here. hope someone will explain. $a = 1.85/100; $b = 1.5/100; $c = 1.1/100; $d = 0.4/100; $e = 0.4/100; $f = 0.4/100; $g = 0.4/100; $h = $a + $b + $c + $d + $e + $f + $g; echo $h*100 ."<br>"; $i = $h-$a; $i = $i-$b; $i = $i-$c; $i = $i-$d; $i = $i-$e; $i = $i-$f; $i = $i-$g; echo $i; last $i value should be 0 but it returns 6.93889390391E-18

    Read the article

  • Fast sign in C++ float...are there any platform dependencies in this code?

    - by Patrick Niedzielski
    Searching online, I have found the following routine for calculating the sign of a float in IEEE format. This could easily be extended to a double, too. // returns 1.0f for positive floats, -1.0f for negative floats, 0.0f for zero inline float fast_sign(float f) { if (((int&)f & 0x7FFFFFFF)==0) return 0.f; // test exponent & mantissa bits: is input zero? else { float r = 1.0f; (int&)r |= ((int&)f & 0x80000000); // mask sign bit in f, set it in r if necessary return r; } } (Source: ``Fast sign for 32 bit floats'', Peter Schoffhauzer) I am weary to use this routine, though, because of the bit binary operations. I need my code to work on machines with different byte orders, but I am not sure how much of this the IEEE standard specifies, as I couldn't find the most recent version, published this year. Can someone tell me if this will work, regardless of the byte order of the machine? Thanks, Patrick

    Read the article

  • Change column height as other column gets longer

    - by Infiniti Fizz
    Hi, I have tried a few things to solve this problem but I can't seem to get it working. The problem is that I have 2 columns as the main part of my website, right and left. On some pages, there is a lot of text in the left column, therefore it is very long, the problem is that the right column doesn't elongate with the left column. Both columns have the same background colour and a footer s displayed across the width of both columns after the columns finish. My first thought was to put both columns inside a div which would have the same background colour as them and therefore if the left column became 1500px long in total and the right column stayed at around 600px (due to the elements inside it) then this wouldn't show as the new, outer div would elongate along with the left column. But for some reason this didn't work. Could it be because the columns are floated? Does anyone have any other ideas? Here is the website (Obviously not finished yet): Beansheaf Hotel I have chosen a page where there is a lot of text in the left column so the problem is apparent. Thanks in advance, InfinitiFizz

    Read the article

  • Compare sign of two doubles

    - by bobobobo
    What's the fastest way to compare sign on a double? I know that a double has a "sign bit" but I'm not sure if the way I'm "looking for it" in its binary rep is a good idea or not. Barring "portability" issues, can someone tell me what's going on with this code in MSVC++? #include <stdio.h> int main() { double z = 5.0 ; __int64 bitSign ; __int64 *ptr ; ptr = (__int64*)&z ; for( __int64 sh = 0 ; sh < 65 ; sh++ ) { bitSign = 1L << sh ; // Weird. it doesn't do 1. printf( "Bit# %d (%llx): %lld\n", sh, bitSign, ( (*ptr) & bitSign) ) ; } } First, why is starting at bit 32, even though I only shifted by one bit? Second, is it ok for me to check the 64th bit of a double to check its sign on MSVC++? Or is there a more preferred way?

    Read the article

  • Inaccurate Logarithm in Python

    - by Avihu Turzion
    I work daily with Python 2.4 at my company. I used the versatile logarithm function 'log' from the standard math library, and when I entered log(2**31, 2) it returned 31.000000000000004, which struck me as a bit odd. I did the same thing with other powers of 2, and it worked perfectly. I ran 'log10(2**31) / log10(2)' and I got a round 31.0 I tried running the same original function in Python 3.0.1, assuming that it was fixed in a more advanced version. Why does this happen? Is it possible that there are some inaccuracies in mathematical functions in Python?

    Read the article

  • x86-64 long double precision

    - by aaa
    hello. What is the actual precision of long double on Intel 64-bit platforms? is it 80 bits padded to 128 or actual 128 bit? if former, besides going gmp, is there another option to achieve true 128 precision?

    Read the article

  • How do I find hash value of a 3D vector ?

    - by brainydexter
    I am trying to perform broad-phase collision detection with a fixed-grid size approach. Thus, for each entity's position: (x,y,z) (each of type float), I need to find which cell does the entity lie in. I then intend to store all the cells in a hash-table and then iterate through to report (if any) collisions. So, here is what I am doing: Grid-cell's position: (int type) (Gx, Gy, Gz) = (x / M, y / M, z / M) where M is the size of the grid. Once, I have a cell, I'd like to add it to a hash-table with its key being a unique hash based on (Gx, Gy, Gz) and the value being the cell itself. Now, I cannot think of a good hash function and I need some help with that. Can someone please suggest me a good hash function? Thanks

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >