Time |
S |
Nick |
Message |
05:41 |
|
|
kirua joined ##friendlyjava |
05:50 |
|
|
kirua_ joined ##friendlyjava |
07:01 |
|
|
mr_lou joined ##friendlyjava |
07:15 |
|
|
df0_ joined ##friendlyjava |
08:06 |
|
|
xBADDA555 joined ##friendlyjava |
10:53 |
|
|
xBADDA555 joined ##friendlyjava |
11:51 |
|
|
xBADDA555 joined ##friendlyjava |
12:37 |
|
|
xBADDA555 joined ##friendlyjava |
12:42 |
|
|
xBADDA555 joined ##friendlyjava |
12:44 |
|
|
xBADDA555 joined ##friendlyjava |
14:17 |
|
aditsu |
is there a DecimalFormat that behaves like Double.toString? |
14:44 |
|
|
df0_ joined ##friendlyjava |
15:27 |
|
pdurbin |
How does it behave? I should upgrade to Java 9 so I can have a REPL. |
17:07 |
|
aditsu |
pdurbin: e.g. 1 -> "1.0", 1e50 -> "1.0e50" |
17:10 |
|
aditsu |
scala has a REPL |
17:12 |
|
aditsu |
pdurbin: there's also http://www.javarepl.com |
17:16 |
|
pdurbin |
"###.##" according to https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html I guess. "123456.79" as output |
17:18 |
|
aditsu |
"###.##" gives "1" and "100000000000000000000000000000000000000000000000000" |
17:18 |
|
aditsu |
just like toString.. except totally different :p |
17:19 |
|
aditsu |
also, 123456.789 is supposed to come out as "123456.789" |
17:23 |
|
pdurbin |
hmm, if you figure it out, please let us know |
17:23 |
|
aditsu |
so far, it looks like it doesn't exist, which is weird and sucks |
17:24 |
|
pdurbin |
time to ask on Stack Overflow, I guess |
17:25 |
|
aditsu |
oh yeah, I forgot about that.. |
17:34 |
|
|
aditsu joined ##friendlyjava |
17:42 |
|
aditsu |
posted: https://stackoverflow.com/questions/47251895/is-there-a-decimalformat-that-behaves-like-double-tostring |
17:53 |
|
pdurbin |
looks good |
17:54 |
|
* pdurbin |
votes it up |
18:53 |
|
pdurbin |
aditsu: is it using `FloatingDecimal.toJavaFormatString`? See http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/d5a00b1e8f78/src/share/classes/java/lang/Double.java#l203 |
18:55 |
|
aditsu |
you mean toString? yes, that's internal implementation details.. |
18:55 |
|
aditsu |
not part of the public API |
18:56 |
|
pdurbin |
sure, but it would give you what you want, I would think |
18:57 |
|
aditsu |
if it had a format pattern, maybe |
18:59 |
|
pdurbin |
yeah, that's what I was hoping I'd find inside. no such luck |
19:37 |
|
|
df0_ joined ##friendlyjava |
20:53 |
|
aditsu |
I answered my own question.. |
22:38 |
|
|
kirua joined ##friendlyjava |
22:40 |
|
pdurbin |
Cool. Pretty complex answer. I guess you should accept your own answer, if you can. |