Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: sdp on May 31, 2013, 07:46:11 PM



Title: Separators after the decimal place.
Post by: sdp on May 31, 2013, 07:46:11 PM
It is time people start using thousand separators (,) after the decimal place.

Is this easy to read? 1.00143781  or 1.001,437,81?
I believe that for most people the number 0.00001 BTC written as 0.000,01 BTC is a lot more readable.


Title: Re: Separators after the decimal place.
Post by: Blazr on May 31, 2013, 07:49:36 PM
The ideal solution would be to write it in a different unit such as milliBTC.

So 1.00143781 BTC  becomes 1001.143781 mBTC, much easier to read.


Title: Re: Separators after the decimal place.
Post by: Remember remember the 5th of November on May 31, 2013, 07:51:08 PM
It is time people start using thousand separators (,) after the decimal place.

Is this easy to read? 1.00143781  or 1.001,437,81?
I believe that for most people the number 0.00001 BTC written as 0.000,01 BTC is a lot more readable.
No it's not, why on earth did you even think of this?


Title: Re: Separators after the decimal place.
Post by: wopwop on May 31, 2013, 08:32:16 PM
sdp has spoken

it is time


Title: Re: Separators after the decimal place.
Post by: threeip on June 01, 2013, 12:00:20 AM
It is time people start using thousand separators (,) after the decimal place.

Is this easy to read? 1.00143781  or 1.001,437,81?
I believe that for most people the number 0.00001 BTC written as 0.000,01 BTC is a lot more readable.
No it's not, why on earth did you even think of this?


Title: Re: Separators after the decimal place.
Post by: Caesium on June 01, 2013, 12:04:04 AM
Sweet Jesus no. That looks wrong on so many levels. If you want to express amounts in mBTC or Satoshis and then use thousand separators where they're supposed to be, on the LEFT SIDE OF THE DOT, then people would understand it.


Title: Re: Separators after the decimal place.
Post by: Buffer Overflow on June 01, 2013, 12:15:51 AM
0.00001 BTC is better written as 1000 satoshis.


Title: Re: Separators after the decimal place.
Post by: dave111223 on June 01, 2013, 01:10:23 AM
I like it


Title: Re: Separators after the decimal place.
Post by: someguy123 on June 01, 2013, 01:39:29 AM
It is time people start using thousand separators (,) after the decimal place.

Is this easy to read? 1.00143781  or 1.001,437,81?
I believe that for most people the number 0.00001 BTC written as 0.000,01 BTC is a lot more readable.

This could create more confusion, as different countries use different decimal separators, i.e. 1.00749781 <==> 1,00749781.

I think mBTC or satoshis would be a better unit of measure.
Well, mBTC already causes enough confusion. I really hate when sites try to tell me I'm going to get 0,1 mBTC or 12,1 uBTC  :-\


Title: Re: Separators after the decimal place.
Post by: kjj on June 01, 2013, 02:03:25 AM
Two common solutions are suffixes (m-, u-, n-) and spaces ( 0.00001 -> 0.000 01 ).

Even in cultures that use arabic numerals, the radix designator is not universally standardized.  Plenty of people would have written my example as 0,000 01, and it gets worse if you also have a bunch of digits to the left.



Title: Re: Separators after the decimal place.
Post by: sdp on June 07, 2013, 12:47:49 PM
Two common solutions are suffixes (m-, u-, n-) and spaces ( 0.00001 -> 0.000 01 ).

Even in cultures that use arabic numerals, the radix designator is not universally standardized.  Plenty of people would have written my example as 0,000 01, and it gets worse if you also have a bunch of digits to the left.



In Argentina they use dots for separators and commas for decimal points.  You can set whatever your convention you want, the software should read the locale preferences and use those.

Code:
#include <iostream>
#include <algorithm>
#include <string.h>
#include <locale>
#include <math.h>
#include <complex>
#include <ctype.h>
#include <boost/foreach.hpp>
#include <sstream>
using namespace std;

