You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Much of the initial code would implicitly round array indices (or similar Int-only values) in from floating point representations.
@ma-laforge was not 100% sure what happened in the original execution, so the rounding was wrapped into a call to array_round(i) = round(Int, i). It is not certain if this function correctly reproduces the original behaviour.
Either way, these calls should be replaced with explicit rounding functions, for example:
x[1:div(n,2)] instead of x[1:(n/2)] - Well, unless the original code expected rounding up.
x[1:round(Int, float_idx)]
x[1:floor(Int, float_idx)]
x[1:ceil(Int, float_idx)]
Unfortunately, the original author's intent for rounding is not always easy to decipher.
Floating-point order
There were other cases where order was passed around as a floating point value (potentially having a 0.5 fractional value after dividing by 2).
Goal
The original intent should be resolved so that floating point representations are eliminated. As a side benefit, this should also reduce accidental errors introduced when modifying code in the future.
The text was updated successfully, but these errors were encountered:
Much of the initial code would implicitly round array indices (or similar
Int
-only values) in from floating point representations.@ma-laforge was not 100% sure what happened in the original execution, so the rounding was wrapped into a call to
array_round(i) = round(Int, i)
. It is not certain if this function correctly reproduces the original behaviour.Either way, these calls should be replaced with explicit rounding functions, for example:
x[1:div(n,2)]
instead ofx[1:(n/2)]
- Well, unless the original code expected rounding up.x[1:round(Int, float_idx)]
x[1:floor(Int, float_idx)]
x[1:ceil(Int, float_idx)]
Unfortunately, the original author's intent for rounding is not always easy to decipher.
Floating-point
order
There were other cases where
order
was passed around as a floating point value (potentially having a 0.5 fractional value after dividing by 2).Goal
The original intent should be resolved so that floating point representations are eliminated. As a side benefit, this should also reduce accidental errors introduced when modifying code in the future.
The text was updated successfully, but these errors were encountered: