diff --git a/cppad.spec b/cppad.spec index 1f2db83..552e008 100644 --- a/cppad.spec +++ b/cppad.spec @@ -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 -> 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 +> Float epsilon(void) +> { size_t digits = size_t( std::numeric_limits::digits ); +> Float radix = Float( std::numeric_limits::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::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::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::epsilon(); +--- +> Float eps = epsilon(); +95c112 +< Base eps = std::numeric_limits::epsilon(); +--- +> Base eps = epsilon(); EOF patch CppAD-%{version}/example/utility/to_string.cpp to_string.patch # -----------------------------------------------------------------------------