Daeer-Projects / Converter.Temperature

The temperature convertions methods created as extension methods.
MIT License
3 stars 0 forks source link

What to do about realistic temperatures #87

Open Daeer-Projects opened 7 months ago

Daeer-Projects commented 7 months ago

Is your feature request related to a problem? Please describe. The library will convert any temp to anything. This includes a temperature below absolute zero and above any known temperature.

Describe the solution you'd like A way to define that the library consumer can state that they only want to use realistic temperatures when converting. So use absolute zero as the minimum and 10 Trillion °C as the maximum.

Describe alternatives you've considered The library will convert anything at the moment, so is fine as it stands.

Daeer-Projects commented 7 months ago

This is an interesting idea because, in reality, would anyone need to convert temperatures that are outside the bounds of reality?

I'm not sure how to implement it, so open to ideas.

Daeer-Projects commented 7 months ago
double tempInput = -273.0d;
double result = tempInput.UsingRealisticTemperatures(o => o.UseAbsoluteZero(), o.UseMaxTemp(10000000))
                                          .FromCelsius()
                                          .ToKelvin();

Or

double tempInput = -273.0d;
double result = tempInput.FromCelsius()
                                          .ToKelvin()
                                          .UseBounds(o => o.UseAbsoluteZero(), o.UseMaxTemp(10000000));

Or

double tempInput = -273.0d;
double result = tempInput.FromCelsius()
                                          .ToKelvin()
                                          .UseRealisticTemperatures();