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

  • Home
  • SEARCH
  • 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 360097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:27:22+00:00 2026-05-12T12:27:22+00:00

I am doing one multiplication operation between two float variables. After that i need

  • 0

I am doing one multiplication operation between two float variables. After that i need to check for numeric overflow, underflow and divide by zero errors if any.

How I can do this?

  • 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-12T12:27:23+00:00Added an answer on May 12, 2026 at 12:27 pm

    Here’s a way to check for overflow (which is actually just floating point +Infinity and -Infinity):

    #!perl -w
    use strict;
    
    my $x = 10 ** 200;
    my $positive_overflow = $x * $x;
    my $negative_overflow = -$x * $x;
    
    print is_infinity($positive_overflow) ? 'true' : 'false';
    print "\n";
    print is_infinity($negative_overflow) ? 'true' : 'false';
    print "\n";
    
    sub is_infinity
    {
        my $x = shift;
        return $x =~ /inf/i;
    }
    

    Division by zero is tricky because you can’t actually perform the division in normal program scope without having it die on you. You can wrap it in eval though:

    #!perl -w
    use strict;
    
    my $x = 100;
    my $y = 0;
    
    my $q = try_divide($x, $y);
    print "Might be division by zero...\n" if !defined $q;
    
    $y = 10;
    $q = try_divide($x, $y);
    print "$q\n";
    
    sub try_divide
    {
        my $x = shift;
        my $y = shift;
        my $q;
    
        eval { $q = $x / $y };
    
        return $q;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 191k
  • Answers 191k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, of is presumably a static method which is imported… May 12, 2026 at 6:11 pm
  • Editorial Team
    Editorial Team added an answer RSpec creates a lib/tasks/rspec.rake file. And redefines the stats directories… May 12, 2026 at 6:11 pm
  • Editorial Team
    Editorial Team added an answer Try this: Dim strFile As String = "yourfile.txt" Dim fileExists… May 12, 2026 at 6:11 pm

Related Questions

I am doing one web application in grails.Now I am making signup page.In signup
I am very new to grails.I am doing one sample project for image uploading
I am working on an fairly simple CRUD application in ASP.NET MVC. The rule
I have a class like class K { static int a; static int b;

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.