powl: put literals back in - gnucap.git - Gnu Circuit Analysis Package

index : gnucap.git
Gnu Circuit Analysis Package
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix Salfelder <felix@salfelder.org>2025年11月13日 00:00:00 +0000
committerFelix Salfelder <felix@salfelder.org>2025年11月13日 00:00:00 +0000
commitdd0e7066641252c3d2e2beef4ec52193e725c564 (patch)
treefb09fe82fa89202bbdb39e937868897b2d960129
parent65fb9c74d90e13a9083ded4c48d47a4062a9798e (diff)
downloadgnucap-dd0e7066641252c3d2e2beef4ec52193e725c564.tar.gz
powl: put literals back in
they are more obviously constants
Diffstat
-rw-r--r--lib/ap_convert.cc 25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/ap_convert.cc b/lib/ap_convert.cc
index f857c176..deb44a5b 100644
--- a/lib/ap_convert.cc
+++ b/lib/ap_convert.cc
@@ -344,22 +344,19 @@ double CS::ctof()
// powers of 10 representable as double
static double pos_pwr[22] = {
- std::pow(10, 1), std::pow(10, 2), std::pow(10, 3), std::pow(10, 4),
- std::pow(10, 5), std::pow(10, 6), std::pow(10, 7), std::pow(10, 8),
- std::pow(10, 9), std::pow(10,10), std::pow(10,11), std::pow(10,12),
- std::pow(10,13), std::pow(10,14), std::pow(10,15), std::pow(10,16),
- std::pow(10,17), std::pow(10,18), std::pow(10,19), std::pow(10,20),
- std::pow(10,21), std::pow(10,22) };
+ 10., 100., 1000., 10000., 100000., 1000000., 10000000., 100000000.,
+ 1000000000., 10000000000., 100000000000., 1000000000000., 10000000000000.,
+ 100000000000000., 1000000000000000., 10000000000000000.,
+ 100000000000000000., 1000000000000000000., 10000000000000000000.,
+ 100000000000000000000., 1000000000000000000000., 10000000000000000000000.
+ };
// negative powers, long double multiplication is faster than double division
static long double neg_pwr[22] = {
- std::pow(10.L, -1.L), std::pow(10.L, -2.L), std::pow(10.L, -3.L),
- std::pow(10.L, -4.L), std::pow(10.L, -5.L), std::pow(10.L, -6.L),
- std::pow(10.L, -7.L), std::pow(10.L, -8.L), std::pow(10.L, -9.L),
- std::pow(10.L,-10.L), std::pow(10.L,-11.L), std::pow(10.L,-12.L),
- std::pow(10.L,-13.L), std::pow(10.L,-14.L), std::pow(10.L,-15.L),
- std::pow(10.L,-16.L), std::pow(10.L,-17.L), std::pow(10.L,-18.L),
- std::pow(10.L,-19.L), std::pow(10.L,-20.L), std::pow(10.L,-21.L),
- std::pow(10.L,-22.L)
+ .1L, .01L, .001L, .0001L, .00001L, .000001L, .0000001L, .00000001L,
+ .000000001L, .0000000001L, .00000000001L, .000000000001L, .0000000000001L,
+ .00000000000001L, .000000000000001L, .0000000000000001L,
+ .00000000000000001L, .000000000000000001L, .0000000000000000001L,
+ .00000000000000000001L, .000000000000000000001L, .0000000000000000000001L
};
// compute sign * val * 10^{expon}.
generated by cgit v1.2.3 (git 2.39.1) at 2025年11月24日 15:54:24 +0000

AltStyle によって変換されたページ (->オリジナル) /