scientific-notation

write_csv read_csv with scientific notation after 1000th row

只愿长相守 提交于 2019-12-05 14:09:24
Writing a data frame with a mix of small integer entries (value less than 1000) and "large" ones (value 1000 or more) into csv file with write_csv() mixes scientific and non-scientific entries. If the first 1000 rows are small values but there is a large value thereafter, read_csv() seems to get confused with this mix and outputs NA for scientific notations: test_write_read <- function(small_value, n_fills, position, large_value) { tib <- tibble(a = rep(small_value, n_fills)) tib$a[position] <- large_value write_csv(tib, "tib.csv") tib <- read_csv("tib.csv") } The following lines do not make

Converting a working code from double-precision to quadruple-precision: How to read quadruple-precision numbers in FORTRAN from an input file

自作多情 提交于 2019-12-05 13:48:17
I have a big, old, FORTRAN 77 code that has worked for many, many years with no problems. Double-precision is not enough anymore, so to convert to quadruple-precision I have: Replaced all occurrences of REAL*8 to REAL*16 Replaced all functions like DCOS() into functions like COS() Replaced all built-in numbers like 0.d0 to 0.q0 , and 1D+01 to 1Q+01 The program compiles with no errors or warnings with the gcc-4.6 compiler on operating system: openSUSE 11.3 x86_64 (a 64-bit operating system) hardware: Intel Xeon E5-2650 (Sandy Bridge) My LD_LIBRARY_PATH variable is set to the 64-bit library

Java DecimalFormat Scientific Notation Question

穿精又带淫゛_ 提交于 2019-12-05 10:49:43
I'm using Java's DecimalFormat class to print out numbers in Scientific Notation. However, there is one problem that I have. I need the strings to be of fixed length regardless of the value, and the sign on the power of ten is throwing it off. Currently, this is what my format looks like: DecimalFormat format = new DecimalFormat("0.0E0"); This gives me the following combinations: 1.0E1, 1.0E-1, -1.0E1, and -1.0E-1. I can use setPositivePrefix to get: +1.0E1, +1.0E-1, -1.0E1, and -1.0E-1, or whatever I like, but it doesn't affect the sign of the power! Is there any way to do this so that I can

Convert scientific notation to decimal - python

帅比萌擦擦* 提交于 2019-12-05 06:29:19
How do I convert a scientific notation to floating point number? Here is an example of what I want to avoid: Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a=[78.40816326530613, 245068094.16326532] >>> print a[0]/a[1] 3.19944395589e-07 >>> print float(a[0]/a[1]) 3.19944395589e-07 >>> print float(a[0])/float(a[1]) 3.19944395589e-07 Dhara The scientific notation is just a convenient way of printing a floating point number. When there are a lot of leading zeros as in your example, the scientific notation

Suppress Scientific Format in a Dataframe Column

半腔热情 提交于 2019-12-05 02:37:47
I have a column called accountnumber with values similar to 4.11889000e+11 in a pandas dataframe. I want to suppress the scientific notation and convert the values to 4118890000. I have tried the following method and did not work. df = pd.read_csv(data.csv) pd.options.display.float_format = '{:,.3f}'.format Please recommend. I assume the exponential notation for the account numbers must come from the data file. If I create a small csv with the full account numbers, pandas will interpret them as integers. acct_num 0 4118890000 1 9876543210 df['acct_num'].dtype Out[51]: dtype('int64') However,

Convert scientific notation to decimal notation

眉间皱痕 提交于 2019-12-04 04:26:06
问题 There is a similar question on SO which suggests using NumberFormat which is what I have done. I am using the parse() method of NumberFormat. public static void main(String[] args) throws ParseException{ DecToTime dtt = new DecToTime(); dtt.decToTime("1.930000000000E+02"); } public void decToTime(String angle) throws ParseException{ DecimalFormat dform = new DecimalFormat(); //ParsePosition pp = new ParsePosition(13); Number angleAsNumber = dform.parse(angle); System.out.println(angleAsNumber

R scientific notation in plots

*爱你&永不变心* 提交于 2019-12-04 04:25:52
I have a simple plot: #!/usr/bin/Rscript png('plot.png') y <- c(102, 258, 2314) x <- c(482563, 922167, 4462665) plot(x,y) dev.off() R uses 500, 1000, 1500, etc for the y axis. Is there a way I can use scientific notation for the y axis and put * 10^3 on the top of the axis like the figure below? This is sort of a hacky way, but there's nothing wrong with it: plot(x,y/1e3, ylab="y /10^3") A similar technique is to use eaxis (extended / engineering axis) from the sfsmisc package. It works like this: library(sfsmisc) x <- c(482563, 922167, 4462665) y <- c(102, 258, 2314) plot(x, y, xaxt="n", yaxt

Format C# Double to Scientfic Notation in powers with multiples of three

跟風遠走 提交于 2019-12-04 03:24:21
问题 I'm trying to format some large numbers in scientific format, but I need the power in multiples of three. Is there a recommended way to do this? I have a range of numbers in a table and instead of true scientific format (with a single digit before the decimal point) I'm happy to have that change in order to have a power with a multiple of three, for example: 3.123e+003 19.523e+003 Rather than: 3.123e+003 1.952e+004 Having all the powers as multiples of three makes my table easier to scan, I

Extract scientific number from string

北战南征 提交于 2019-12-03 20:12:18
问题 I am trying to extract scientific numbers from lines in a text file. Something like Example: str = 'Name of value 1.111E-11 Next Name 444.4' Result: [1.111E-11, 444.4] I've tried solutions in other posts but it looks like that only works for integers (maybe) >>> [int(s) for s in str.split() if s.isdigit()] [] float() would work but I get errors each time a string is used. >>> float(str.split()[3]) 1.111E-11 >>> float(str.split()[2]) ValueError: could not convert string to float: value Thanks

Why do powers of 10 print in scientific notation at the 5th power?

孤者浪人 提交于 2019-12-03 06:29:04
问题 I would like to know if and how the powers of 10 are related to the printing of scientific notation in the console. I've searched R docs and haven't found anything relevant, or that I really understand. First off, my scipen and digits settings are unlist(options("scipen", "digits")) # scipen digits # 0 7 Now, powers of 10 are printed normally up to the 4th power, and then printing switches to scientific notation at the 5th power. 10^(1:4) # [1] 10 100 1000 10000 10^(1:5) # [1] 1e+01 1e+02 1e