Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107361 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76837 invoked from network); 2 Oct 2019 15:33:45 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 2 Oct 2019 15:33:45 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 2D34F2D1F81 for ; Wed, 2 Oct 2019 06:14:40 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Wed, 2 Oct 2019 06:14:39 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id q64so17046959ljb.12 for ; Wed, 02 Oct 2019 06:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7X+wHwmhqdYVcHm2KloJInCcDcjUkVlgyhM1s2x1GOg=; b=Ht+YQvPozYtRR28LCRQHM446ZRqWNg/9t9pg/IYtLUAnbmvLvyjF6j+9934uIt3UpS kN52p0YT3XTNbaeJvbx9zRiKT0v1JBNzWf/TWvwKoNXIp3OshxNZQlANGNQpPfOtxe2C 12Pf9aMfKhly6Z0reJjAz++5aymLxIlGbJXB6j2JfdUoSrNLuJ9/3x5cjOkVzVNU2bSX D+RLd5Mf+0XJpy/e2SN+88rxICxlw1NeIMXUwMC8/htMDXNXLzRxkEebukyf3luQzyiM +4Zb10gGawuyB7dMHD/mGn8WK3eX7QaQUr9ODcJAJyc2mLp3wuVl3pQqRg+x87QKcN3C vv/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7X+wHwmhqdYVcHm2KloJInCcDcjUkVlgyhM1s2x1GOg=; b=Q3CbmtLFlJ4/58ozwAsYRMCsLvwsrThC/FeYkUWg5XEiNmoafUxZ5sncbAQIg5lROC WwfjTj/Fx/TNk3s3ucFMp17/Dlv4FxRUDfOE+xgoGK2b/a9VSK8oenL1eTIR2FPT0CNj baB7RByiTrqwsYbjR1CvoI2eHUE5ivKPso/gjzBrmKQsJ+om7j+eaSyvewQn5OD8CXkU laUHnd8GYiZr3e7IcCtneqF0FFFEzzGnJthL1U3UZL40vbyR4yN0eL5/CwezFb4dybqj d3+8CFUqpny7/a4M4KOVzqpmEih2Afo9Fw9s4G/FmF5cgCr+IDtAbZ7YbtinvqfLy2Ur 7QkQ== X-Gm-Message-State: APjAAAWWyD9dLPp6uDA5dCBWJgMKUGqcpf6zpq02+kSINIXOjVn9BNHz keJnP5GfCPQdkJYmDlM92zGOJqrt0K+rgDFEkBHzjxaqNQk= X-Google-Smtp-Source: APXvYqwRn/x5XVke1g57m8lr89mxDGxQP7RR3LGfV2k/1v8FuXPGDl21f/js2jETBjZsVJMW2bxfAuF5Ibtwgfl+XM4= X-Received: by 2002:a2e:9943:: with SMTP id r3mr2542795ljj.171.1570022077782; Wed, 02 Oct 2019 06:14:37 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 2 Oct 2019 15:14:21 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000003c5c640593ed40fd" X-Envelope-From: Subject: fdiv() function From: nikita.ppv@gmail.com (Nikita Popov) --0000000000003c5c640593ed40fd Content-Type: text/plain; charset="UTF-8" Hi internals, I would like to add an fdiv() function in PHP 8, implemented in https://github.com/php/php-src/pull/4769. Per https://wiki.php.net/rfc/engine_warnings the main division operation will switch to throwing DivisionByZeroError on division by zero. However, I think it is important to expose a division with IEEE-754 semantics for division by zero for the use-cases that do need this. It is fairly tricky and not very efficient to implement this by hand in userland code, primarily due to correct handling for negative zero. The fdiv() function will perform a floating-point division while treating division by zero as a perfectly legal operation, and will not emit any kind of diagnostic in that case. Instead it will return the INF/-INF/NAN result mandated by IEEE-754. It mirrors the existing fmod() function. Does anyone see an issue with this addition? Regards, Nikita --0000000000003c5c640593ed40fd--