-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to make DerivedUnits with Squared/Exponential Denominators #6
Comments
Hi Josh,
I'm terribly sorry you're having trouble. I'm currently in the Andes with
very limited access to the Internet and anything related to Dart. I'll be
able to help more closer to April when I get back, but in the meantime can
you give some quick examples of what you have tried and what the failure
is? I would expect that something like:
final metersPerSecondSquared = DerivedUnit2(meters.per.second, seconds);
(I don't have a computer in front of me, so I'm just doing this by memory,
forgive me if I'm off on the syntax).
Thanks,
-Bruce
…On Thu, Mar 6, 2025, 11:07 Josh Lambright ***@***.***> wrote:
I've tried to accomplish this in many ways, but they all fall flat on
their face. I need to be able to create acceleration units. Are there any
best practices?
—
Reply to this email directly, view it on GitHub
<#6>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABNXFO2XGFF2YTLXL44ZMD2TBJAXAVCNFSM6AAAAABYOZDQ46VHI2DSMVQWIX3LMV43ASLTON2WKOZSHEYDANJRGUYDGMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
[image: jlambright]*jlambright* created an issue
(mongoose13/fling-units#6)
<#6>
I've tried to accomplish this in many ways, but they all fall flat on
their face. I need to be able to create acceleration units. Are there any
best practices?
—
Reply to this email directly, view it on GitHub
<#6>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABNXFO2XGFF2YTLXL44ZMD2TBJAXAVCNFSM6AAAAABYOZDQ46VHI2DSMVQWIX3LMV43ASLTON2WKOZSHEYDANJRGUYDGMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Ah, I think you'll need to use one of the specialized constructors, as in:
DerivedUnit2.quotient(...)
Either way, I'd love to hear about your use case and how I can improve the
library.
…On Tue, Mar 11, 2025, 19:31 Bruce Santier ***@***.***> wrote:
Hi Josh,
I'm terribly sorry you're having trouble. I'm currently in the Andes with
very limited access to the Internet and anything related to Dart. I'll be
able to help more closer to April when I get back, but in the meantime can
you give some quick examples of what you have tried and what the failure
is? I would expect that something like:
final metersPerSecondSquared = DerivedUnit2(meters.per.second, seconds);
(I don't have a computer in front of me, so I'm just doing this by memory,
forgive me if I'm off on the syntax).
Thanks,
-Bruce
On Thu, Mar 6, 2025, 11:07 Josh Lambright ***@***.***>
wrote:
> I've tried to accomplish this in many ways, but they all fall flat on
> their face. I need to be able to create acceleration units. Are there any
> best practices?
>
> —
> Reply to this email directly, view it on GitHub
> <#6>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AABNXFO2XGFF2YTLXL44ZMD2TBJAXAVCNFSM6AAAAABYOZDQ46VHI2DSMVQWIX3LMV43ASLTON2WKOZSHEYDANJRGUYDGMQ>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
> [image: jlambright]*jlambright* created an issue
> (mongoose13/fling-units#6)
> <#6>
>
> I've tried to accomplish this in many ways, but they all fall flat on
> their face. I need to be able to create acceleration units. Are there any
> best practices?
>
> —
> Reply to this email directly, view it on GitHub
> <#6>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AABNXFO2XGFF2YTLXL44ZMD2TBJAXAVCNFSM6AAAAABYOZDQ46VHI2DSMVQWIX3LMV43ASLTON2WKOZSHEYDANJRGUYDGMQ>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
OK, I'm back at a computer. You should ideally use the third-order constructor: final metersPerSecond = DerivedUnit3<UnitNumerator<Distance>,
UnitDenominator<Time>, UnitDenominator<Time>, Distance, Time, Time>.from(
UnitNumerator<Distance>(meters),
UnitDenominator(seconds),
UnitDenominator(seconds),
); You can convert between any of these, i.e.: final milesPerHourPerMinute = DerivedUnit3<UnitNumerator<Distance>,
UnitDenominator<Time>, UnitDenominator<Time>, Distance, Time, Time>.from(
UnitNumerator<Distance>(miles),
UnitDenominator(hours),
UnitDenominator(minutes),
);
print(metersPerSecond(3.0).butAs(milesPerHourPerMinute).withPrecision(4));
// 402.6 mi⋅h⁻¹⋅min⁻¹ Let me know if you have issues with this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've tried to accomplish this in many ways, but they all fall flat on their face. I need to be able to create acceleration units. Are there any best practices?
The text was updated successfully, but these errors were encountered: