Skip to content

Rename DecimalFraction units to Decimal - #880

Closed
angularsen wants to merge 1 commit into
masterfrom
add-ratio-fraction
Closed

Rename DecimalFraction units to Decimal#880
angularsen wants to merge 1 commit into
masterfrom
add-ratio-fraction

Conversation

@angularsen

@angularsenangularsen commented Dec 29, 2020

Copy link
Copy Markdown
Owner

Decimal fraction is not a correct term.

Definition of Decimal Fraction
A fraction where the denominator (the bottom number) is a power of ten (such as 10, 100, 1000, etc).
Source.

So, to convert a fraction to a decimal, divide the numerator by the denominator.
Source.

Changes

  • Add Ratio.Decimal unit, mark DecimalFraction unit as obsolete
  • Add RatioChangeRate.DecimalPerSecond, mark DecimalFractionPerSecond unit as obsolete
  • Change base unit of each quantity to the new unit

Changing the base unit should not be a breaking change for most users and the conversion precision is exactly the same as before for all units.

@angularsen

Copy link
Copy Markdown
OwnerAuthor

Related to #879

@lipchev

Copy link
Copy Markdown
Collaborator

I'm not sure about this- the linked definition emphasizes the distinction between 1/2 (fraction) and 5/10 (decimal fraction). However what we're representing is the right hand side of the equation: e.g. 0.53 which is the decimalvalue representation of a fraction (i.e. using a decimal symbol).

@angularsen

Copy link
Copy Markdown
OwnerAuthor

@lipchev Good point, some more googling and I believe decimal is the correct term?

So, to convert a fraction to a decimal, divide the numerator by the denominator.
https://www.bbc.co.uk/bitesize/topics/znmtsbk/articles/z4ymtv4

@angularsen

Copy link
Copy Markdown
OwnerAuthor

Updated PR to use Decimal and updated both Ratio and RatioChangeRate.

@angularsenangularsen changed the title Add Ratio.Fraction and deprecate DecimalFractionRename DecimalFraction units to DecimalDec 29, 2020
@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor

The problem with Ratio.Decimal is that decimal is a type in C#, so it could create confusion.

@angularsen

Copy link
Copy Markdown
OwnerAuthor

@MarkCiliaVincenti Right, but since its type is double I think maybe not a big problem.
After reading up on the terms I believe DecimalFraction is not a good choice either.

Are we happy with Decimal? Any other suggestions?
@lipchev@MarkCiliaVincenti

@lipchev

Copy link
Copy Markdown
Collaborator

I personally prefer DecimalFraction over Decimal: we're represents a Ratio in terms of a Decimal Fraction expressed (visually) using the

modern European decimal notation

I also think that renaming this would have quite a visible effect on client code (having obsolete warnings popping all over the place), that it simply wouldn't be worth the effort..

@angularsen

Copy link
Copy Markdown
OwnerAuthor

@lipchev Ok, I had not considered the "visual representation" part. I guess it makes sense when reading the wiki section.

https://en.wikipedia.org/wiki/Decimal#Decimal_fractions

The numbers that are represented by decimal numerals are the decimal fractions (sometimes called decimal numbers),
For example, the numerals
image
represent the fractions
image

I guess we could call it DecimalNumeral, but that is a very unfamiliar term to me at least.
I agree, not worth the hassle. Let's stick with DecimalFraction.

@angularsen
angularsen deleted the add-ratio-fraction branch November 20, 2022 20:20
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@angularsen@lipchev@MarkCiliaVincenti