# reads a number with thousand separators in it and one character that the value is put into v
# the last character read is left in c.  The first character read in is c after that
# characters are read in from in.
template<class fp_type> void read_with_commas(istream& in, fp_type & v, char & c) {
int sign = 1;
if (c == '-') {
sign = -1;
c = in.get();
}
v = 0.0;
while (c != '.') {
if (c != ',') {
if (isdigit(c)) {
v *= 10;
v += (c - '0');
} else {
return;
}
}
c = in.get();
}
if (c == '.') {
fp_type order = 1;
c = in.get();
while (isdigit(c) || c==',') {
if (c != ',') {
order /= 10;
v += order * (c - '0');
}
c = in.get();
}
}
}


template<class fp_type,int sig_figs> void print_with_commas(ostream& os, fp_type v) {
char comma = use_facet<numpunct<char> >(cout.getloc()).thousands_sep();
if (v < 0) {
os << "-";
v = -v;
}
fp_type this_error = v * pow(10,-sig_figs);
long long integer_part = (long long)v;
int exp = 0;
long long power10_exp = 1;
while (power10_exp * 10 < integer_part) {
power10_exp *= 10;
exp++;
}
// skip leading zeroes
while (exp > 0 && (((integer_part / power10_exp) % 10) == 0)) {
power10_exp /= 10;
--exp;
}
// power_exp < integer_part < power_exp * 10
int limit = sig_figs;
while (exp > 0) {
os << (char)(((integer_part / power10_exp) % 10) + '0');
power10_exp /= 10;
if (exp % 3 == 0)
os << comma;
--exp;
--limit;
}
os << (char)((integer_part % 10)+'0');
fp_type dv(v);
if ((dv - integer_part) != 0 && limit > 0) {
// now we use for past the decimal place
os << ".";
unsigned short digit;
dv -= integer_part;
exp = -1;
while (this_error < dv && --limit > 0) {
dv *= 10;
this_error *= 10;
digit = (unsigned short)dv;
os << digit;
if (exp-- % 3 == 0)
os << comma;
dv -= digit;
}
}
}


template<class fp_type> class btc_complex : public complex<fp_type> {
public:
btc_complex() : complex<fp_type>() {}
btc_complex(fp_type x) : complex<fp_type>(x) {}
btc_complex(fp_type a, fp_type b) : complex<fp_type>(a,b) {}
};

ostream& operator << (ostream& os, const btc_complex<double> z) {
print_with_commas<double,15>(os, z.real());
if (z.imag() != 0) {
os << "+";
print_with_commas<double,15>(os, z.imag());
os << "I";
}
return os;
}
ostream& operator << (ostream& os, const btc_complex<long double> z) {
print_with_commas<long double,19>(os, z.real());
if (z.imag() != 0) {
os << "+";
print_with_commas<double,19>(os, z.imag());
os << "I";
}
return os;
}
ostream& operator << (ostream& os, const btc_complex<float> z) {
print_with_commas<long double,6>(os, z.real());
if (z.imag() != 0) {
os << "+";
print_with_commas<double,6>(os, z.imag());
os << "I";
}
return os;
}

template<class fp_type> istream& operator >> (istream& in, btc_complex<fp_type>& z) {
fp_type real, imag;
char c = in.get();
read_with_commas(in, real, c);
if (c =='I' || c=='i') {
z = btc_complex<fp_type>(0,real);
} else if (c == '+') {
read_with_commas(in, imag, c);
if (c != 'I') {
in.setstate(ios::failbit);
}
z = btc_complex<fp_type>(real,imag);
} else {
z = real;
in.putback(c);
}
return in;
}


struct test_case {
double val;
string lit;
};

