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 6832883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:54:46+00:00 2026-05-26T22:54:46+00:00

I’m trying force BigDecimal to use symbols (Ex. Instead of Decimal.multiply, do Decimal *),

  • 0

I’m trying force BigDecimal to use symbols (Ex. Instead of Decimal.multiply, do Decimal *), because of the mass parenthesis being involved in this problem.

Can you guys tell me if there’s a way to use symbols on BigDecimal without converting it to Double or something? Or can you convert t into a format like term?

double t = ((1.00 / f1) * ((((4.00 / (ak1 + 1.00)) - (2.00 / (ak1 + 4.00))) - (1.00 / (ak1 + 5.00))) - (1 / (ak1 + 6.00))));

To a format like

term = ((one.divide(f,mc)).multiply(((((four.divide((ak.add(one)),mc)).subtract((two.divide((ak.add(four)),mc)))).subtract((one.divide((ak.add(five)),mc)))).subtract((one.divide((ak.add(six)),mc))))));

I’ve tried recording it lots of times, and spent almost 6 hours trying to figure out where I’m getting wrong with the BigDecimal.

  • 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-26T22:54:47+00:00Added an answer on May 26, 2026 at 10:54 pm

    Nope. Since there is no operator overloading in Java.

    To make things simpler for yourself write the equation out in parts and identity the bits that are complicated or repeated several times. Break up your computation into these parts and even write helper methods to help you get the sum computed. If you write the whole computation in parts then each part is easier to test.

    eg.

    import static java.math.BigDecimal.ONE;
    
    public class Sum {
    
        private static final TWO = new BigDecimal("2");
        private static final FOUR = new BigDecimal("4");
        private static final FIVE = new BigDecimal("5");
        private static final SIX = new BigDecimal("6");
    
        private BigDecimal f;
        private BigDecimal ak;
    
        private MathContext mc;
    
        public Sum(BigDecimal f, BigDecimal ak, MathContext mc) {
            this.f = f;
            this.ak = ak;
            this.mc = mc;
        }
    
        public BigDecimal calculate() {
    
            return inverse(f).multiply(
                firstSubtractRest(
                    xOverYPlusZ(FOUR, ak, ONE),
                    xOverYPlusZ(TWO, ak, FOUR),
                    xOverYPlusZ(ONE, ak, FIVE),
                    xOverYPlusZ(ONE, ak, SIX),
    
                ));
    
        }
    
        private BigDecimal inverse(BigDecimal x) {
            return ONE.divide(x, mc);
        }
    
        /* returns x / (y + z) */
        private BigDecimal xOverYPlusZ(BigDecimal x, BigDecimal y, BigDecimal z) {
            BigDecimal divisor = y.add(z);
            return x.divide(divisor, mc);
        }
    
        private BigDecimal firstSubtractRest(BigDecimal... values) {
            BigDecimal value = values[0];
            for (int i = 1; i < values.length; i++) {
                value = value.subtract(values[i]);
            }
            return value;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.