fixed-width

Fixed digits number in floats

本小妞迷上赌 提交于 2019-12-11 01:09:38
问题 I read a lot of discussion about this on SE, but still can't find the right one. I want to plot some numbers, of various lengths, with the same number of digits. For example I have: 12.345678 , 1.2345678 . Now, since I have to plot them with their error, I want that each one has a different format, in order that they are significant. So, I want to plot them with a variable number of decimals. In my case, it makes no sense to plot 23.45678+/-1.23456 but better is 23.4+/-1.2 . On the other hand

How can I extract columns from a fixed-width format in Perl?

♀尐吖头ヾ 提交于 2019-12-11 00:55:19
问题 I'm writing a Perl script to run through and grab various data elements such as: 1253592000 1253678400 86400 6183.000000 1253764800 86400 4486.000000 1253851200 36.000000 86400 10669.000000 1253937600 0.000000 86400 9126.000000 1254024000 0.000000 86400 2930.000000 1254110400 0.000000 86400 2895.000000 1254196800 0.000000 8828.000000 I can grab each line of this text file no problem. I have working regex to grab each of those fields. Once I have the line in a variable, i.e. $line - how can I

C# - String formatting: double fixed width

拈花ヽ惹草 提交于 2019-12-10 23:43:11
问题 How can I use String.Format in C# so doubles are displayed like this: Values: -1.0 1.011 100.155 1000.25 11000.52221 displayed string: -1.00 1.011 100.2 1000 11001 The main point is my width is fixed to 5 characters no matter what. I don't really care how many decimal places are shown to the right. If there are 4 or more numbers to the left of decimal I want everything right of the decimal to be dropped (including the decimal itself). It seems like something that should be a pretty standard

Portable C++ 03 Exact Width Types

好久不见. 提交于 2019-12-09 00:44:22
问题 Background Unfortunately the current C++ standard lacks C99's exact-width types defined in the stdint header. The next best thing I could find (in terms of portability) was Boost 's cstdint.hpp implementation from the Boost.Integer library. Concerns That said, I've got a few problems with it: Boost 's implementation dumps all the typedef s in the boost namesapce (instead of something like boost::stdint ). This is totally ugly, because now you're either forced to use a using -directive only on

Setting column width in a data set

人走茶凉 提交于 2019-12-08 12:52:45
问题 I would like to set column widths (for all the 3 columns) in this data set, as: anim=1-10; sireid=11-20; damid=21-30. Some columns have missing values. anim=c("1A038","1C467","2F179","38138","030081") sireid=c("NA","NA","1W960","1W960","64404") damid=c("NA","NA","1P119","1P119","63666") mydf=data.frame(anim,sireid,damid) 回答1: From reading your question as well as your comments to previous answers, it seems to me that you are trying to create a fixed width file with your data. If this is the

C99′s Fixed-Width Integer Types

梦想的初衷 提交于 2019-12-08 05:13:35
问题 Failing to get a detailed answer to my question here. I thought I would tackle it from a different angle. Would someone be able to explain what selection criteria are used for determining the underlying types for C99's fixed-width integer types: [u]int_fast[n]_t [u]int_least[n]_t [u]int[n]_t For a given processor, if 'long' and 'int' are the same size (sizeof(int) == sizeof(long)) then why would 'long' be used over 'int' or vice versa. 回答1: The whim of the author of <stdint.h> . Given that

Adding overflow-y to block element causes width to decrease.

∥☆過路亽.° 提交于 2019-12-08 04:41:25
问题 This is what I have, I have left div, and a right div. The left div is a fixed width, and floated left. The right Div is a "display: block" to make it full width, and has a margin on the left to compensate for the left div. Both of the boxes have a fixed height, and need to be scrollable (the contents inside). I add an overflow-y to the Left div successfully. However when I add overflow-y: auto to the right div, the div no longer spans the whole div. Before adding Overflow: http://jsbin.com

Error in read.fwf when header=TRUE

帅比萌擦擦* 提交于 2019-12-07 18:19:42
问题 I have simulated data that looks like this: LastName Date email CreditCardNum AgeZip Amount Paul 21/02/14 Aliquam.fringilla@dolordapibus.co.uk 4241033422900360 6738851$14.39 Bullock 2/7/2014adipiscing.fringilla@lectusjusto.org 5178789953524240 3336538$498.31 Mcmahon 11/5/2013lobortis.ultrices@lacus.org 5389589582467450 7734302$92.44 Walters 25/09/13 consectetuer.cursus.et@sitamet.org 5157094536097720 7794007$206.60 Franco 17/06/13 et@disparturientmontes.ca 345477952996264 2415873$89.12 and

When should I use UINT32_C(), INT32_C(),… macros in C?

人盡茶涼 提交于 2019-12-06 18:33:25
问题 I switched to fixed-length integer types in my projects mainly because they help me think about integer sizes more clearly when using them. Including them via #include <inttypes.h> also includes a bunch of other macros like the printing macros PRIu32 , PRIu64 ,... To assign a constant value to a fixed length variable I can use macros like UINT32_C() and INT32_C() . I started using them whenever I assigned a constant value. This leads to code similar to this: uint64_t i; for (i = UINT64_C(0);

Winapi ListView can't prevent columns from resizing

做~自己de王妃 提交于 2019-12-06 11:11:06
问题 I'm trying to create ListView with fixed width columns in winapi C++ project. I try use a trick with handling a HDN_BEGINTRACK notification in Dialog Box Procedure just by returning TRUE in it. As I understood from different articles it might work. Point is, that I catch it, but returning TRUE does not prevent from resizing. Also tried returning TRUE just after getting WM_NOTIFY - the same effect. Help me please. Here are some parts of code: BOOL InitInstance(HINSTANCE hInstance, int nCmdShow