ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
icu4x::Decimal Class Reference

#include <Decimal.d.hpp>

Public Member Functions

uint8_t digit_at (int16_t magnitude) const
 
int16_t magnitude_start () const
 
int16_t magnitude_end () const
 
int16_t nonzero_magnitude_start () const
 
int16_t nonzero_magnitude_end () const
 
bool is_zero () const
 
void multiply_pow10 (int16_t power)
 
icu4x::DecimalSign sign () const
 
void set_sign (icu4x::DecimalSign sign)
 
void apply_sign_display (icu4x::DecimalSignDisplay sign_display)
 
void trim_start ()
 
void trim_end ()
 
void trim_end_if_integer ()
 
void pad_start (int16_t position)
 
void pad_end (int16_t position)
 
void set_max_position (int16_t position)
 
void round (int16_t position)
 
void ceil (int16_t position)
 
void expand (int16_t position)
 
void floor (int16_t position)
 
void trunc (int16_t position)
 
void round_with_mode (int16_t position, icu4x::DecimalSignedRoundingMode mode)
 
void round_with_mode_and_increment (int16_t position, icu4x::DecimalSignedRoundingMode mode, icu4x::DecimalRoundingIncrement increment)
 
diplomat::result< std::monostate, std::monostate > concatenate_end (icu4x::Decimal &other)
 
std::string to_string () const
 

Static Public Member Functions

static std::unique_ptr< icu4x::Decimalfrom (int32_t v)
 
static std::unique_ptr< icu4x::Decimalfrom (uint32_t v)
 
static std::unique_ptr< icu4x::Decimalfrom (int64_t v)
 
static std::unique_ptr< icu4x::Decimalfrom (uint64_t v)
 
static diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitErrorfrom_double_with_integer_precision (double f)
 
static diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitErrorfrom_double_with_lower_magnitude (double f, int16_t magnitude)
 
static diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitErrorfrom_double_with_significant_digits (double f, uint8_t digits)
 
static diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitErrorfrom_double_with_round_trip_precision (double f)
 
static diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalParseErrorfrom_string (std::string_view v)
 
static void operator delete (void *ptr)
 

Detailed Description

See the Rust documentation for Decimal for more information.

Member Function Documentation

◆ apply_sign_display()

void icu4x::Decimal::apply_sign_display ( icu4x::DecimalSignDisplay sign_display)
inline

See the Rust documentation for apply_sign_display for more information.

◆ ceil()

void icu4x::Decimal::ceil ( int16_t position)
inline

See the Rust documentation for ceil for more information.

◆ concatenate_end()

diplomat::result< std::monostate, std::monostate > icu4x::Decimal::concatenate_end ( icu4x::Decimal & other)
inline

Concatenates other to the end of self.

If successful, other will be set to 0 and a successful status is returned.

If not successful, other will be unchanged and an error is returned.

See the Rust documentation for concatenate_end for more information.

◆ digit_at()

uint8_t icu4x::Decimal::digit_at ( int16_t magnitude) const
inline

See the Rust documentation for digit_at for more information.

◆ expand()

void icu4x::Decimal::expand ( int16_t position)
inline

See the Rust documentation for expand for more information.

◆ floor()

void icu4x::Decimal::floor ( int16_t position)
inline

See the Rust documentation for floor for more information.

◆ from() [1/4]

std::unique_ptr< icu4x::Decimal > icu4x::Decimal::from ( int32_t v)
inlinestatic

Construct an Decimal from an integer.

See the Rust documentation for Decimal for more information.

◆ from() [2/4]

std::unique_ptr< icu4x::Decimal > icu4x::Decimal::from ( int64_t v)
inlinestatic

Construct an Decimal from an integer.

See the Rust documentation for Decimal for more information.

◆ from() [3/4]

std::unique_ptr< icu4x::Decimal > icu4x::Decimal::from ( uint32_t v)
inlinestatic

Construct an Decimal from an integer.

See the Rust documentation for Decimal for more information.

◆ from() [4/4]

std::unique_ptr< icu4x::Decimal > icu4x::Decimal::from ( uint64_t v)
inlinestatic

Construct an Decimal from an integer.

See the Rust documentation for Decimal for more information.

◆ from_double_with_integer_precision()

diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitError > icu4x::Decimal::from_double_with_integer_precision ( double f)
inlinestatic

Construct an Decimal from an integer-valued float

See the Rust documentation for try_from_f64 for more information.

See the Rust documentation for FloatPrecision for more information.

◆ from_double_with_lower_magnitude()

diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitError > icu4x::Decimal::from_double_with_lower_magnitude ( double f,
int16_t magnitude )
inlinestatic

