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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:34:45+00:00 2026-06-01T08:34:45+00:00

Why is rfd_total > max_rfd true? I don’t understand how rfd_total can be greater

  • 0

Why is rfd_total > max_rfd true? I don’t understand how rfd_total can be greater than max_rfd in the following code:

max_rfd = parseFloat(jQuery('#mx-rfd_'+order_id).val()).toFixed(2);

rfd_total = parseFloat(items_total+tax_total+shipping+allowances*1).toFixed(2);


if( rfd_total > max_rfd)
{   if(isNaN(rfd_total)) alert('rfd_total isNaN'); // not triggered
    if(isNaN(max_rfd)) alert('max_rfd isNaN'); // not triggered
    alert(rfd_total); // alerts 51.16
    alert(max_rfd); // alerts 102.32
    return false;
}
  • 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-06-01T08:34:46+00:00Added an answer on June 1, 2026 at 8:34 am

    It’s because rfd_total an max_rfd are Strings.

    You will notice that "51.16" > "102.32" returns true.

    toFixed() returns a string.

    You will need to coerce your variables to numbers, which you can find out how to do with a quick search.

    Or you can keep your code clean and do it properly using a function such as this one

    function decimalRoundTo(n, decimalPlaces) {
        var d = Math.pow(10, decimalPlaces);
        return Math.round(n*d)/d;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Python Interpreter (v2.6.5) raises the above error in the following codepart: fd =
Basicaly I have my aspx page doing <% Response.Clear(); Response.Write({\Success\: \true\ }); Response.End(); %>
I made a program called embed The source code is below. The Problem :
My C++ Library function is int RFD_startBackgroundThread() My code in the overlay.js is uri
I have a Windows Forms App that loads a dll @ runtime and executes
My problem is multi-layered. I wanted to write a windows service that executes a
I do not know how to properly use divisor ip core from xilinx and
I have a basic 8-bit ALU described in Verilog. I am trying to implement
i am having trouble splitting a string in c# with a delimiter of ][.
I've got a problem where I have to read from a named pipe. I

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.