Integer operations may be faster on some devices. All possible values and all arithmetic needed for the conversion can fit in and be done with an i32. The cast to a f32 should always be a single fast instruction. Should we:
Switch the convert function to use i32.
Add an i32 version of the convert function in addition to the f32 version.
Make the uom base type generic for the convert function.
Leave it as it is.
Integer operations may be faster on some devices. All possible values and all arithmetic needed for the conversion can fit in and be done with an `i32`. The cast to a `f32` should always be a single fast instruction. Should we:
1. Switch the convert function to use `i32`.
1. Add an `i32` version of the convert function in addition to the f32 version.
1. Make the uom base type generic for the convert function.
1. Leave it as it is.
It's problem is to scale we need to convert the voltage to a certain unit. To not use a decimal and get full accuracy that unit would need to be millivolts but if we use millivolts instead of volts we would need to divide instead of multiply and integer division would presumably be much slower than even float multiplication so we will leave it as f32.
It's problem is to scale we need to convert the voltage to a certain unit. To not use a decimal and get full accuracy that unit would need to be millivolts but if we use millivolts instead of volts we would need to divide instead of multiply and integer division would presumably be much slower than even float multiplication so we will leave it as f32.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Integer operations may be faster on some devices. All possible values and all arithmetic needed for the conversion can fit in and be done with an
i32. The cast to af32should always be a single fast instruction. Should we:i32.i32version of the convert function in addition to the f32 version.It's problem is to scale we need to convert the voltage to a certain unit. To not use a decimal and get full accuracy that unit would need to be millivolts but if we use millivolts instead of volts we would need to divide instead of multiply and integer division would presumably be much slower than even float multiplication so we will leave it as f32.