{"thread":{"id":"42974","subject":"[PATCH] pass constants as first argument to st_mult()","startedAt":"2016-07-30T18:25:22Z","lastAt":"2016-08-03T20:12:41Z","messageCount":12,"participants":["René Scharfe","Jeff King","Junio C Hamano","Stefan Beller","Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"292657","messageId":"579CEF77.9070202@web.de","threadId":"42974","inReplyTo":null,"subject":"[PATCH] pass constants as first argument to st_mult()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-07-30T18:18:31Z","receivedAt":"2016-07-30T18:25:22Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"The result of st_mult() is the same no matter the order of its\narguments.  It invokes the macro unsigned_mult_overflows(), which\ndivides the second parameter by the first one.  Pass constants\nfirst to allow that division to be done already at compile time.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n diffcore-rename.c | 2 +-\n refs.c            | 2 +-\n shallow.c         | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/diffcore-rename.c b/diffcore-rename.c\nindex 58ac0a5..73d003a 100644\n--- a/diffcore-rename.c\n+++ b/diffcore-rename.c\n@@ -541,7 +541,7 @@ void diffcore_rename(struct diff_options *options)\n \t\t\t\trename_dst_nr * rename_src_nr, 50, 1);\n \t}\n \n-\tmx = xcalloc(st_mult(num_create, NUM_CANDIDATE_PER_DST), sizeof(*mx));\n+\tmx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));\n \tfor (dst_cnt = i = 0; i < rename_dst_nr; i++) {\n \t\tstruct diff_filespec *two = rename_dst[i].two;\n \t\tstruct diff_score *m;\ndiff --git a/refs.c b/refs.c\nindex 814cad3..b4e7cac 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -922,7 +922,7 @@ char *shorten_unambiguous_ref(const char *refname, int strict)\n \t\t\t/* -2 for strlen(\"%.*s\") - strlen(\"%s\"); +1 for NUL */\n \t\t\ttotal_len += strlen(ref_rev_parse_rules[nr_rules]) - 2 + 1;\n \n-\t\tscanf_fmts = xmalloc(st_add(st_mult(nr_rules, sizeof(char *)), total_len));\n+\t\tscanf_fmts = xmalloc(st_add(st_mult(sizeof(char *), nr_rules), total_len));\n \n \t\toffset = 0;\n \t\tfor (i = 0; i < nr_rules; i++) {\ndiff --git a/shallow.c b/shallow.c\nindex 4d554ca..54e2db7 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -389,7 +389,7 @@ static void paint_down(struct paint_info *info, const unsigned char *sha1,\n \tunsigned int i, nr;\n \tstruct commit_list *head = NULL;\n \tint bitmap_nr = (info->nr_bits + 31) / 32;\n-\tsize_t bitmap_size = st_mult(bitmap_nr, sizeof(uint32_t));\n+\tsize_t bitmap_size = st_mult(sizeof(uint32_t), bitmap_nr);\n \tuint32_t *tmp = xmalloc(bitmap_size); /* to be freed before return */\n \tuint32_t *bitmap = paint_alloc(info);\n \tstruct commit *c = lookup_commit_reference_gently(sha1, 1);\n-- \n2.9.2\n\n"},{"id":"292748","messageId":"20160801164723.mober7em6znt56w4@sigill.intra.peff.net","threadId":"42974","inReplyTo":"579CEF77.9070202@web.de","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-01T16:47:24Z","receivedAt":"2016-08-01T16:50:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jul 30, 2016 at 08:18:31PM +0200, René Scharfe wrote:\n\n> The result of st_mult() is the same no matter the order of its\n> arguments.  It invokes the macro unsigned_mult_overflows(), which\n> divides the second parameter by the first one.  Pass constants\n> first to allow that division to be done already at compile time.\n\nI'm not opposed to this, as it's easy to do (though I suspect new calls\nmay be introduced that violate it).\n\nBut if we really are worried about the performance of st_mult(), I\nthink:\n\n  static inline size_t st_mult(size_t a, size_t b)\n  {\n\tsize_t result;\n\tif (!__builtin_mul_overflow(a, b, &result))\n\t\tdie(\"whoops!\");\n\treturn result;\n  }\n\nis the right direction. I just haven't gotten around to producing a\npolished patch.\n\n> diff --git a/diffcore-rename.c b/diffcore-rename.c\n> index 58ac0a5..73d003a 100644\n> --- a/diffcore-rename.c\n> +++ b/diffcore-rename.c\n> @@ -541,7 +541,7 @@ void diffcore_rename(struct diff_options *options)\n>  \t\t\t\trename_dst_nr * rename_src_nr, 50, 1);\n>  \t}\n>  \n> -\tmx = xcalloc(st_mult(num_create, NUM_CANDIDATE_PER_DST), sizeof(*mx));\n> +\tmx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));\n\nI didn't look at all of the calls, but I wonder if it is a natural\npattern to put the constant second.  Since multiplication is\ncommutative, it would be correct for st_mult() to just flip the order of\narguments it feeds to unsigned_mult_overflows().\n\nThat may introduce the same inefficiency in other callsites, but I\nwonder if it would be fewer.\n\n-Peff\n"},{"id":"292793","messageId":"20160801211131.6ernsu74ohod2cin@sigill.intra.peff.net","threadId":"42974","inReplyTo":"xmqq8twgi4qp.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-01T21:11:31Z","receivedAt":"2016-08-01T21:12:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 01, 2016 at 02:00:46PM -0700, Junio C Hamano wrote:\n\n> > Since multiplication is\n> > commutative, it would be correct for st_mult() to just flip the order of\n> > arguments it feeds to unsigned_mult_overflows().\n> >\n> > That may introduce the same inefficiency in other callsites, but I\n> > wonder if it would be fewer.\n> \n> \"git grep -A3 st_mult \\*.c\" seems to tell me that the callsites with\n> a constant in their first parameter are the majority (many are\n> sizeof(something)).  The three places in the patch under discussion\n> are the only places that got them in the different order.\n\nThanks for checking. I should have been less lazy and done it myself.\nIf the majority are the other way, I agree that just fixing the minority\nis the best path forward.\n\n> *1* I have a slight suspicion that this is cultural, i.e. how\n> arithmetic is taught in grade schools.  When an apple costs 30 yen\n> and I have 5 of them, I was taught to multiply 30x5 to arrive at\n> 150, not 5x30=150, and I am guessing that is because the former\n> matches the natural order of these two numbers (cost, quantity) in\n> the language I was taught.\n\nYou might be right. I was trying to figure out what is \"natural\" for me\nin these cases, but after thinking about it for 2 minutes, I'm pretty\nsure anything resembling \"natural\" is lost as I try to out-think myself. :)\n\n-Peff\n"},{"id":"292795","messageId":"xmqq8twgi4qp.fsf@gitster.mtv.corp.google.com","threadId":"42974","inReplyTo":"20160801164723.mober7em6znt56w4@sigill.intra.peff.net","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-01T21:00:46Z","receivedAt":"2016-08-01T21:15:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> -\tmx = xcalloc(st_mult(num_create, NUM_CANDIDATE_PER_DST), sizeof(*mx));\n>> +\tmx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));\n>\n> I didn't look at all of the calls, but I wonder if it is a natural\n> pattern to put the constant second.  \n\nBetween\n\n    st_mult(GIT_SHA1_RAWSZ, i)\n    st_mult(i, GIT_SHA1_RAWSZ)\n\nthe former is more intuitive at least to me [*1*], but calloc(3) disagrees\nwith me.\n\n> Since multiplication is\n> commutative, it would be correct for st_mult() to just flip the order of\n> arguments it feeds to unsigned_mult_overflows().\n>\n> That may introduce the same inefficiency in other callsites, but I\n> wonder if it would be fewer.\n\n\"git grep -A3 st_mult \\*.c\" seems to tell me that the callsites with\na constant in their first parameter are the majority (many are\nsizeof(something)).  The three places in the patch under discussion\nare the only places that got them in the different order.\n\n\n[Footnote]\n\n*1* I have a slight suspicion that this is cultural, i.e. how\narithmetic is taught in grade schools.  When an apple costs 30 yen\nand I have 5 of them, I was taught to multiply 30x5 to arrive at\n150, not 5x30=150, and I am guessing that is because the former\nmatches the natural order of these two numbers (cost, quantity) in\nthe language I was taught.\n"},{"id":"292810","messageId":"xmqq60rkglym.fsf@gitster.mtv.corp.google.com","threadId":"42974","inReplyTo":"20160801211131.6ernsu74ohod2cin@sigill.intra.peff.net","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-01T22:31:45Z","receivedAt":"2016-08-01T22:35:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> *1* I have a slight suspicion that this is cultural, i.e. how\n>> arithmetic is taught in grade schools.  When an apple costs 30 yen\n>> and I have 5 of them, I was taught to multiply 30x5 to arrive at\n>> 150, not 5x30=150, and I am guessing that is because the former\n>> matches the natural order of these two numbers (cost, quantity) in\n>> the language I was taught.\n>\n> You might be right. I was trying to figure out what is \"natural\" for me\n> in these cases, but after thinking about it for 2 minutes, I'm pretty\n> sure anything resembling \"natural\" is lost as I try to out-think myself. :)\n\nDo native English speakers (or more in general Europeans) think of\nthe apple example more like \"5 apples, 30 cents each\", and do 5x30?\n"},{"id":"292966","messageId":"20160803191334.jflia6cqxqx2uqjx@sigill.intra.peff.net","threadId":"42974","inReplyTo":"xmqq60rkglym.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-03T19:13:34Z","receivedAt":"2016-08-03T19:14:32Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 01, 2016 at 03:31:45PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> >> *1* I have a slight suspicion that this is cultural, i.e. how\n> >> arithmetic is taught in grade schools.  When an apple costs 30 yen\n> >> and I have 5 of them, I was taught to multiply 30x5 to arrive at\n> >> 150, not 5x30=150, and I am guessing that is because the former\n> >> matches the natural order of these two numbers (cost, quantity) in\n> >> the language I was taught.\n> >\n> > You might be right. I was trying to figure out what is \"natural\" for me\n> > in these cases, but after thinking about it for 2 minutes, I'm pretty\n> > sure anything resembling \"natural\" is lost as I try to out-think myself. :)\n> \n> Do native English speakers (or more in general Europeans) think of\n> the apple example more like \"5 apples, 30 cents each\", and do 5x30?\n\nI think in my head I rewrite any multiplication like \"N of M\" as having\n\"N\" as the smaller number. I.e., it is conceptually simpler to me to\ncount five 30's, then 30 five's (even though I do not implement it in my\nhead as a sequence of additions, of course; I'd probably do that\nparticular case as \"half of ten 30's\").\n\nI have no idea if that's cultural or not, though. I'm pretty sure \"half\nof ten 30's\" was not taught in schools. All I remember of grade school\nmultiplication is them insisting we write down all of our steps, no\nmatter how trivial the problem would be to do in our heads. :)\n\n-Peff\n"},{"id":"292970","messageId":"20160803194913.cz6xiai3g5r3sghq@sigill.intra.peff.net","threadId":"42974","inReplyTo":"CAPc5daVABao1UZdPk0BnJNkTtYYV74Tw_0CZ9-uj9sK92h+x7g@mail.gmail.com","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-03T19:49:13Z","receivedAt":"2016-08-03T19:50:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 03, 2016 at 12:41:30PM -0700, Junio C Hamano wrote:\n\n> On Wed, Aug 3, 2016 at 12:13 PM, Jeff King <peff@peff.net> wrote:\n> > On Mon, Aug 01, 2016 at 03:31:45PM -0700, Junio C Hamano wrote:\n> >\n> > I think in my head I rewrite any multiplication like \"N of M\" as having\n> > \"N\" as the smaller number. I.e., it is conceptually simpler to me to\n> > count five 30's, then 30 five's (even though I do not implement it in my\n> > head as a sequence of additions, of course; I'd probably do that\n> > particular case as \"half of ten 30's\").\n> >\n> > I have no idea if that's cultural or not, though.\n> \n> Now, when you say \"count five 30's\", which one do you have\n> in mind? 5x30, or 30x5?\n> \n> If you meant the former, I think that _is_ cultural. I am pretty\n> sure that I was taught in school(s) to read 5x30 as adding 5\n> thirty times.\n\nI think I would say \"30x5\" in that case. But I'm not sure where that\ncomes from, and I'm not even 100% sure that I would say that (after\nthinking about it, it's hard for me to figure out what I would have done\nif I _hadn't_ just thought about it).\n\n-Peff\n"},{"id":"292971","messageId":"xmqqh9b18w0e.fsf@gitster.mtv.corp.google.com","threadId":"42974","inReplyTo":"20160803194913.cz6xiai3g5r3sghq@sigill.intra.peff.net","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-03T19:58:41Z","receivedAt":"2016-08-03T19:59:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Aug 03, 2016 at 12:41:30PM -0700, Junio C Hamano wrote:\n>\n>> On Wed, Aug 3, 2016 at 12:13 PM, Jeff King <peff@peff.net> wrote:\n>> > On Mon, Aug 01, 2016 at 03:31:45PM -0700, Junio C Hamano wrote:\n>> >\n>> > I think in my head I rewrite any multiplication like \"N of M\" as having\n>> > \"N\" as the smaller number. I.e., it is conceptually simpler to me to\n>> > count five 30's, then 30 five's (even though I do not implement it in my\n>> > head as a sequence of additions, of course; I'd probably do that\n>> > particular case as \"half of ten 30's\").\n>> >\n>> > I have no idea if that's cultural or not, though.\n>> \n>> Now, when you say \"count five 30's\", which one do you have\n>> in mind? 5x30, or 30x5?\n>> \n>> If you meant the former, I think that _is_ cultural. I am pretty\n>> sure that I was taught in school(s) to read 5x30 as adding 5\n>> thirty times.\n>\n> I think I would say \"30x5\" in that case. But I'm not sure where that\n> comes from, and I'm not even 100% sure that I would say that (after\n> thinking about it, it's hard for me to figure out what I would have done\n> if I _hadn't_ just thought about it).\n\nBy the way, reading \"30x5\" as \"count five 30's\" disagrees with\ncalloc(nmemb=5, size=30), which wants to add 30-byte necessary for\neach member 5 times to allocate 150 bytes.\n\nAnyway, this tangent is long enough ;-)\n\n\n"},{"id":"292973","messageId":"CAGZ79kYonA8pYfW68SC6YaZ84Gz2Eo_qXDxQJ14_62abcd8-Og@mail.gmail.com","threadId":"42974","inReplyTo":"20160803194913.cz6xiai3g5r3sghq@sigill.intra.peff.net","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-08-03T19:59:34Z","receivedAt":"2016-08-03T20:00:46Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Aug 3, 2016 at 12:49 PM, Jeff King <peff@peff.net> wrote:\n> On Wed, Aug 03, 2016 at 12:41:30PM -0700, Junio C Hamano wrote:\n>\n>> On Wed, Aug 3, 2016 at 12:13 PM, Jeff King <peff@peff.net> wrote:\n>> > On Mon, Aug 01, 2016 at 03:31:45PM -0700, Junio C Hamano wrote:\n>> >\n>> > I think in my head I rewrite any multiplication like \"N of M\" as having\n>> > \"N\" as the smaller number. I.e., it is conceptually simpler to me to\n>> > count five 30's, then 30 five's (even though I do not implement it in my\n>> > head as a sequence of additions, of course; I'd probably do that\n>> > particular case as \"half of ten 30's\").\n>> >\n>> > I have no idea if that's cultural or not, though.\n\nWell I think there is a difference between how you do the math in your head\nand between the textbook question.\n\nIn textbook I would expect 5x30, because first we need to talk about the\nobject before the price of the object makes sense:\n\"I am interested in 5 apples, and each apple costs 30 yen, so I am paying\n150 yen\". Only that in Europe you would substitute the 30 by 0.84 Euros\n(integer-> number with 2 values after comma, not quite a float).\n\nWhen doing the math in your head you look for the easy tricks, i.e.\nx5  = x10 /2 or such.\n\nI think I'd find calloc intuitive as a typical textbook question, \"I\nwant to have\nspace for \"foos\", which each cost 5 memory, go figure out how much I need\nand hand it back to me\".\n"},{"id":"292975","messageId":"CAP8UFD2ooGO+E05qNAkpR5cNDXjTLWh2NSO6NBZv-LctZOFSaw@mail.gmail.com","threadId":"42974","inReplyTo":"20160803191334.jflia6cqxqx2uqjx@sigill.intra.peff.net","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-03T19:56:09Z","receivedAt":"2016-08-03T20:04:10Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Wed, Aug 3, 2016 at 9:13 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Aug 01, 2016 at 03:31:45PM -0700, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>>\n>> >> *1* I have a slight suspicion that this is cultural, i.e. how\n>> >> arithmetic is taught in grade schools.  When an apple costs 30 yen\n>> >> and I have 5 of them, I was taught to multiply 30x5 to arrive at\n>> >> 150, not 5x30=150, and I am guessing that is because the former\n>> >> matches the natural order of these two numbers (cost, quantity) in\n>> >> the language I was taught.\n>> >\n>> > You might be right. I was trying to figure out what is \"natural\" for me\n>> > in these cases, but after thinking about it for 2 minutes, I'm pretty\n>> > sure anything resembling \"natural\" is lost as I try to out-think myself. :)\n>>\n>> Do native English speakers (or more in general Europeans) think of\n>> the apple example more like \"5 apples, 30 cents each\", and do 5x30?\n>\n> I think in my head I rewrite any multiplication like \"N of M\" as having\n> \"N\" as the smaller number. I.e., it is conceptually simpler to me to\n> count five 30's, then 30 five's (even though I do not implement it in my\n> head as a sequence of additions, of course; I'd probably do that\n> particular case as \"half of ten 30's\").\n>\n> I have no idea if that's cultural or not, though. I'm pretty sure \"half\n> of ten 30's\" was not taught in schools. All I remember of grade school\n> multiplication is them insisting we write down all of our steps, no\n> matter how trivial the problem would be to do in our heads. :)\n\nYeah, I would be tempted to write all the steps too like this:\n\n\"An apple costs 30 yen and I have 5 of them\" means:\n\nCost(1 apple) = 30 cents\nCost(5 apples) = 5 * Cost(1 apple) = 5 * 30 cents = 150 cents\n\nso it would be more \"5x30=150\" than \"30x5\" in this case for me.\n"},{"id":"292976","messageId":"20160803200459.hosgwqbgxnfc2jlz@sigill.intra.peff.net","threadId":"42974","inReplyTo":"CAGZ79kYonA8pYfW68SC6YaZ84Gz2Eo_qXDxQJ14_62abcd8-Og@mail.gmail.com","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-03T20:04:59Z","receivedAt":"2016-08-03T20:05:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 03, 2016 at 12:59:34PM -0700, Stefan Beller wrote:\n\n> I think I'd find calloc intuitive as a typical textbook question, \"I\n> want to have space for \"foos\", which each cost 5 memory, go figure out\n> how much I need and hand it back to me\".\n\nI think it is more a language question than a math one, though. Is it \"5\ninstances, costing 30 each\" or \"30-cost instances, 5 times\". They are\nthe same semantically (there is no \"30 instances of a 5-cost thing\",\nwhich does not map to the problem space), but just with a different\norder.\n\n-Peff\n"},{"id":"292978","messageId":"CAPc5daVABao1UZdPk0BnJNkTtYYV74Tw_0CZ9-uj9sK92h+x7g@mail.gmail.com","threadId":"42974","inReplyTo":"20160803191334.jflia6cqxqx2uqjx@sigill.intra.peff.net","subject":"Re: [PATCH] pass constants as first argument to st_mult()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-03T19:41:30Z","receivedAt":"2016-08-03T20:12:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Wed, Aug 3, 2016 at 12:13 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Aug 01, 2016 at 03:31:45PM -0700, Junio C Hamano wrote:\n>\n> I think in my head I rewrite any multiplication like \"N of M\" as having\n> \"N\" as the smaller number. I.e., it is conceptually simpler to me to\n> count five 30's, then 30 five's (even though I do not implement it in my\n> head as a sequence of additions, of course; I'd probably do that\n> particular case as \"half of ten 30's\").\n>\n> I have no idea if that's cultural or not, though.\n\nNow, when you say \"count five 30's\", which one do you have\nin mind? 5x30, or 30x5?\n\nIf you meant the former, I think that _is_ cultural. I am pretty\nsure that I was taught in school(s) to read 5x30 as adding 5\nthirty times.\n"}]}