connorferster / forallpeople

Python SI units library: your 'daily driver' for calculations.
Apache License 2.0
295 stars 39 forks source link

Units changing from m to mm when values are below 1 #98

Open GJoe2 opened 5 months ago

GJoe2 commented 5 months ago

Is there any way to control what unit to display at calculation? See this example:

import handcalcs.render
import forallpeople as si
si.environment('structural',top_level=True)

%%render 2
a = 0.30*m
b = 0.60*m
c = a + b

"a" is displayed as 300.00 mm "b" is displayed as 600.00 mm, so if "a" and "b" are in "mm" and "c" is displayed as 900.00 mm. Can I modified something to fix everything at "m"

While answer are correct, "mm" is an unwanted behavior for reports, I expect results in "m"

0av commented 4 months ago

Hello @GJoe2,

especially for this reason, I started using pint. In pint one can set preferred units etc. It has much more configuration options. And it performes also well with handcals.

Here are my default setting for pint in usage with handcals: https://github.com/connorferster/handcalcs/issues/203#issue-2337367199

@connorferster, do you have any plans for the future for forallpeople? For general purpose it is fine enough, but for more complicated use cases, pint would do the job quite well (my opinion).