Boa: Implement `Number.prototype.toPrecision`

Created on 26 Apr 2020  路  10Comments  路  Source: boa-dev/boa

The toPrecision() method returns a string representing the Number object to the specified precision.

More information:

enhancement builtins

All 10 comments

I think I can handle this. :)

I assume it'll live in number/mod.rs?

I assume it'll live in number/mod.rs?

Yes. There already is the to_precision function but its not implemented here

Hello, I'm finally moving on this, sorry for the delay. I understand what we are trying to do with toPercision, but I have a few questions concerning the ECMA documentation:

  1. In step 9.a, "let e and n..." I'm going to need a resource on this math.. I understand some of it, but I'm not really familiar with range math? If you know of what I can reference to understand it better, I would be grateful!
  2. In step 9.b, "let m be the String..." Does that me something like: '.0001'?
  3. In step 9.c.ii.1, "Let a be the first code unit..." I assume they mean the 0x value for whatever character is first in m?

Thanks! Best,

Actually I think I just figured out #1. It's just a fancy way of saying n * 10^(e - p + 1) - x
The other questions still stand, but I think my assumptions are correct with those as well.

Best,

Hello @zanayr, how is this going?

Hello @zanayr, how is this going?

Hello @Razican, Apologies I have been extremely busy and this slipped my mind. I think I left off somewhere still trying to figure out the math behind 9a. I don't know if I can figure it out, perhaps I should've picked an easier issue. 馃槄

Hello @zanayr, how is this going?

Hello @Razican, Apologies I have been extremely busy and this slipped my mind. I think I left off somewhere still trying to figure out the math behind 9a. I don't know if I can figure it out, perhaps I should've picked an easier issue. sweat_smile

Would you like us to un-assign it from you? Or would you like to create a draft PR to get some feedback / help?

Hello @zanayr, how is this going?

Hello @Razican, Apologies I have been extremely busy and this slipped my mind. I think I left off somewhere still trying to figure out the math behind 9a. I don't know if I can figure it out, perhaps I should've picked an easier issue. sweat_smile

Would you like us to un-assign it from you? Or would you like to create a draft PR to get some feedback / help?

I probably should be un-assigned, I don't have the bandwidth to work on it right now, and I didn't really get that far to begin with. Apologies again, as soon as I am more free, I will return for to help on this project.

Hey ! I'm currently working on this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

attliaLin picture attliaLin  路  3Comments

gadget114514 picture gadget114514  路  3Comments

HalidOdat picture HalidOdat  路  3Comments

HalidOdat picture HalidOdat  路  3Comments

HalidOdat picture HalidOdat  路  3Comments