Another attempt to get ppc64le to pass to_string test.

This commit is contained in:
Brad Bell 2022-02-01 19:19:59 -07:00
commit f150a34644

View file

@ -118,20 +118,23 @@ cat temp.out
# Patch to fix example/utility/to_string.cpp
# This will no longer be necessary once the upstread source > 20220000.1
cat << EOF > to_string.patch
26a27,38
> template <class Type>
> void print_error(
> const char* routine_name,
> const char* value_name,
> Type value,
> Type check,
> Type eps = Type(0) )
> { std::cout << routine_name << " error : ";
> std::cout << value_name << " - check = " << value - check;
> std::cout << ", eps = " << eps << "\n";
> return;
2c2
26a27,40
> template <class Float>
> Float epsilon(void)
> { size_t digits = size_t( std::numeric_limits<Float>::digits );
> Float radix = Float( std::numeric_limits<Float>::radix );
> Float result = Float(1);
> for(size_t i = 1; i < digits; ++i)
> result = result / radix;
> /*
> std::cout << "epsilon function = " << result;
> std::cout << ", limit = " << std::numeric_limits<Float>::epsilon();
> std::cout << "\n";
> */
> return result;
> }
32,36c44,51
32,36c46,53
< ++index;
< while( index < s.size() )
< result = Integer( 10 * result + (s[index++] - '0') );
@ -146,30 +149,14 @@ cat << EOF > to_string.patch
> { while( index < s.size() )
> result = Integer(10) * result + Integer(s[index++] - '0' );
> }
54a70,71
> if( max != check )
> print_error("signed_integer", "max", max, check);
59a77,78
> if( min != check )
> print_error("signed_integer", "min", min, check);
70a90,91
> if( max != check )
> print_error("unsigned_integer", "max", max, check);
71a93,94
> if( std::numeric_limits<Integer>::min() != 0 )
> std::cout << "unsigned_integer: min != 0\n";
83a107,111
> if( ! ok )
> { std::cout << "check / pi - 1.0 = " << check / pi - 1.0;
> std::cout << ", eps = " << eps << "\n";
> print_error("floating", "pi", pi, check, eps);
> }
100a129,133
> if( ! ok )
> { std::cout << "check / pi - 1.0 = " << check /pi - Base(1.0);
> std::cout << ", eps = " << eps << "\n";
> print_error("ad_floating", "pi", pi, check, eps);
> }
78c95
< Float eps = std::numeric_limits<Float>::epsilon();
---
> Float eps = epsilon<Float>();
95c112
< Base eps = std::numeric_limits<Base>::epsilon();
---
> Base eps = epsilon<Base>();
EOF
patch CppAD-%{version}/example/utility/to_string.cpp to_string.patch
# -----------------------------------------------------------------------------