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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:31:57+00:00 2026-05-30T10:31:57+00:00

Basically, using the following code on a file stream, I get the following: $basis

  • 0

Basically, using the following code on a file stream, I get the following:

$basis = $2 * 1.0;
$cost = ($basis - 2500.0) ** 1.05;
# The above should ensure that both cost & basis are floats
printf "  %f -> %f", $basis, $cost;
if ($basis gt $cost) {  # <- *** THIS WAS MY ERROR: gt forces lexical!
    $cost = $basis;
    printf " -> %f", $cost;
}

Outputs:

  10667.000000 -> 12813.438340
  30667.000000 -> 47014.045519
  26667.000000 -> 40029.842300
  66667.000000 -> 111603.373367 -> 66667.000000
  8000.000000 -> 8460.203780
  10667.000000 -> 12813.438340
  73333.000000 -> 123807.632158 -> 73333.000000
  6667.000000 -> 6321.420427 -> 6667.000000
  80000.000000 -> 136071.379474 -> 80000.000000

As you can see, for most values, the code appears to work fine.

But for some values…. 66667, 80000, and a few others, ActivePerl 5.14 tells me that 66667 > 1111603!!!

Does anyone know anything about this – or have an alternate Perl interpreter I might use (Windows). Because this is ridiculous.

  • 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-30T10:31:58+00:00Added an answer on May 30, 2026 at 10:31 am

    You are using a lexical comparison instead of the numerical one

    $cost = ($basis - 2500.0) ** 1.05;
    printf "  %f -> %f", $basis, $cost;
    if ($basis > $cost) {
        $cost = $basis;
        printf " -> %f", $cost;
    }
    

    ps: revised to match the updated question

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

Sidebar

Related Questions

i have following code in applet that basically writes some data to a file
I am using the following method to basically create a JSON string. var saveData
EDIT: I am basically running into the following documented issue . I am using
Basically, I'd like to do the following, only using Common Lisp instead of Python:
Basically, I have been using both Integer.Parse and CInt in most of my daily
I'm trying to copy files inside a Python script using the following code: inf,outf
I have code that manipulates binary files using fstream with the binary flag set
I'm using the following regular expression basically to search for and delete these characters.
I have the following code in C# and .net 3.5 that is working fine
I am tyring to write some Java code that basically just plays a short

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.