Construct an Decimal from an float, with a given power of 10 for the lower magnitude

See the Rust documentation for try_from_f64 for more information.

See the Rust documentation for FloatPrecision for more information.

◆ from_double_with_round_trip_precision()

diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitError > icu4x::Decimal::from_double_with_round_trip_precision ( double f)
inlinestatic

Construct an Decimal from an float, with enough digits to recover the original floating point in IEEE 754 without needing trailing zeros

See the Rust documentation for try_from_f64 for more information.

See the Rust documentation for FloatPrecision for more information.

◆ from_double_with_significant_digits()

diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalLimitError > icu4x::Decimal::from_double_with_significant_digits ( double f,
uint8_t digits )
inlinestatic

Construct an Decimal from an float, for a given number of significant digits

See the Rust documentation for try_from_f64 for more information.

See the Rust documentation for FloatPrecision for more information.

◆ from_string()

diplomat::result< std::unique_ptr< icu4x::Decimal >, icu4x::DecimalParseError > icu4x::Decimal::from_string ( std::string_view v)
inlinestatic

Construct an Decimal from a string.

See the Rust documentation for try_from_str for more information.

◆ is_zero()

bool icu4x::Decimal::is_zero ( ) const
inline

See the Rust documentation for is_zero for more information.

◆ magnitude_end()

int16_t icu4x::Decimal::magnitude_end ( ) const
inline

See the Rust documentation for magnitude_range for more information.

◆ magnitude_start()

int16_t icu4x::Decimal::magnitude_start ( ) const
inline

See the Rust documentation for magnitude_range for more information.

◆ multiply_pow10()

void icu4x::Decimal::multiply_pow10 ( int16_t power)
inline

Multiply the Decimal by a given power of ten.

See the Rust documentation for multiply_pow10 for more information.

◆ nonzero_magnitude_end()

int16_t icu4x::Decimal::nonzero_magnitude_end ( ) const
inline

See the Rust documentation for nonzero_magnitude_end for more information.

◆ nonzero_magnitude_start()

int16_t icu4x::Decimal::nonzero_magnitude_start ( ) const
inline

See the Rust documentation for nonzero_magnitude_start for more information.

◆ operator delete()

void icu4x::Decimal::operator delete ( void * ptr)
inlinestatic

◆ pad_end()

void icu4x::Decimal::pad_end ( int16_t position)
inline

Zero-pad the Decimal on the right to a particular position

See the Rust documentation for pad_end for more information.

◆ pad_start()

void icu4x::Decimal::pad_start ( int16_t position)
inline

Zero-pad the Decimal on the left to a particular position

See the Rust documentation for pad_start for more information.

◆ round()

void icu4x::Decimal::round ( int16_t position)
inline

Round the number at a particular digit position.

This uses half to even rounding, which resolves ties by selecting the nearest even integer to the original value.

See the Rust documentation for round for more information.

◆ round_with_mode()

void icu4x::Decimal::round_with_mode ( int16_t position,
icu4x::DecimalSignedRoundingMode mode )
inline

See the Rust documentation for round_with_mode for more information.

◆ round_with_mode_and_increment()

void icu4x::Decimal::round_with_mode_and_increment ( int16_t position,
icu4x::DecimalSignedRoundingMode mode,
icu4x::DecimalRoundingIncrement increment )
inline

◆ set_max_position()

void icu4x::Decimal::set_max_position ( int16_t position)
inline

Truncate the Decimal on the left to a particular position, deleting digits if necessary. This is useful for, e.g. abbreviating years ("2022" -> "22")

See the Rust documentation for set_max_position for more information.

◆ set_sign()

void icu4x::Decimal::set_sign ( icu4x::DecimalSign sign)
inline

Set the sign of the Decimal.

See the Rust documentation for set_sign for more information.

◆ sign()

icu4x::DecimalSign icu4x::Decimal::sign ( ) const
inline

See the Rust documentation for sign for more information.

◆ to_string()

std::string icu4x::Decimal::to_string ( ) const
inline

Format the Decimal as a string.

See the Rust documentation for write_to for more information.

◆ trim_end()

void icu4x::Decimal::trim_end ( )
inline

See the Rust documentation for trim_end for more information.

◆ trim_end_if_integer()

void icu4x::Decimal::trim_end_if_integer ( )
inline

See the Rust documentation for trim_end_if_integer for more information.

◆ trim_start()

void icu4x::Decimal::trim_start ( )
inline

See the Rust documentation for trim_start for more information.

◆ trunc()

void icu4x::Decimal::trunc ( int16_t position)
inline

See the Rust documentation for trunc for more information.


The documentation for this class was generated from the following files: