Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7688933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:02:38+00:00 2026-05-31T20:02:38+00:00

I am getting this error: integerMultiplication.rb:4:in `untMul’: stack level too deep (SystemStackError) in this

  • 0

I am getting this error:

integerMultiplication.rb:4:in `untMul': stack level too deep (SystemStackError)

in this code:

def untMul(x, y)
  xDigits = x.to_s.split(//).map{|chr| chr.to_i}
  yDigits = y.to_s.split(//).map{|chr| chr.to_i}
  n = xDigits.size
  a = xDigits[0, xDigits.size / 2]
  b = xDigits[xDigits.size / 2 ... xDigits.size]
  c = yDigits[0, yDigits.size / 2]
  d = yDigits[yDigits.size / 2 ... yDigits.size]
  ac = untMul(a,c)
  bd = untMul(b,d)
  adPlusBd = untMul(a + b, c + d) - ac - bd 
  return 10**n * ac + 10**n/2 * adPlusBd + bd
end

untMul(12, 54)

Could someone please help with understand what is going wrong here? I am trying to implement Karatsuba multiplication.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:02:39+00:00Added an answer on May 31, 2026 at 8:02 pm

    Infinite recursion is going on. untMul is calling itself repeatedly until the stack runs out of space. You need to set a condition case to make it complete before that happens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error on a compact framework form. code generation for property 'inputControl'
I'm getting this error with my current PHP code: Notice: TO id was not
Am getting this error for my code: Undefined symbols for architecture x86_64: _spendDollars, referenced
Getting this error while compiling C++ code: undefined reference to `__stack_chk_fail' Options already tried:
I getting this error when retrieve xml request from http://www.cbr.ru/scripts/XML_daily.asp XML code like this:
Getting this error with my fetch's predicate 2011-08-13 13:49:12.405 Codes[16957:10d03] NSlog Array: code BETWEEN
Im getting this error: 10-05 19:36:09.904: WARN/System.err(1039): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed Is
Getting this error while trying to compile a copied code from a Fortran 77
am getting this error on this code (this is an MVC project into which
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.