[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 51c6865b 04/11: Use non-long double for duff_
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 51c6865b 04/11: Use non-long double for duff_fmt() |
Date: |
Fri, 29 Apr 2022 11:59:32 -0400 (EDT) |
branch: master
commit 51c6865b09183473e5daad0afb1ee59082bc915e
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Use non-long double for duff_fmt()
Long doubles are rarely formatted in lmi; doubles often are.
---
duff_fmt.hpp | 4 ++--
duff_fmt_test.cpp | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/duff_fmt.hpp b/duff_fmt.hpp
index 7f5541ef..5b9a516f 100644
--- a/duff_fmt.hpp
+++ b/duff_fmt.hpp
@@ -36,9 +36,9 @@
// Reference:
// http://groups.google.com/groups?selm=38C9B681.B8A036DF%40flash.net
-inline std::string duff_fmt(long double value)
+inline std::string duff_fmt(double value)
{
- if(value < 0.0L)
+ if(value < 0.0)
{
return '-' + duff_fmt(-value);
}
diff --git a/duff_fmt_test.cpp b/duff_fmt_test.cpp
index ac22e25a..b5dbcb31 100644
--- a/duff_fmt_test.cpp
+++ b/duff_fmt_test.cpp
@@ -133,13 +133,13 @@ int test_main(int, char*[])
_control87(0x00ff, 0x00ff);
#endif // defined __BORLANDC__
- long double volatile d = 0.0;
+ double volatile d = 0.0;
duff_fmt( 1.0 / d );
duff_fmt(-1.0 / d );
- if(std::numeric_limits<long double>::has_quiet_NaN)
+ if(std::numeric_limits<double>::has_quiet_NaN)
{
- duff_fmt(std::numeric_limits<long double>::quiet_NaN());
+ duff_fmt(std::numeric_limits<double>::quiet_NaN());
}
return 0;
- [lmi-commits] [lmi] master updated (a2c3a37c -> 92d90368), Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master 17f6042e 01/11: Test nonstandard "'" printf flag, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master 5e493f40 02/11: Rename ncnnnpnn, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master a87f01b0 03/11: Rename a function, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master 51c6865b 04/11: Use non-long double for duff_fmt(),
Greg Chicares <=
- [lmi-commits] [lmi] master e8d7f191 05/11: Use low-level functions for low-level work, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master 2202d220 09/11: Reimplement ledger_format() in terms of duff_fmt(), Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master d46e3440 07/11: Modernize duff_fmt(), Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master d838ad1f 06/11: Make number of decimals a duff_fmt() argument, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master e8d4b982 08/11: Measure ledger_format() speed, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master 92d90368 11/11: Designate release candidate 20220429T1437Z, Greg Chicares, 2022/04/29
- [lmi-commits] [lmi] master 542c0473 10/11: Augment unit test, Greg Chicares, 2022/04/29