Lines Matching refs:is
10 // distributed under the License is distributed on an "AS IS" BASIS,
37 // Returns true if the given value is any kind of infinity.
56 // a value is Nan.
66 // Returns true if the given value is any kind of infinity.
78 // Returns true if the given value is any kind of infinity.
90 // Returns true if the given value is any kind of infinity.
98 // Since copying a floating point number (especially if it is NaN)
106 // Since this is to act similar to the normal floats,
110 // Intentionally non-explicit. This is a proxy type so
114 // Intentionally non-explicit. This is a proxy type so
118 // This is helpful to have and is guaranteed not to stomp bits.
155 std::istream& operator>>(std::istream& is, FloatProxy<T>& value) {
157 is >> float_val;
159 return is;
162 // This is an example traits. It is not meant to be used in practice, but will
252 // These are all written like this because it is convenient to have
266 // then we have to left-shift to get rid of leading 0s. This is the amount
272 // includes the leading bit that is usually implicit.
281 // The least significant bit in the exponent, which is also the bit
291 // The bit that is used as a sign.
298 // How far left the exponent is shifted.
301 // How far from the right edge the fraction is shifted.
327 // Returns the exponent in unbiased form. This is the exponent in the
341 if ((getBits() & ~sign_mask) == 0) { // special case if everything is 0
371 // Note this assumes EVERY significand is normalized, and has an implicit
373 // is if you set a number so denormalized that it underflows.
376 // The significand is also expected to be in the
378 // The exponent is expected to be unbiased, meaning an exponent of
380 // If underflow_round_up is set, then on underflow, if a number is non-0
389 // the significand is not zero.
423 // carry is set to true and the significand is shifted to fit into
424 // the correct location, otherwise carry is set to false.
465 // other_T. This is shifted so that the most significant
501 // If every non-representable bit is 0, then we don't have any casting to
521 // Have to round down, round bit is 0
526 // If any subsequent bit of the rounded portion is non-0 then we round
550 // Casts this value to another HexFloat. If the cast is widening,
551 // then round_dir is ignored. If the cast is narrowing, then
552 // the result is rounded in the direction specified.
681 // If the number is all zeros, then we actually have to NOT shift the
686 // our leading bit is 1.
693 // Since this is denormalized, we have to consume the leading 1 since it
713 // Make sure to keep the leading 0s in place, since this is the fractional
726 // Returns true if negate_value is true and the next character on the
727 // input stream is a plus or minus sign. In that case we also set the fail bit
730 inline bool RejectParseDueToLeadingSign(std::istream& is, bool negate_value,
733 auto next_char = is.peek();
738 is.setstate(std::ios_base::failbit);
747 // If negate_value is true then the number may not have a leading minus or
748 // plus, and if it successfully parses, then the number is negated before
752 // TODO(dneto): Promise C++11 standard behavior in how the value is set in
756 inline std::istream& ParseNormalFloat(std::istream& is, bool negate_value,
758 if (RejectParseDueToLeadingSign(is, negate_value, value)) {
759 return is;
762 is >> val;
768 if (is.fail() && value.getUnsignedBits() == 0u) {
776 is.setstate(std::ios_base::failbit);
778 return is;
784 // The number is rounded towards zero.
785 // If negate_value is true then the number may not have a leading minus or
786 // plus, and if it successfully parses, then the number is negated before
790 // TODO(dneto): Promise C++11 standard behavior in how the value is set in
796 std::istream& is, bool negate_value,
800 ParseNormalFloat(is, negate_value, float_val);
810 is.setstate(std::ios_base::failbit);
812 return is;
816 // If the float is not encoded as a hex-float then it will be parsed
821 // infinity but this special pattern is the exact representation for a NaN,
822 // and therefore is actually encoded as the correct NaN. To encode inf,
835 std::istream& operator>>(std::istream& is, HexFloat<T, Traits>& value) {
842 if (is.flags() & std::ios::skipws) {
844 while (std::isspace(is.peek())) {
845 is.get();
849 auto next_char = is.peek();
853 return ParseNormalFloat(is, negate_value, value);
858 is.get();
859 next_char = is.peek();
863 is.get(); // We may have to unget this.
864 auto maybe_hex_start = is.peek();
866 is.unget();
867 return ParseNormalFloat(is, negate_value, value);
869 is.get(); // Throw away the 'x';
872 return ParseNormalFloat(is, negate_value, value);
884 while ((next_char = is.peek()) == '0') {
885 is.get();
890 // NB: This does not mean the value is actually denorm,
900 // We know this is not denormalized since we have stripped all leading
919 is.setstate(std::ios::failbit);
920 return is;
922 is.get();
923 next_char = is.peek();
948 // We still have not found our 'p' exponent yet, so this is not a valid
950 is.setstate(std::ios::failbit);
951 return is;
953 is.get();
954 next_char = is.peek();
963 is.setstate(std::ios::failbit);
964 return is;
976 is.get();
977 next_char = is.peek();
1032 return is;