Parser of berki style problems and generator of latex file
Samo Penic
2018-11-22 34c8f68e07f07cd124b395d4d05dd2c888e7b1fc
Dec formatting redefined
2 files modified
39 ■■■■ changed files
aoi_gen/Variable.py 27 ●●●●● patch | view | raw | blame | history
testcases/dvovod31.txt 12 ●●●● patch | view | raw | blame | history
aoi_gen/Variable.py
@@ -127,13 +127,36 @@
        except TypeError:
            raise ValueError
        num=float(("{:."+str(self.precision-1)+"e}").format(num))
        places=self.fexp(num)
        if(places>0):
            decimal_places=self.precision-places-1
            if(decimal_places<0):
                decimal_places=0
            format_str="{:"+str(places)+"."+str(decimal_places)+"f}"
        else:
            format_str="{:."+str(self.precision)+"f}"
        return (
                ("{:." + str(self.precision - 1) + "f}").format(num).replace(".", ",\!")
                format_str.format(num).replace(".", ",\!")
            )
    def getValue(self, num):
        val = ("{:." + str(self.precision - 1) + "f}").format(num)
        num=float(("{:."+str(self.precision-1)+"e}").format(num))
        places=self.fexp(num)
        if(places>0):
            decimal_places=self.precision-places-1
            if(decimal_places<0):
                decimal_places=0
            format_str="{:"+str(places)+"."+str(decimal_places)+"f}"
        else:
            format_str="{:."+str(self.precision)+"f}"
        val=format_str.format(num)
        return float(val)
testcases/dvovod31.txt
@@ -43,12 +43,12 @@
#StartRezultat
TeX:        E(\mathrm{A})
izpis:        prefix 3
izpis:        dec 8
enota:        V/m
formula:    eps0=8.854e-12;EA=q/(pi*eps0*h)*abs(-1+1/(1+(d/h)^2));EA
napacna:    q/(2*pi*eps0*h)*abs(-1+1/(1+(d/h)^2))
napacna:    5.29864*EA
napacna:    q/(pi*eps0*h)*abs(1/(1+(d/h)^2))
formula:    -0.00124567890
napacna:    -1200000
napacna:    -0.12
napacna:    -12.3
#EndRezultat
#StartPodnaloga
@@ -73,7 +73,7 @@
TeX:        c
izpis:        sci 3
enota:        F/m
formula:    D=sqrt(d^2+4*h^2);c=pi*eps0/log(2*h*d/(r0*D));c
formula:    c=3;c
napacna:    2.4869128*c
napacna:    0.84128*c
napacna:    0.6838*c