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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:54:09+00:00 2026-06-18T12:54:09+00:00

I am getting a couple of values from a database query. The values that

  • 0

I am getting a couple of values from a database query. The values that I am getting look like:

10.810000000000000497 and I want to use just ‘10.81’.

or

2.6899999999999999467 and I want to use just 2.69

when using ini_set('precision', 20);

How how should I use this values with bcadd() for example? As I just want to add 10.81 + 2.69?

  • 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-18T12:54:10+00:00Added an answer on June 18, 2026 at 12:54 pm

    The php BC_ functions has another option: scale.

    $num1 = 10.810000000000000497;
    $num2 = 2.6899999999999999467;
    $result = bcadd($num1, $num2, 2);
    echo $result; // 13.50
    

    If you want to use it several times you may use bcscale() and such you won’t need to specify the third option each time you use it:

    bcscale(2);
    $num1 = 10.810000000000000497;
    $num2 = 2.6899999999999999467;
    $result = bcadd($num1, $num2);
    echo $result; // 13.50
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a small script that gathers a couple exif values from images... namely
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
Possible Duplicate: Consuming a Web service using Javascript Please note that I'm still getting
I have a json object that I'm loading from wordpress using the JSON API
Using the distance logic from this SO post , I'm getting back a properly-filtered
After having a couple of issues getting DQS installed , it appears to be
Getting 401 errors when trying to use ASP.NET back end in load balanced environment
I'm trying to compare a couple of array values stored in a flat file
I'm using Tapestry 4. I have several TextFields whose values get passed into Strings
I'm simply trying to get data from two sql server db tables using ado.net

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.