Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
As you've probably noticed, Perl 5.036 is out.

While reading its delta (to decide what changes need to be done to Syntax::Construct), I noticed the following paragraph:

SIGFPE no longer deferred

Floating-point exceptions are now delivered immediately, in the same way as other "fault"-like signals such as SIGSEGV. This means one has at least a chance to catch such a signal with a $SIG{FPE} handler, e.g. so that die can report the line in perl that triggered it.

I tried to come up with code that triggers the Floating Point E{xception/rror} but I couldn't find any.

local $SIG{FPE} = sub { die "SIGNAL @_" }; my $x = 0; print 2 / $x;

I tried with sqrt -1, no difference. I asked on IRC and was given an example with Inline::C, but even that doesn't behave differently in the new Perl version:

#!/usr/bin/perl use warnings; use strict; use Inline 'C' => <<'__C__'; float killme() { volatile float f = 0.0; volatile float c = f / f; return c; } __C__ local $SIG{FPE} = sub { die "SIGNAL @_" }; print killme();

Can anyone provide an example that shows how the FPE signal is emitted and how its trapping is different in 5.36?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

In reply to FPE not deferred in 5.36 by choroba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-18 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found