int main(int argc, char **argv) {
    {
   
try {
cout.imbue(std::locale("en_US"));
} catch ( ... ) {

}

test_case tests[] = { { 43112279.75467,"43,112,279.754,67"} , {0.0101020204,"0.010,102,020,4"}, {0.00000001,"0.000,000,01"} };
BOOST_FOREACH(test_case c, tests) {
ostringstream oss;
complex<double> oz = c.val;
btc_complex<double> z = c.val;

try {
oss.imbue(std::locale("en_US"));
} catch ( ... ) {

cout << c.val << " = " << z << endl;
oss << z;
if (oss.str() == c.lit) {
cout << "test successful." << endl;
} else {
cout << "test failed: expected " << c.lit << ", but got " << oss.str() << endl;
}
oss.str( "" );
}

BOOST_FOREACH(test_case c, tests) {
istringstream iss;
btc_complex<double> z;
iss.str(c.lit);
iss >> z;
if (z == c.val) {
cout << "test successful." << endl;
} else {
cout << "test failed: expected " << c.val << ", but got " << z << endl;
}
}

    }

    return 0;
}

The last test fails with expected 1e-08 but got 0.000,000,01.   1e-08 clearly is the same as 0.000,000,01.  I knew I was pushing my luck with a simple equality comparison for doubles.  I forced US in the test case, so that the values can be tested.


Title: Re: Separators after the decimal place.
Post by: Dayne on June 07, 2013, 01:10:01 PM
I get where the OP is coming from. 0.00005340 is kinda hard to read, but then again 0.000,053,40 kinda opens up a whole new can of worms.

I think that the push to adopt mBTC as the standard unit of currency is a better solution that causes less extra confusion. 0.05340 is a lot easer to understand, you can clearly see that 0.05 is about a 20th, 5% of the value of one unit of the currency, it's easier to understand than either 0.00005340 or 0.000,053,40 in my opinion.

So I think we should go with that.

mBTC!


Title: Re: Separators after the decimal place.
Post by: sdp on June 07, 2013, 01:17:39 PM
I get where the OP is coming from. 0.00005340 is kinda hard to read, but then again 0.000,053,40 kinda opens up a whole new can of worms.

I think that the push to adopt mBTC as the standard unit of currency is a better solution that causes less extra confusion. 0.05340 is a lot easer to understand, you can clearly see that 0.05 is about a 20th, 5% of the value of one unit of the currency, it's easier to understand than either 0.00005340 or 0.000,053,40 in my opinion.

So I think we should go with that.

mBTC!

Genereally speaking, Maybe we are just not used to decimals going so far.  Maybe its nicer to say something like
42 BTC, 231 mBTC, and 230 uBTC.  Like dollars and cents.


Title: Re: Separators after the decimal place.
Post by: jackjack on June 07, 2013, 01:18:14 PM
It is time people start using thousand separators (,) after the decimal place.
I love when people don't ask what the community thinks but instead states that 'It is time people start doing X'


Title: Re: Separators after the decimal place.
Post by: Abdussamad on June 07, 2013, 01:48:59 PM
You can just use satoshis and you won't have to worry about decimal points.


Title: Re: Separators after the decimal place.
Post by: DeathAndTaxes on June 07, 2013, 02:06:03 PM
Why use digits that provide no useful meaning.  Do you routinely price things in 1/10,000th of a US penny?

At current exchange rates 0.1 mBTC is worth 0.12 US cents.  Do you really need more precision than that.  I mean would you expect a retailer in a USD store to price something as $123.45678912 or maybe they would just round it to the nearest cent ($123.46).

In your example the following values have the following precision of purchasing power.
Code:
1.00143781 = $110.85916557
1.0014378  = $110.85916446
1.001437   = $110.85907590
1.00143    = $110.85830100
1.0014     = $110.85498000
1.001      = $110.81070000

In most examples even the 1 mBTC precision = ~$0.11 is sufficient.  A merchant for example is unlikely to have a profit margin where rounding with $0.06 gain or loss on a $110 product materially affects balances.   For all other scenarios 0.1 mBTC is probably sufficient.  The rest of the decimal
places simply add noise without any value no matter how you write them.

So as a merchant I would just write it as 1.001 BTC or 1,0001 mBTC.  

As a practical example I don't find constraining my prices to 1mBTC precision to be a problem.

See here: https://bitcointalk.org/index.php?topic=227532.0

Price widget.  http://btcticker.appspot.com/mtgox/495.00usd.png  Is that hard to read or understand?  I don't feel that adding more digits materially changes things.  If the price keeps rising I could see going to 4 digits (0.1 mBTC precision) at around the $200 exchange rate but not 5,6,7, or 8 digits.


I really think prices will move to mBTC because people do generally dislike extended decimal places.  If you want to get some marketing effect maybe "On Sale Only 999 mBTC.  Buy Now!".





Title: Re: Separators after the decimal place.
Post by: Sukrim on June 07, 2013, 02:24:55 PM
It is time people start using thousand separators (,) after the decimal place.

Actually, the "thousand seperator" is a "." and the "decimal seperator" is a "," around here... 1.000,001 is perfectly valid for 1000 + 0.001.
When was the last time you saw a car priced down to cents? A house down to single dollars?

This (using seperators right from the decimal seperator) is not part of any standard I know of, please link a ISO or DIN standard that one can adhere to in this matter and don't invent your own stuff.


Title: Re: Separators after the decimal place.
Post by: greyhawk on June 07, 2013, 02:48:02 PM
> separators after the decimal place.

Don't tell me you named yourself after that idea....  :P


Title: Re: Separators after the decimal place.
Post by: sdp on June 07, 2013, 03:06:09 PM
It is time people start using thousand separators (,) after the decimal place.

Actually, the "thousand seperator" is a "." and the "decimal seperator" is a "," around here... 1.000,001 is perfectly valid for 1000 + 0.001.
When was the last time you saw a car priced down to cents? A house down to single dollars?

This (using seperators right from the decimal seperator) is not part of any standard I know of, please link a ISO or DIN standard that one can adhere to in this matter and don't invent your own stuff.

I don't claim there is an ISO standard.  Can you find the one that says it must be for the whole number part?  I have decided this is helpful in reading numbers.  But I have to agree that perhaps normally such precision is not needed, you may send the bitcoin amounts under 0.001 to the address in my sig.



Title: Re: Separators after the decimal place.
Post by: Sukrim on June 07, 2013, 03:12:33 PM
How to spot new members without looking at their post count or signup date, number 718:
Refers to bitcoin address in signature with a "witty" remark that loose change should be sent there.

 ::)

