Interesting problem. Concerning readability of floating point numbers, for
me personally "4.0" is better than just "4.". Is this just personal
preference or is there any benefit of just "4."?
A quick search for "float" on inkscape coding style page didn't show
anything.
--
Christoffer Holmstedt
2014-07-02 1:05 GMT+02:00 Jabiertxo Arraiza Cenoz <jabier.arraiza@...2927....>
:
Johan. Thanks for the tip.
Cheers, Jabier.
El mar, 01-07-2014 a las 23:03 +0200, Johan Engelen escribió:
> Hi Jabier,
> I'm not 100% sure, but you may consider to always use floating point
> numbers for the type of calculation you are doing, unless you are sure
> you want integer calculation. So then it becomes:
>
> (4./3.) * (sqrt(2.) - 1.)
>
> regards,
> Johan
>
>
> On 1-7-2014 9:41, Jabiertxo Arraiza Cenoz wrote:
> > Thanks Nathan. I just read it in a book but dont remeber when
> > necessary :(.
> > And thanks for the operator precedence tip.
> >
> > Cheers, Jabier.
> >
> >
> > El mar, 01-07-2014 a las 07:59 +1000, Nathan Hurst escribió:
> >> On Mon, Jun 30, 2014 at 11:56:15PM +0200, Jabiertxo Arraiza Cenoz
wrote:
> >>> Hi to all.
> >>>
> >>> I try this in my debian calculator:
> >>> "4 / 3 * (sqrt(2) - 1)" and return 0,55228475
> >>> in C++ return 0.414214
> >>>
> >>> I want 0,55228475.
> >>> Where i lost? I have the cmath header
> >> 4/3 = 1 because the type of both arguments is int. 4.0/3 fixes your
> >> problem. I would put (4./3) * sqrt() because operator precedence for
> >> divide is not always clear.
> >>
> >> njh
> >
> >
> >
------------------------------------------------------------------------------
> > Open source business process management suite built on Java and Eclipse
> > Turn processes into business applications with Bonita BPM Community
Edition
> > Quickly connect people, data, and systems into organized workflows
> > Winner of BOSSIE, CODIE, OW2 and Gartner awards
> >
http://p.sf.net/sfu/Bonitasoft
> >
> >
> > _______________________________________________
> > Inkscape-devel mailing list
> > Inkscape-devel(a)lists.sourceforge.net
> >
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
>
>
------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community
Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
>
http://p.sf.net/sfu/Bonitasoft
> _______________________________________________ Inkscape-devel mailing
list Inkscape-devel(a)lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Inkscape-devel mailing list
Inkscape-devel(a)lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-devel