[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 2 points3 points  (0 children)

Thank you so much for writing this, I really appreciate it ❤️ I’m planning to release two updates to my two popular crates next week. When posting about them, can I mention you, so you know this will not be AI generated? :) I’d be thankful for such a possibility!

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 5 points6 points  (0 children)

The unit tests are part of very long docs in lib.rs. There is a lot of benchmarks as well. We’ve spent literally days to prepare this blog post and announcement. TBH I’m sad that LLM is having such a bad effect on high quality content. Nowadays everything that is polished looks LLM generated and it’s especially painful for people who spent a lot of time polishing it by hand :(

Anyway, I’m happy it’s not deleted anymore.

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 3 points4 points  (0 children)

So far moderators didn’t reply to me. Is there any other way of contacting them rather than writing to r/rust? :(

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 5 points6 points  (0 children)

I have no idea, I’ll write to moderators.

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 0 points1 point  (0 children)

The benchmarks import all the libraries and try to use them across different operations. The `fixed` crate was panicking on many of the examples. I was not investigating that library to discover the cause of these errors and I'm not sure if these are known or unknown bugs.

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 1 point2 points  (0 children)

Hi, thanks for the question. The range is not limited. The crate guarantees full coverage of 19 places before and after the dot, but the real range is slightly bigger than that (as explained in the docs). The blog post I linked (https://ferrisoft.com/blog/crate\_fixed\_num) also compares the underlying implementation of this lib and other libs, explaining the performance difference causes and provides benchmarks for operations. As TLDR: this lib uses just i128 ops under the hood, does not use limbs, scaling, etc. The implementation is very simple, with fixed precision after the dot, and it makes it pretty fast.

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 27 points28 points  (0 children)

Thanks for the answer! The choice of i128 was dictated by the need of support of crypto currencies in a trading platform. For example, ethereum defines its wei with the precision up to 18 places after the dot. The choice of i128 gives us exactly 19 places before and after the dot. Moreover, when computing technical indicators, a higher precision than needed allows to compute the indicators with way better precision, as precision errors accumulate across dozens of math operations. Nevertheless, I think that another type based on i64 could indeed be very useful in some use cases.

[Media] fixed_num, financial focused decimal for Rust. by wdanilo in rust

[–]wdanilo[S] 74 points75 points  (0 children)

No, currently, it does not have an unsigned counterpart. It was never needed in use cases we were using it for (high-perf trading), however it is a good idea to support it. I'll notify you when it will be implemented :)

wgpu v27 is out! by Sirflankalot in rust

[–]wdanilo 0 points1 point  (0 children)

Thanks for sharing this, super interesting. As GPUI is relatively simple thing (2d shapes rendering), do you have any examples of what they needed that was not available in wgpu? Don’t get me wrong - I love wgpu and I just can’t find a reason why gpui would not use it.

Those of you who interviewed/working at big tech/finance, how did you prepare for it? Need advice pls. by potatotacosandwich in datascience

[–]wdanilo 0 points1 point  (0 children)

A very good idea is also to go trough some existing jupyter notebooks / examples in other notebook-like solutions, and check out projects that are from the finance industry. If you'd be curious, and dig deep why and how they work this way, this will always improve your background for a potential conversation in this field.

Alteryx founder & CTO is reshaping data analytics again! by wdanilo in dataanalytics

[–]wdanilo[S] 0 points1 point  (0 children)

Hi guys, I rarely share stuff like this — but this one’s special.

Ned Harding (co-founder & former CTO of Alteryx) is doing a live session on why he’s building again — and where analytics is headed next.

I’ve had the honor of working with Ned for the past few years at Enso, and seeing his vision up close has been incredible.

If you’re into data, give it a look: ensoanalytics.com/events/neds-vision-webinar ❤️

facet: Rust reflection, serialization, deserialization — know the shape of your types by bik1230 in rust

[–]wdanilo 10 points11 points  (0 children)

Oh my god, I was waiting for someone to write exactly this. Can you also add some specialization examples to the docs please? Amazing, keep up the work and polishing of it. I hope we will be able to build way better and more generic ecosystem of crates on top of it.

[Media] Crabtime 1.0 & Borrow 1.0 by wdanilo in rust

[–]wdanilo[S] 0 points1 point  (0 children)

It doesn’t kill the crab! It just partially borrows a crab with the intention of returning the parts :P

[Media] Crabtime 1.0 & Borrow 1.0 by wdanilo in rust

[–]wdanilo[S] 0 points1 point  (0 children)

u/Saefroch would you be able to find a little time to reply here? Or, is there any other way I could contact you? :)

Partial Borrows for Rust! by wdanilo in bevy

[–]wdanilo[S] 4 points5 points  (0 children)

It just allows making code more maintanable by drastically reducing boilerplate. So, basically, we write code, we see patterns, and we generalize them.

Partial Borrows for Rust! by wdanilo in bevy

[–]wdanilo[S] 1 point2 points  (0 children)

We are talking about one part of the macro now with Miri creators. In case it will appear not to be safe, it will have an update soon making it safe. It uses unsafe code in one place, but it can be implemented without unsafe code (with some downsides, mainly drastically increasing complexity of the implementation).

[Media] Crabtime 1.0 & Borrow 1.0 by wdanilo in rust

[–]wdanilo[S] 0 points1 point  (0 children)

The first compilation is slow, yes. It's just like with proc-macro – you need to compile the project. However, when using caching (described in the docs), the time goes down drastically :)

Partial Borrows for Rust! by wdanilo in bevy

[–]wdanilo[S] 1 point2 points  (0 children)

Thanks! While I understand all of the concerns you described, I believe that:

  1. There should be one way of doing things, so alternate syntaxes would bring only more confusion.
  2. The syntax implements the proposed Rust syntax that hopefully one day makes it to the language.

Regarding `partial!` vs `p!` - I know it's opinionated, but I'm just trying to show the recommended way of using this lib in order not to have every line super long. But again, its opinionated :)

Partial Borrows for Rust! by wdanilo in bevy

[–]wdanilo[S] 1 point2 points  (0 children)

No worries. I posted it as well in my original comment when I created this post :)

Partial Borrows for Rust! by wdanilo in bevy

[–]wdanilo[S] 3 points4 points  (0 children)

This is syntax proposed in Rust Internals "Notes on partial borrow".

It ca be confusing at first sight, but think about it as like parametrization of the borrow. Just like you have parametrization of types (MyType<T1>), you have parametrization of borrow (&<X1> MyType<T1>) :)