svenstaro / rofi-calc

🖩 Do live calculations in rofi!
MIT License
991 stars 32 forks source link

Broken output for approx results #46

Closed nick87720z closed 4 years ago

nick87720z commented 4 years ago

It seems, only first line from result output is printed. E.g., there is no problem with input like "4+5" or "(x-y)^2. But for "sqrt(3)" output is such:

  sqrt(3) = approx.
            1.7320508075688772935274463415058723669428052538103806280558069794519330169088000370811461867572485756756261414154067030299699450949989524788116555120943736485280932319023055820679748201
            010846749232650153123432669033228866506722546689218379712270471316603678615880190499865373798593894676503475065760507566183481296061009476021871903250831458295239598329977898245082887144
            638329173472241639845878553976679580638183536661108431737808943783161020883055249016700235207111442886959909563657970871684980728994932964843

rofi-calc showes only first line: sqrt(3) = approx.

Would be better to show all lines before new prompt string.

Yet there is more complex output happens, e.g. with some recommendation (also I had cases in past when it told that unable to resolve something, but not it's hard to reproduce).

Example:

> integrate(sin(x) / cos(x), x, y, z)

  warning: To avoid division by zero, the following must be true: x !=
  interval(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617302656461329418768921910116446345071881625696223490056820540387704221111928924
  5897909860763928857621951331866892256951296467573566330542403818291297133846920697220908653296426787214520498282547449174013212631176349763041841925658508183430728735785180720022661061097640933042
  7682939038830232188661145407315191839061843722347638652235862102370961489247599254991347037715054497824558763660238982596673467248,
  6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617302656461329418768921910116446345071881625696223490056820540387704221111928924589790986
  0763928857621951331866892256951296467573566330542403818291297133846920697220908653296426787214520498282547449174013212631176349763041841925658508183430728735785180720022661061097640933042768293903
  8830232188661145407315191839061843722347638652235862102370961489247599254991347037715054497824558763660238982596673467249)n +
  interval(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231
  1474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503303157794087440760460481414627045857682183946295180005665265274410233260
  6920734759707558047165286351828797959765460930586909663058965525592740372311899813747836759428763624456139690915059745649168366812,
  1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746
  5190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503303157794087440760460481414627045857682183946295180005665265274410233260692073475
  9707558047165286351828797959765460930586909663058965525592740372311899813747836759428763624456139690915059745649168366813) and x !=
  interval(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617302656461329418768921910116446345071881625696223490056820540387704221111928924
  5897909860763928857621951331866892256951296467573566330542403818291297133846920697220908653296426787214520498282547449174013212631176349763041841925658508183430728735785180720022661061097640933042
  7682939038830232188661145407315191839061843722347638652235862102370961489247599254991347037715054497824558763660238982596673467248,
  6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617302656461329418768921910116446345071881625696223490056820540387704221111928924589790986
  0763928857621951331866892256951296467573566330542403818291297133846920697220908653296426787214520498282547449174013212631176349763041841925658508183430728735785180720022661061097640933042768293903
  8830232188661145407315191839061843722347638652235862102370961489247599254991347037715054497824558763660238982596673467249)n -
  interval(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231
  1474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503303157794087440760460481414627045857682183946295180005665265274410233260
  6920734759707558047165286351828797959765460930586909663058965525592740372311899813747836759428763624456139690915059745649168366812,
  1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746
  5190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503303157794087440760460481414627045857682183946295180005665265274410233260692073475
  9707558047165286351828797959765460930586909663058965525592740372311899813747836759428763624456139690915059745649168366813).
  integrate(sin(x * radian) / cos(x * radian), x, y, z) = 0.5 * ln(cos(y)^2) - 0.5 * ln(cos(z)^2)

Could be great to have output/history in scrolled area. Though could be that it's rofi theming issue, where all widgets hierarchy is created along with styles.

Yet I think about way to preconfigure cli qalc for better output formatting. At least qalculate-gtk makes neat output.

Edit: using rofi-calc 1.6. It seems to be hard to reproduce.

nick87720z commented 4 years ago

Not sure, what was wrong. I tried in qalc cli - approximate/exact, as well as set precision 20 (was 512). Now it's as neat as in qalculate-gtk. However, rofi-calc output seems to be little affected, yet bug doesn't appear where it should be, showing full output for sqrt(3). Same for super-long output for integrate example above. I'm leaving it if anyone else can reproduce problem.

svenstaro commented 4 years ago

I'm afraid I can't reproduce this even with your given example. Maybe it's some config or your qalc version? I'm on qalc 3.9.0

svenstaro commented 4 years ago

I'll close this as I still can't reproduce. Maybe check your qalc config at ~/.config/qalculate/qalc.cfg if the problem persists. If you can show me how to reproduce this on a clean install, I'll try to fix it.