Quoting http://en.wikipedia.org/wiki/ISO_31-0#Numbers:
Quote
Numbers consisting of long sequences of digits can be made more readable by separating them into groups, preferably groups of three, separated by a small space. For this reason, ISO 31-0 specifies that such groups of digits should never be separated by a comma or point, as these are reserved for use as the decimal sign.


Title: Re: Separators after the decimal place.
Post by: greyhawk on June 07, 2013, 03:19:21 PM
How to spot new members without looking at their post count or signup date, number 718:
Refers to bitcoin address in signature with a "witty" remark that loose change should be sent there.

Nah, I still do that. Worked out pretty well so far too.


Title: Re: Separators after the decimal place.
Post by: ThatDGuy on June 07, 2013, 03:22:46 PM
How to spot new members without looking at their post count or signup date, number 718:
Refers to bitcoin address in signature with a "witty" remark that loose change should be sent there.

Nah, I still do that. Worked out pretty well so far too.

It's much preferred to the other option of large font, colored spammy advertisements that new members are rolling in with sometimes.


Title: Re: Separators after the decimal place.
Post by: bitcoinbear on June 07, 2013, 09:36:13 PM
I sometimes add a space to help make the number more readable. Like the price for a share of S.MPOE is something like 0.00072828 bitcoins, you could write that as  0.000 728 28  to make it more readable. The problem with that is the space makes it hard to know where the number ends. An alternative would be to use ` (on my keyboard it is on the same key as the tilde, ~, but I never use it for anything), so the price would be 0.000`728`28 which is also more readable than having no separators. What is that mark even called?

If you want to have lots of precision in your database or whatever, you could write numbers like 11`258`124.000`999`94 using the tick mark before and after the decimal separator.


Title: Re: Separators after the decimal place.
Post by: frott on June 07, 2013, 09:47:16 PM
I sometimes add a space to help make the number more readable. Like the price for a share of S.MPOE is something like 0.00072828 bitcoins, you could write that as  0.000 728 28  to make it more readable. The problem with that is the space makes it hard to know where the number ends. An alternative would be to use ` (on my keyboard it is on the same key as the tilde, ~, but I never use it for anything), so the price would be 0.000`728`28 which is also more readable than having no separators. What is that mark even called?

` is a grave

´ is an acute



Title: Re: Separators after the decimal place.
Post by: kjj on June 07, 2013, 10:42:04 PM
` is also commonly called a backtick.  I've even seen it called that by non-unix/non-technical people to disambiguate the thing on the keyboard and the thing in ASCII from a "proper" grave.  In fact, I'm not sure that it is even technically a "grave" when it isn't attached to a vowel.

Similar problems come up with quotation marks.  ASCII has "single quote" and "double quote", but again, they aren't "proper", so some people call those versions by those names to distinguish them from actual real "quotation marks".