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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:50:08+00:00 2026-06-03T08:50:08+00:00

$temp is currently 6. But the variable result can be changing every time to

  • 0

$temp is currently 6. But the variable result can be changing every time to a different number so it is not a fixed value.

Anyway, for this $temp * 1.1666666, the result will be 6.99999996. Since I used the floor function, it will be rounded down to 6.

Is there any way when the value is more then>*.49999 it will stay at *.5 instead of *?

Example: 6.51111111, 6.78948123, 6.9747124

Expected Output: 6.5

Example: 6.49999999, 6.12412431, 6.33452361

Expected Output: 6

Do note that, $temp value will be ever changing..thank you!

  • 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-03T08:50:09+00:00Added an answer on June 3, 2026 at 8:50 am

    Try this code…

    <?php 
    
        $temp = 6.94444;
        echo myRound($temp);
    
       function myRound($temp)
        {
            $frac = $temp - floor($temp);
            $frac = ($frac >= .5) ? .5 : 0;
            return ( floor($temp) + $frac );
        }
    
    ?>
    

    Hope this is what you want.

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

Sidebar

Related Questions

Sorry for wall of text, but currently stumped. I'm not asking to be spoon
I'm currently doing this my $tmpf = File::Temp->new; $tmpf->unlink_on_destroy(1); but it seems like this
Application[temp] = 8; should set the value 8 to the key temp . However,
I'm creating a temp table that's the result of a stored procedure's result set.
Any way to do this quickly without using a temp variable? Is there a
I'm trying to use a temp table in a table-valued function, but it seems
{ ..... result *temp = [suff objectAtIndex:indexPath.row]; NSLog(@%@, temp.pid); cell.pidlab.text = temp.pid; ...... }
NOTE: I am really not very good at Multithreaded programming, but my current project
I'm pretty sure this is going to be obvious, but currently im doing this:
Currently, I use Path.GetTempPath() to figure out where to write my log files, but

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.