3

I'm thinking of doing an experiment with a JS program to utilize Japanese Multiplication, and I want to ask whether or not a software math shortcut is actually a shortcut at all.

To be clear, I'm contemplating writing a program to get benchmarks for the comparison of normal multiplication and Japanese Multiplication via programming, and I'd like to ask whether or not this makes sense to do before spending time to build the experiment.

Remember, this is a question of whether or not this question is appropriate for this site. Any additional thoughts on the topic should be described either in the comments or answers to the actual question.

I've also asked whether or not this question would be appropriate on Mathematics SE, and Computer Science SE, and Programmers SE:

Theoretically, the question would look like this:

Japanese Multiplication simulation - is a program actually capable of improving calculation speed? Or am I doomed from the start?

On SuperUser, I asked a (possibly silly) question about processors using mathematical shortcuts and would like to have a look at the possibility at the software application of that concept.

I'd like to write a JS simulation of Japanese Multiplication to get benchmarks on large calculations utilizing the shortcut vs traditional CPU multiplication. I'm curious as to whether it makes sense to do this.

enter image description here

My Question: I'd like to know whether or not a software math shortcut, as described above is actually a shortcut at all.


This is a question of programming concept. By utilizing the simulation of Japanese Multiplication, is my program actually capable of improving calculation speed? Or am I doomed from the start?

My theory is that since addition is computed faster than multiplication, a simulation of Japanese multiplication may actually allow a program to multiply (large) numbers faster than the CPU arithmetic unit can. I think this would be a very interesting finding, if it proves to be true.

1
  • 3
    Japanese Multiplication is exactly the same as western multiplication, but performed graphically. In a processor, the ALU uses the same technique, but for base 2. I.e. it has a grid of zero or one lines and uses binary adders to get the result. Convert this to binary and you actually have a very neat way to demonstrate how an ALU does multiplication. :-D Jul 7, 2014 at 9:01

2 Answers 2

7

It isn't a good fit for SO. But you might try asking it on Programmers.

If you do, you will want to read their Topics to discuss before posting. Also, you would want to go through the rest of their help center as you should with any site before participating.

If you ask on SO, it is likely to get downvoted, closed, and possibly deleted quickly since it isn't about a specific programming issue.

-1

The thing is, I don't know if you should be using JS to benchmark something like this. I mean, it all depends how precise you want it. I assume you are going to make some web app using JS. If you aren't going to make a web app, I would go with C/C++.

I think this is an interesting thing to code, though. But, I think since programming languages are kind of based off of normal multiplication, it may not work as well?

If you write a JS program for Japanese Multiplication, unless you represent it all in just numbers, it might be slower than normal multiplication.

The reason for Japanese Multiplication being faster could be less technical, but culture or heritage. For example, maybe people who grew up with Japanese Multiplication may find it easier than some guy from Spain.

In order to perform a fair test, you need to write both functions (normal and japanese) with the same complexity (like O(n) or O(log n) etc) and see which one produces results first. (maybe).

This is just random thoughts in my head. I could be all wrong, thus: Meta

11
  • Thanks for your input. As far as C++ goes, I'm purely interested in web development, so I would only be interested in doing this in JS, via client-side or Node JS. I've just asked this question on Meta Programmers. meta.programmers.stackexchange.com/questions/6663/…
    – user2700923
    May 18, 2014 at 2:22
  • @jt0dd After reading more info from your updated post, in my opinion, it COULD be maybe faster. But this depends on the number of operations JS does. Generally, addition should be faster than multiplication I think. It's definitely a thing to try out. But you should count the number of operations normal multiplication does (in terms of browser operations.) and count how many operations the Japanese method is. Your limitation would be that you are using the browser to do the benchmarking of speed, so it'll ALL depend on browser and the user's CPU/RAM etc. May 18, 2014 at 2:25
  • 2
    This does not actually answer the question at hand which is if the question is appropriate for SO
    – codeMagic
    May 18, 2014 at 2:26
  • @codeMagic I see. I was directed here from chat. Bummer I ran into this. May 18, 2014 at 2:27
  • And I'm not expecting it to be faster for smaller calculations. I'm more curious about the general concept of a program actually performing a mathematical calculation faster than the processor's native capability. If it's any faster, then it's a successful and pretty interesting finding, I think. I'm thinking that the shortcut could possibly beat the CPU arithmetic unit when very large numbers are involved.
    – user2700923
    May 18, 2014 at 2:28
  • I'll respond on your Programmers post. May 18, 2014 at 2:31
  • I see what you're saying with the browser limitation, but it seems to me that both the raw and shortcut versions of the calculation would be subject to the same limitations. @KevinTomiyoshiYang
    – user2700923
    May 18, 2014 at 2:31
  • never mind. I don't have rep in Programmers. I'm using a diff account. Actually, of COURSE calculations can be faster than what a CPU can handle. In the world of mathematics, the thing limiting our advancement IS the limiting factor of binary 1 and 0 operations. But we would need to build a separate computing device to fit for other mathematics. Example: theoretical quantum computing. May 18, 2014 at 2:37
  • Yeah, you could be right that both raw and shortcut would have same limitations. But you also have to note that Browsers could have precedence systems that do things in order of importance. It may not be the same as using C. But you should still get a close-enough result. May 18, 2014 at 2:37
  • 1
    @KevinTomiyoshiYang Maybe my questions will spark interest in one of the other three communities and a C++ programmer will build his own bench mark and share it
    – user2700923
    May 18, 2014 at 3:16
  • @jt0dd That would be very interesting! But yeah, I think it's totally possible that the Japanese Multiplication can exceed what the CPU can handle, and will start to bottleneck. Could be the future futuristic soundeffect May 18, 2014 at 3:48

You must log in to answer this question.