php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73912 provides "long double"
Submitted: 2017-01-11 02:56 UTC Modified: 2017-01-11 20:19 UTC
From: winbill at hotmail dot com Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Next Major Version OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
42 + 14 = ?
Subscribe to this entry?

 
 [2017-01-11 02:56 UTC] winbill at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.floatval
---

I need to deal with precision higher than double.
C/C++ provides long double, with gcc on linux, most negative value of a long double is 3.362103E-4932, and max value of a long double is 1.189731E+4932.

I hope PHP provides "long double" in the coming version.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-11 03:20 UTC] requinix@php.net
-Status: Open +Status: Suspended -Package: PHP Language Specification +Package: *General Issues
 [2017-01-11 03:20 UTC] requinix@php.net
A change like this would require an RFC. https://wiki.php.net/rfc/howto

In the meantime you can use bc. http://php.net/bc
 [2017-01-11 20:19 UTC] bwoebi@php.net
-Status: Suspended +Status: Wont fix
 [2017-01-11 20:19 UTC] bwoebi@php.net
This isn't necessarily the kind of change which would require a RFC…

I'm rather going to close this as Won't fix (at least taking the current engine into account). It'd basically have the consequence that we'd end up needing 24 bytes for zvals instead of 16, just for this little rarely needed feature.
That's in real world an increase of at least 15% in memory.

Which is not sustainable. Instead, better propose a custom object which allows manipulation of long doubles. (like GMP, where you can also use mathematical operators etc.)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 21:01:29 2024 UTC