World: r3wp
[Core] Discuss core issues
older newer | first last |
Volker 6-Oct-2005 [2244] | what would you think about something like "###.##e##". |
Tomc 6-Oct-2005 [2245] | they call the same underlying math libs |
Pekr 6-Oct-2005 [2246] | Volker - what is that? :-) |
Volker 6-Oct-2005 [2247] | AFAIK he derived by comparisions, not the math itself? |
Tomc 6-Oct-2005 [2248x2] | hmmm propagating bad design |
well it would be the display routines that are mangling not the math | |
Volker 6-Oct-2005 [2250] | # is a digit, gives numbers like 123.45e67 |
Pekr 6-Oct-2005 [2251] | I know Volker, but what with that? Kind of templating/masking? Or what do you mean? |
Volker 6-Oct-2005 [2252] | how about using that for a pad-function? |
Pekr 6-Oct-2005 [2253] | if BCD was decided to be replaced by other solution, maybe we should ask Ladislav to comment a bit what will happen in that regard? |
Volker 6-Oct-2005 [2254x2] | hmm, i see its a path. so [pad n ###.##] would work without quotes :) |
its path -> is issue | |
Tomc 6-Oct-2005 [2256x4] | maybe it should be a dialect |
there is front middle and bacl padding | |
pad list [","] | |
for a comma seperated list | |
Volker 6-Oct-2005 [2260] | Pekr: "I did not find an easier way, so I parse for E, then I distinguish the sign, the number -5 in above case, and then I compose the string :-)" !> a: 123.456 reduce[to integer! a remainder a 1] == [123 0.456000000000003] Maybe the base for something better (dont know how easy that parsing is?) |
Pekr 6-Oct-2005 [2261] | dunno ... you simply has some computation, it returns the result ... and result may be something like 1 / 100, and you suddenly end-up with 1E-2, now what to do with that? |
Volker 6-Oct-2005 [2262x2] | split in integer and fraction, pad integer, do something with fraction, join them. |
fraction could be rounded, then copy/part. | |
Sunanda 6-Oct-2005 [2264] | Petr: <I wrote generalised solution in the past.> Is that published? Eric Long also did some nice work on a format.r function....I'm trying to find out if it is still available to the public (I have a copy of it) |
Pekr 6-Oct-2005 [2265] | I have my own function currently for that, it is just I dont find 1E-2 really usefully for anything, or just maybe form should be tweaked to form decimals in their full representation ... |
Volker 6-Oct-2005 [2266x3] | http://www.nwlink.com/~ecotope1/index.r? |
ncie, rebol indexes our index.r's :) and word-browser was great to find "remainder". | |
short enough? http://polly.rebol.it/test/test/snippets/epad1.r | |
Sunanda 6-Oct-2005 [2269] | Looks good, Volker. One problem: more than 9 leading zeroes: epad1 0 10 0 ** Math Error: Math or number overflow (There is a much larger limit on trailing zeroes after the decimal sign) |
Volker 6-Oct-2005 [2270] | tricky. hmm, money should have a bigger scope? |
Sunanda 6-Oct-2005 [2271] | Nine *should* be enough for most people -- I didn't have a specific case in mind. I was just testing the limits. |
Volker 6-Oct-2005 [2272x2] | testing is good :) |
Yep, money is worth its -erm, punning here.. adds more digits. (uploaded) | |
Sunanda 6-Oct-2005 [2274] | 14 leading zeroes is probably enough for anyone :-) One bug? epad1 0.09 1 2 == "0.90" ;; 10 times too large! |
Volker 6-Oct-2005 [2275x2] | thanks. will look at that. |
forgot to pad remainder to. so 0.09 * 100 -> 9 . should be 09 so that appending 0s works. but got another bug-description on linux. there it is fixed. | |
Benjamin 9-Oct-2005 [2277] | i need to make a function wich can take n optional arguments, n can be from 1 to many arguments any help |
Graham 9-Oct-2005 [2278x2] | I think Ladislav has done some work on this. |
Otherwise supply it as a block :) | |
Benjamin 9-Oct-2005 [2280] | i whas thinking about the block option it seems more acurrate |
Ladislav 9-Oct-2005 [2281] | supply it as a block is the proper solution I think |
Pekr 11-Oct-2005 [2282] | btw - what you think of following? - normally we can access paths in several ways ... block/5 (fifth element), block/literal (literal element), block/(expression) (expressionn to evaluate). Nonexistant elements do return 'none. But try block/("some string") - it returns error. Now the question is, if this is correct/consistent with other ways of how we access block elements, or not? |
RebolJohn 11-Oct-2005 [2283] | Question: <Unix Time>.. I found several functions on the web that show you how to create a unix-timestamp from a rebol time (now). However, I am looking for the ability to convert a unix-timestamp back into rebol-time. I started writing my own function but I think that leap-years might mess me up. Anyone have any thought on the matter? |
Volker 11-Oct-2005 [2284x2] | !> now + to-time 1e6 == 23-Oct-2005/13:26:16+2:00 |
i guess you can refine that for conversion. a unix-timestamp is an integer based on some date? | |
RebolJohn 11-Oct-2005 [2286] | 1/1/1970 0:00:00 |
Volker 11-Oct-2005 [2287] | an then 32 bits for miliseconds or something like this? |
RebolJohn 11-Oct-2005 [2288x3] | The unix-timestamp could be any date/time.. so I think I have to work top down.. first find the year then month, day, hour, min, sec. Kind of like building a binary number from a decimal.. top-down. |
Precision (ms) is used/not used depending on the OS / config. | |
I have some MRTG/RRDTool files that I am parsing for certain data and they all use the unix-timestamp format (not including ms) | |
Volker 11-Oct-2005 [2291] | i thought it is just an integer. So it is more complicated build, with year, month etc? |
RebolJohn 11-Oct-2005 [2292] | Yeah. the date -> unixTime function from someone else (maybe Gabrielle) is.. to-unix-time: func [date] [ date/date - 1-1-1970 * 86400 + to-integer date/time ] |
Volker 11-Oct-2005 [2293] | then you could reverse that. as my example shows, you can add times to dates. i think it works also in that large range. |
older newer | first last |